Re: Problem with ODBC class

From: Clemens Ladisch <clemens(at)ladisch(dot)de>
To: pgsql-odbc(at)lists(dot)postgresql(dot)org
Subject: Re: Problem with ODBC class
Date: 2018-05-09 07:18:25
Message-ID: 5e55ec85-c319-0196-dad9-8ecf655eb118@ladisch.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Jari Siikarla 2018-05-11 09:33:20 Bug report: x64 Row status Array uses wrong data type
Previous Message Igor Korot 2018-05-09 04:08:05 Problem with ODBC class