Re: Re: Driver errors with Autocad (please help) - Mailing list pgsql-odbc

From Hiroshi Inoue
Subject Re: Re: Driver errors with Autocad (please help)
Date
Msg-id 3ADF846D.BB5E0242@tpf.co.jp
Whole thread Raw
In response to Driver errors with Autocad (please help)  ("Andrea Aime" <aaime@comune.modena.it>)
List pgsql-odbc
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

pgsql-odbc by date:

Previous
From: "Andrea Aime"
Date:
Subject: Re: Driver errors with Autocad (please help)
Next
From: Hiroshi Inoue
Date:
Subject: [Fwd: [GENERAL] Re: How to configure iodbc access to local postgres db?]