Re: Problem with ODBC class

Clemens Ladisch <[email protected]>
Newsgroups gmane.comp.db.postgresql.odbc
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.