Re: Problem with ODBC class - Mailing list pgsql-odbc

From Clemens Ladisch
Subject Re: Problem with ODBC class
Date
Msg-id 5e55ec85-c319-0196-dad9-8ecf655eb118@ladisch.de
Whole thread Raw
In response to Problem with ODBC class  (Igor Korot <ikorot01@gmail.com>)
List pgsql-odbc
Igor Korot wrote:
>                 memset( qry, '\0', query.size() + 2 );
>                 memset( table_name, '\0', tableName.length() + 2 );
>                 memset( schema_name, '\0', schemaName.length() + 2 );

memset() expects a length in bytes.

>                     retcode = SQLBindParameter( stmt, 1,
> SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WCHAR, schemaName.length(), 0,
> schema_name, 0, &cbSchemaName );

Are you sure that a BufferLength (9th parameter) of zero is allowed?
The SQL_DESC_OCTET_LENGTH documentation says:
| The length, in bytes, of a character string or binary data type. For
| fixed-length character or binary types, this is the actual length in
| bytes. For variable-length character or binary types, this is the
| maximum length in bytes.

>     SQLWCHAR *owner = NULL;
>     ...
>     retcode = SQLBindCol( stmt, 1, SQL_C_WCHAR, &owner, columnSizePtr, &cbTableOwner );

You are giving the address of the pointer, so the pointer itself gets overwritten.


Regards,
Clemens


pgsql-odbc by date:

Previous
From: Igor Korot
Date:
Subject: Problem with ODBC class
Next
From: Jari Siikarla
Date:
Subject: Bug report: x64 Row status Array uses wrong data type