Skip site navigation (1) Skip section navigation (2)

Re: Driver errors with Autocad (please help)

From: "Andrea Aime" <aaime(at)comune(dot)modena(dot)it>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: Postgres ODBC <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Driver errors with Autocad (please help)
Date: 2001-04-20 06:41:57
Message-ID: 3ADFDA35.2D4DDA6C@comune.modena.it (view raw or flat)
Thread:
Lists: pgsql-odbc
Here is a snippet from sql.log:

...

acad            78-48	EXIT  SQLPrepareW  with return code 0
(SQL_SUCCESS)
		HSTMT               04DF21B8
		WCHAR *             0x0384F010 [      42] "SELECT CLASSE FROM tav974
WHERE SIAPK974=?"
		SDWORD                    42

acad            78-48	ENTER SQLNumResultCols 
		HSTMT               04DF21B8
		SWORD *             0x057BE924

acad            78-48	EXIT  SQLNumResultCols  with return code 0
(SQL_SUCCESS)
		HSTMT               04DF21B8
		SWORD *             0x057BE924 (1)

acad            78-48	ENTER SQLDescribeColW 
		HSTMT               04DF21B8
		UWORD                        1 
		WCHAR *             0x00000000 
		SWORD                        0 
		SWORD *             0x00000000
		SWORD *             0x057BE93C
		SQLULEN *           0x057BE948
		SWORD *             0x057BE958
		SWORD *             0x057BE932

acad            78-48	EXIT  SQLDescribeColW  with return code -1
(SQL_ERROR)
		HSTMT               04DF21B8
		UWORD                        1 
		WCHAR *             0x00000000 
		SWORD                        0 
		SWORD *             0x00000000
		SWORD *             0x057BE93C
		SQLULEN *           0x057BE948
		SWORD *             0x057BE958
		SWORD *             0x057BE932

		DIAG [S1002] Invalid column number in DescribeCol.;
ERROR:  parser: parse error at or near "" (13) 

acad            78-48	ENTER SQLGetDiagRecW 
		SQLSMALLINT                  3 
		SQLHANDLE           04DF21B8
		SQLSMALLINT                  1 
		SQLWCHAR *          0x057BE4C8 (NYI) 
 		SQLINTEGER *        0x057BE4E8
		SQLWCHAR *          0x057BE0C8 (NYI) 
 		SQLSMALLINT                512 
		SQLSMALLINT *       0x057BE4D8

acad            78-48	EXIT  SQLGetDiagRecW  with return code 0
(SQL_SUCCESS)
		SQLSMALLINT                  3 
		SQLHANDLE           04DF21B8
		SQLSMALLINT                  1 
		SQLWCHAR *          0x057BE4C8 (NYI) 
 		SQLINTEGER *        0x057BE4E8 (13)
		SQLWCHAR *          0x057BE0C8 (NYI) 
 		SQLSMALLINT                512 
		SQLSMALLINT *       0x057BE4D8 (80)

acad            78-48	ENTER SQLGetDiagRecW 
		SQLSMALLINT                  3 
		SQLHANDLE           04DF21B8
		SQLSMALLINT                  2 
		SQLWCHAR *          0x057BE4C8 (NYI) 
 		SQLINTEGER *        0x057BE4E8
		SQLWCHAR *          0x057BE0C8 (NYI) 
 		SQLSMALLINT                512 
		SQLSMALLINT *       0x057BE4D8

acad            78-48	EXIT  SQLGetDiagRecW  with return code 100
(SQL_NO_DATA_FOUND)
		SQLSMALLINT                  3 
		SQLHANDLE           04DF21B8
		SQLSMALLINT                  2 
		SQLWCHAR *          0x057BE4C8 (NYI) 
 		SQLINTEGER *        0x057BE4E8
		SQLWCHAR *          0x057BE0C8 (NYI) 
 		SQLSMALLINT                512 
		SQLSMALLINT *       0x057BE4D8

acad            78-48	ENTER SQLFreeStmt 
		HSTMT               04DF21B8
		UWORD                        1 <SQL_DROP>

...

The second parameter is 1, that is converted at the beginning of 
SQLDescribeCol into 0 in order to get a 0-based index...
Hope this helps

Hiroshi Inoue wrote:
> 
> Andrea Aime wrote:
> >
> > I begin to see some light now that I've spent some hours looking
> > at the logs and at the source code. Autocad first prepares a
> > statement with SQLPrepare, and the statement looks like:
> > "SELECT CLASSE FROM tav974 WHERE SIAPK974=?"
> > Then it calls SQLNumResultCols, which in turn calls SC_pre_execute
> > and finally SQLExecute wich fails because there is still no
> > parameter binding. If I set "Parse statements = 1" then SQLNumResultCols
> > runs fine and returns 1, but the subsequent SQLDescribeCol fails
> > because it calls SC_pre_execute... That happens in the following code
> > (from results.c):
> >
> > if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi &&
> > stmt->fi[icol])
> > {
> >         if (icol >= stmt->nfld)
> >         {
> >                 stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
> >                 stmt->errormsg = "Invalid column number in DescribeCol.";
> >                 SC_log_error(func, "", stmt);
> >                 return SQL_ERROR;
> >         }
> >         mylog("DescribeCol: getting info for icol=%d\n", icol);
> >
> >         fieldtype = stmt->fi[icol]->type;
> >         col_name = stmt->fi[icol]->name;
> >         precision = stmt->fi[icol]->precision;
> >
> >         mylog("PARSE: fieldtype=%d, col_name='%s', precision=%d\n", fieldtype,
> > col_name, precision);
> >         if (fieldtype > 0)
> >                 parse_ok = TRUE;
> >         }
> > }
> >
> >         /*
> >          * If couldn't parse it OR the field being described was not parsed
> >          * (i.e., because it was a function or expression, etc, then do it the
> >          * old fashioned way.
> >          */
> >         if (!parse_ok)
> >         {
> >                 SC_pre_execute(stmt);   <======= HERE!!!!!!!
> >
> > Now, it seems that this happens because stmt->fi[icol] doesn't get
> > properly initialized...
> 
> Isn't the second parameter of the SQLDescribeCol() zero ?
> 
> regards,
> Hiroshi Inoue
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Responses

pgsql-odbc by date

Next:From: Hiroshi InoueDate: 2001-04-20 08:14:52
Subject: Re: Driver errors with Autocad (please help)
Previous:From: Hiroshi InoueDate: 2001-04-20 03:58:14
Subject: [Fwd: [GENERAL] Re: How to configure iodbc access to local postgres db?]

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group