pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedpsqlodbc30w.dll: wrong string termination after SQLFetch for SQL_C_WCHAR buffer bound via SQLBindCol
3+ messages / 3 participants
[nested] [flat]
* psqlodbc30w.dll: wrong string termination after SQLFetch for SQL_C_WCHAR buffer bound via SQLBindCol
@ 2003-12-16 09:21 Michael Ziehensack <Michael.Ziehensack@boc-eu.com>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Ziehensack @ 2003-12-16 09:21 UTC (permalink / raw)
To: pgsql-odbc
Hi,
I have the problem described below in an ODBC application which occurs
only with PostgreSQL and PostgreSQL-ODBC drivers:
When I fetch string data via ODBC of a column with the "text" datatype
(but also when the datatype is "varchar") of a unicode encoded database
into a SQLWCHAR-buffer, the string termination in the out-buffer is set
wrong, as only the first byte of the string-termination is set to 0 (i.e.,
SQLWCHAR character at relevant position is 0xcdcd before fetch, and set to
0xcd00 after fetch instead of 0x000). The problem doesn't occur with other
drivers (e.g., SQL-Server or SAP-DB/MaxDB).
Details:
PostgreSQL Server version: 7.3.2-1 running on Windows 2000 under
cygwin-environment
PostgreSQL-ODBC driver: version: 7-03.02.00
date:
22.10.2003
dll-name:
psqlodbc30w.dll
MS Windows ODBC-Driver Manager
Create unicode-encoded database with "createdb -E UNICODE unicode" -> ok
Create "text"-encoded table with "CREATE TABLE unicode(name TEXT)" -> ok
Insert of string-data: "INSERT INTO unicode(name) VALUES ('Michael')" ->
ok
Select in the cygwin-shell with "SELECT name FROM unicode" -> ok, returns
one row with "Michael"
Logfiles:
When I run the ODBC-Application shown below, the number of bytes returned
in the indicator buffer "nIndOut" by the driver is ok (14), but the
string-termination indicator at position pOutput[8] is set to 0xcd00
instead of 0x0000 (i.e., only first byte is set to 0).
Is this a bug in the driver (as the error doesn't occur with other
ODBC-drivers), or am I doing something wrong? I appriceate your comments
on this problem, as I would like to make our application ready for use
with PostgreSQL via ODBC.
Thanks for your help,
Michael Ziehensack
----------------------------------------------------------
BEGIN OF APPLICATION CODE
----------------------------------------------------------
#include <windows.h>
#include <sqlext.h>
#include <sql.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
SQLRETURN rc = SQL_SUCCESS;
//! allocate environment handle
SQLHENV henv = 0;
rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
//! Set the ODBC version environment attribute */
rc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
//! allocate connection handle
SQLHDBC hdbc = 0;
rc = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
//! ... and set autocommit off
rc = SQLSetConnectAttr(hdbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF,
0);
//! Connect to data source */
rc = SQLConnectW(hdbc, (SQLWCHAR*) L"unicode", SQL_NTS,
(SQLWCHAR*) L"ADONIS", SQL_NTS,
(SQLWCHAR*) L"BPMS", SQL_NTS);
//! Allocate statement handle
SQLHSTMT hstmt;
rc = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
SQLWCHAR * pOutput = new SQLWCHAR[100];
SQLINTEGER nIndOut;
SQLINTEGER nCount;
rc = SQLPrepareW (hstmt, (SQLWCHAR*)L"SELECT name FROM unicode",
SQL_NTS);
rc = SQLBindCol ( hstmt,
1,
SQL_C_WCHAR,
pOutput,
100,
&nIndOut);
rc = SQLExecute (hstmt);
rc = SQLFetch(hstmt);
/* Error with PostgreSQL-ODBC: driver sets string termination at
relevant position as 0xcd00 (i.e., only the first byte of the
character is set) instead of 0x0000 !!!
*/
nCount = wcslen(pOutput); -> wrong, due to wrong string termination
rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_ROLLBACK );
//! Free statment handle
rc = SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
//! disconnect
rc = SQLDisconnect(hdbc);
//! Free connection handle
rc = SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
//! Free environment handle
rc = SQLFreeHandle(SQL_HANDLE_ENV, henv);
return rc;
}
Attachments:
mylog_3092.log (application/octet-stream, 16.0K) download
psqlodbc_3092.log (application/octet-stream, 1.2K) download
^ permalink raw reply [nested|flat] 3+ messages in thread
* psqlodbc30w.dll: wrong string termination after SQLFetch for SQL_C_WCHAR buffer bound via SQLBindCol
@ 2003-12-16 09:42 zisi1@gmx.net
0 siblings, 1 reply; 3+ messages in thread
From: zisi1@gmx.net @ 2003-12-16 09:42 UTC (permalink / raw)
To: pgsql-odbc
Hi,
I have the problem described below in an ODBC application which occurs only
with PostgreSQL and PostgreSQL-ODBC drivers:
When I fetch string data via ODBC of a column with the "text" datatype (but
also when the datatype is "varchar") of a unicode encoded database into a
SQLWCHAR-buffer, the string termination in the out-buffer is set wrong, as only
the first byte of the string-termination is set to 0 (i.e., SQLWCHAR
character at relevant position is 0xcdcd before fetch, and set to 0xcd00 after fetch
instead of 0x000). The problem doesn't occur with other drivers (e.g.,
SQL-Server or SAP-DB/MaxDB).
Details:
--------
- PostgreSQL Server version: 7.3.2-1 running on Windows 2000 under
cygwin-environment
- PostgreSQL-ODBC driver: version: 7-03.02.00
date: 22.10.2003
dll-name: psqlodbc30w.dll
- MS Windows ODBC-Driver Manager
- Create unicode-encoded database with "createdb -E UNICODE unicode" -> ok
- Create "text"-encoded table with "CREATE TABLE unicode(name TEXT)" -> ok
- Insert of string-data: "INSERT INTO unicode(name) VALUES ('Michael')" ->
ok
- Select in the cygwin-shell with "SELECT name FROM unicode" -> ok, returns
one row with "Michael"
- Logfiles attached: psqlodbc_3092.log, mylog_3092.log
When I run the ODBC-Application shown below, the number of bytes returned in
the indicator buffer "nIndOut" by the driver is ok (14), but the
string-termination indicator at position pOutput[8] is set to 0xcd00 instead of 0x0000
(i.e., only first byte is set to 0).
Is this a bug in the driver (as the error doesn't occur with other
ODBC-drivers), or am I doing something wrong? I appriceate your comments on this
problem, as I would like to make our application ready for use with PostgreSQL via
ODBC.
Thanks for your help,
Michael Ziehensack
----------------------------------------------------------
BEGIN OF APPLICATION CODE
----------------------------------------------------------
#include <windows.h>
#include <sqlext.h>
#include <sql.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
SQLRETURN rc = SQL_SUCCESS;
//! allocate environment handle
SQLHENV henv = 0;
rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
//! Set the ODBC version environment attribute */
rc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
//! allocate connection handle
SQLHDBC hdbc = 0;
rc = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
//! ... and set autocommit off
rc = SQLSetConnectAttr(hdbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0);
//! Connect to data source */
rc = SQLConnectW(hdbc, (SQLWCHAR*) L"unicode", SQL_NTS,
(SQLWCHAR*) L"ADONIS", SQL_NTS,
(SQLWCHAR*) L"BPMS", SQL_NTS);
//! Allocate statement handle
SQLHSTMT hstmt;
rc = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
SQLWCHAR * pOutput = new SQLWCHAR[100];
SQLINTEGER nIndOut;
SQLINTEGER nCount;
rc = SQLPrepareW (hstmt, (SQLWCHAR*)L"SELECT name FROM unicode", SQL_NTS);
rc = SQLBindCol ( hstmt,
1,
SQL_C_WCHAR,
pOutput,
100,
&nIndOut);
rc = SQLExecute (hstmt);
rc = SQLFetch(hstmt);
/* Error with PostgreSQL-ODBC: driver sets string termination at
relevant position as 0xcd00 (i.e., only the first byte of the
character is set) instead of 0x0000 !!!
*/
nCount = wcslen(pOutput); -> wrong, due to wrong string termination
rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_ROLLBACK );
//! Free statment handle
rc = SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
//! disconnect
rc = SQLDisconnect(hdbc);
//! Free connection handle
rc = SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
//! Free environment handle
rc = SQLFreeHandle(SQL_HANDLE_ENV, henv);
delete [] pOutput;
return rc;
}
--
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net
Attachments:
psqlodbc_3092.log (text/plain, 1.2K) download
conn = 10371264, PGAPI_Connect(DSN='unicode_postgres', UID='ADONIS', PWD='xxxxx')
Global Options: Version='07.03.0200', fetch=100, socket=4096, unknown_sizes=0, max_varchar_size=254, max_longvarchar_size=8190
disable_optimizer=1, ksqo=1, unique_index=1, use_declarefetch=0
text_as_longvarchar=1, unknowns_as_longvarchar=0, bools_as_char=1 NAMEDATALEN=64
extra_systable_prefixes='dd_;', conn_settings='' conn_encoding='OTHER'
conn=10371264, query=' '
conn=10371264, query='BEGIN'
conn=10371264, query='select version()'
[ fetched 1 rows ]
[ PostgreSQL version string = 'PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)' ]
[ PostgreSQL version number = '7.3' ]
conn=10371264, query='set DateStyle to 'ISO''
conn=10371264, query='set geqo to 'OFF''
conn=10371264, query='select oid from pg_type where typname='lo''
[ fetched 0 rows ]
conn=10371264, query='select pg_client_encoding()'
[ fetched 1 rows ]
[ Client encoding = 'UNICODE' (code = 6) ]
conn=10371264, query='SELECT name FROM unicode'
[ fetched 1 rows ]
conn=10371264, query='ROLLBACK'
conn=10371264, PGAPI_Disconnect
mylog_3092.log (text/plain, 16.0K) download
[1500]CC_connect: entering...
[1500]CC_connect(): DSN = 'unicode_postgres', server = 'w2k112', port = '5432', database = 'unicode', username = 'ADONIS', password='xxxxx'
[1500]connecting to the server socket...
[1500]connection to the server socket succeeded.
[1500]sizeof startup packet = 292
[1500]sent the authentication block.
[1500]sent the authentication block successfully.
[1500]gonna do authentication
[1500]read 15, global_socket_buffersize=4096
[1500]auth got 'R'
[1500]areq = 0
[1500]auth got 'K'
[1500]auth got 'Z'
[1500]sending an empty query...
[1500]send_query(): conn=10371264, query=' '
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 3, global_socket_buffersize=4096
[1500]send_query: got id = 'I'
[1500]send_query: got id = 'Z'
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=0
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500]empty query seems to be OK.
[1500]CC_lookup_pg_version: entering...
[1500]PGAPI_AllocStmt: entering...
[1500]**** PGAPI_AllocStmt: hdbc = 10371264, stmt = 10390632
[1500]CC_add_statement: self=10371264, stmt=10390632
[1500]PGAPI_ExecDirect: entering...
[1500]**** PGAPI_ExecDirect: hstmt=10390632, statement='select version()'
[1500]PGAPI_ExecDirect: calling PGAPI_Execute...
[1500]PGAPI_Execute: entering...
[1500]PGAPI_Execute: clear errors...
[1500]recycle statement: self= 10390632
[1500]Exec_with_parameters_resolved: copying statement params: trans_status=0, len=16, stmt='select version()'
[1500] stmt_with_params = 'select version()'
[1500] about to begin a transaction on statement = 10390632
[1500]send_query(): conn=10371264, query='BEGIN'
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 8, global_socket_buffersize=4096
[1500]send_query: got id = 'C'
[1500]send_query: ok - 'C' - BEGIN
[1500]send_query: setting cmdbuffer = 'BEGIN'
[1500]send_query: returning res = 10395288
[1500]send_query: got id = 'Z'
[1500]CC_begin: sending BEGIN!
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=0
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500] Sending SELECT statement on stmt=10390632, cursor_name='SQL_CUR009E8C68'
[1500]send_query(): conn=10371264, query='select version()'
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 130, global_socket_buffersize=4096
[1500]send_query: got id = 'P'
[1500]send_query: got id = 'T'
[1500]QR_fetch_tuples: cursor = '', self->cursor=0
[1500]num_fields = 1
[1500]READING ATTTYPMOD
[1500]CI_read_fields: fieldname='version', adtid=25, adtsize=-1, atttypmod=-1
[1500]QR_fetch_tuples: past CI_read_fields: num_fields = 1
[1500]MALLOC: tuple_size = 100, size = 800
[1500]next_tuple: inTuples = true, falling through: fcount = 101, fetch_count = 101
[1500]qresult: len=87, buffer='PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)'
[1500]end of tuple list -- setting inUse to false: this = 10395288
[1500]_next_tuple: 'C' fetch_total = 1 & this_fetch = 1
[1500]send_query: got id = 'Z'
[1500] done sending the query:
[1500]extend_column_bindings: entering ... self=10390720, bindings_allocated=0, num_columns=1
[1500]exit extend_column_bindings
[1500]PGAPI_ExecDirect: returned 0 from PGAPI_Execute
[1500]PGAPI_Fetch: stmt = 10390632, stmt->result= 10395288
[1500]manual_result = 0, use_declarefetch = 0
[1500]**** SC_fetch: manual_result
[1500]fetch: cols=1, lf=0, opts = 10390720, opts->bindings = 10396704, buffer[] = 0
[1500]PGAPI_GetData: enter, stmt=10390632
[1500] num_rows = 1
[1500] value = 'PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)'
[1500]**** PGAPI_GetData: icol = 0, fCType = 1, field_type = 25, value = 'PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)'
[1500]copy_and_convert: field_type = 25, fctype = 1, value = 'PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)', cbValueMax=128
[1500]DEFAULT: len = 87, ptr = 'PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)º
ðº
𺫫««««««'
[1500] SQL_C_CHAR, default: len = 87, cbValueMax = 128, rgbValueBindRow = 'PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)'
[1500]Got the PostgreSQL version string: 'PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 3.2 20020927 (prerelease)'
[1500]Extracted PostgreSQL version number: '7.3'
[1500]PGAPI_FreeStmt: entering...hstmt=10390632, fOption=1
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=1
[1500]row = 0, num_fields = 1
[1500]free [lf=0] 10396544
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500]SC_Destructor: self=10390632, self->result=0, self->hdbc=10371264
[1500]reset_a_column_binding: entering ... self=10390720, bindings_allocated=1, icol=1
[1500]APD_free_params: ENTER, self=10390776
[1500]IPD_free_params: ENTER, self=10390804
[1500]IPD_free_params: EXIT
[1500]SC_Destructor: EXIT
[1500]CC_send_settings: entering...
[1500]PGAPI_AllocStmt: entering...
[1500]**** PGAPI_AllocStmt: hdbc = 10371264, stmt = 10397000
[1500]CC_add_statement: self=10371264, stmt=10397000
[1500]PGAPI_ExecDirect: entering...
[1500]**** PGAPI_ExecDirect: hstmt=10397000, statement='set DateStyle to 'ISO''
[1500]PGAPI_ExecDirect: calling PGAPI_Execute...
[1500]PGAPI_Execute: entering...
[1500]PGAPI_Execute: clear errors...
[1500]recycle statement: self= 10397000
[1500]Exec_with_parameters_resolved: copying statement params: trans_status=2, len=22, stmt='set DateStyle to 'ISO''
[1500] stmt_with_params = 'set DateStyle to 'ISO''
[1500] it's NOT a select statement: stmt=10397000
[1500]send_query(): conn=10371264, query='set DateStyle to 'ISO''
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 6, global_socket_buffersize=4096
[1500]send_query: got id = 'C'
[1500]send_query: ok - 'C' - SET
[1500]send_query: setting cmdbuffer = 'SET'
[1500]send_query: returning res = 10394752
[1500]send_query: got id = 'Z'
[1500]PGAPI_ExecDirect: returned 0 from PGAPI_Execute
[1500]CC_send_settings: result 0, status 1 from set DateStyle
[1500]PGAPI_ExecDirect: entering...
[1500]**** PGAPI_ExecDirect: hstmt=10397000, statement='set geqo to 'OFF''
[1500]PGAPI_ExecDirect: calling PGAPI_Execute...
[1500]PGAPI_Execute: entering...
[1500]PGAPI_Execute: clear errors...
[1500]PGAPI_Execute: recycling statement (should have been done by app)...
[1500]recycle statement: self= 10397000
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=0
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500]APD_free_params: ENTER, self=10397144
[1500]IPD_free_params: ENTER, self=10397172
[1500]IPD_free_params: EXIT
[1500]Exec_with_parameters_resolved: copying statement params: trans_status=2, len=17, stmt='set geqo to 'OFF''
[1500] stmt_with_params = 'set geqo to 'OFF''
[1500] it's NOT a select statement: stmt=10397000
[1500]send_query(): conn=10371264, query='set geqo to 'OFF''
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 6, global_socket_buffersize=4096
[1500]send_query: got id = 'C'
[1500]send_query: ok - 'C' - SET
[1500]send_query: setting cmdbuffer = 'SET'
[1500]send_query: returning res = 10394752
[1500]send_query: got id = 'Z'
[1500]PGAPI_ExecDirect: returned 0 from PGAPI_Execute
[1500]CC_send_settings: result 0, status 1 from set geqo
[1500]PGAPI_FreeStmt: entering...hstmt=10397000, fOption=1
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=0
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500]SC_Destructor: self=10397000, self->result=0, self->hdbc=10371264
[1500]APD_free_params: ENTER, self=10397144
[1500]IPD_free_params: ENTER, self=10397172
[1500]IPD_free_params: EXIT
[1500]SC_Destructor: EXIT
[1500]CC_lookup_lo: entering...
[1500]PGAPI_AllocStmt: entering...
[1500]**** PGAPI_AllocStmt: hdbc = 10371264, stmt = 10397000
[1500]CC_add_statement: self=10371264, stmt=10397000
[1500]PGAPI_ExecDirect: entering...
[1500]**** PGAPI_ExecDirect: hstmt=10397000, statement='select oid from pg_type where typname='lo''
[1500]PGAPI_ExecDirect: calling PGAPI_Execute...
[1500]PGAPI_Execute: entering...
[1500]PGAPI_Execute: clear errors...
[1500]recycle statement: self= 10397000
[1500]Exec_with_parameters_resolved: copying statement params: trans_status=2, len=42, stmt='select oid from pg_type where typname='lo''
[1500] stmt_with_params = 'select oid from pg_type where typname='lo''
[1500] Sending SELECT statement on stmt=10397000, cursor_name='SQL_CUR009EA548'
[1500]send_query(): conn=10371264, query='select oid from pg_type where typname='lo''
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 33, global_socket_buffersize=4096
[1500]send_query: got id = 'P'
[1500]send_query: got id = 'T'
[1500]QR_fetch_tuples: cursor = '', self->cursor=0
[1500]num_fields = 1
[1500]READING ATTTYPMOD
[1500]CI_read_fields: fieldname='oid', adtid=26, adtsize=4, atttypmod=-1
[1500]QR_fetch_tuples: past CI_read_fields: num_fields = 1
[1500]MALLOC: tuple_size = 100, size = 800
[1500]next_tuple: inTuples = true, falling through: fcount = 101, fetch_count = 101
[1500]end of tuple list -- setting inUse to false: this = 10394752
[1500]_next_tuple: 'C' fetch_total = 0 & this_fetch = 0
[1500]_next_tuple: 'C': DONE (fcount == 0)
[1500]send_query: got id = 'Z'
[1500] done sending the query:
[1500]extend_column_bindings: entering ... self=10397088, bindings_allocated=0, num_columns=1
[1500]exit extend_column_bindings
[1500]PGAPI_ExecDirect: returned 0 from PGAPI_Execute
[1500]PGAPI_Fetch: stmt = 10397000, stmt->result= 10394752
[1500]manual_result = 0, use_declarefetch = 0
[1500]PGAPI_FreeStmt: entering...hstmt=10397000, fOption=1
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=0
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500]SC_Destructor: self=10397000, self->result=0, self->hdbc=10371264
[1500]reset_a_column_binding: entering ... self=10397088, bindings_allocated=1, icol=1
[1500]APD_free_params: ENTER, self=10397144
[1500]IPD_free_params: ENTER, self=10397172
[1500]IPD_free_params: EXIT
[1500]SC_Destructor: EXIT
[1500]CC_lookup_characterset: entering...
[1500]send_query(): conn=10371264, query='select pg_client_encoding()'
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 61, global_socket_buffersize=4096
[1500]send_query: got id = 'P'
[1500]send_query: got id = 'T'
[1500]QR_fetch_tuples: cursor = '', self->cursor=0
[1500]num_fields = 1
[1500]READING ATTTYPMOD
[1500]CI_read_fields: fieldname='pg_client_encoding', adtid=19, adtsize=64, atttypmod=-1
[1500]QR_fetch_tuples: past CI_read_fields: num_fields = 1
[1500]MALLOC: tuple_size = 100, size = 800
[1500]next_tuple: inTuples = true, falling through: fcount = 101, fetch_count = 101
[1500]qresult: len=7, buffer='UNICODE'
[1500]end of tuple list -- setting inUse to false: this = 10397000
[1500]_next_tuple: 'C' fetch_total = 1 & this_fetch = 1
[1500]send_query: got id = 'Z'
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=1
[1500]row = 0, num_fields = 1
[1500]free [lf=0] 10398272
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500]CC_connect: returning...
[1500]PGAPI_Connect: returning...
[1500][SQLGetDiagRecW][1500]PGAPI_GetDiagRec entering rec=1[1500]**** PGAPI_ConnectError: hdbc=10371264 <0>
[1500]enter CC_get_error
[1500]enter CC_create_errormsg
[1500]msg = ''
[1500]exit CC_create_errormsg
[1500]exit CC_get_error
[1500]CC_Get_error returned nothing.
[1500]PGAPI_GetDiagRec exiting 100
[1500][SQLGetFunctions][1500][SQLGetInfoW(30)][1500]PGAPI_GetInfo: entering...fInfoType=23
[1500]PGAPI_GetInfo: p='<NULL>', len=2, value=2, cbMax=2
[1500][SQLGetInfoW(30)][1500]PGAPI_GetInfo: entering...fInfoType=24
[1500]PGAPI_GetInfo: p='<NULL>', len=2, value=2, cbMax=2
[1500][[SQLAllocHandle]][1500]PGAPI_AllocStmt: entering...
[1500]**** PGAPI_AllocStmt: hdbc = 10371264, stmt = 10397000
[1500]CC_add_statement: self=10371264, stmt=10397000
[1500][SQLGetStmtAttrW][1500]PGAPI_GetStmtAttr Handle=10397000 10010
[1500][SQLGetStmtAttrW][1500]PGAPI_GetStmtAttr Handle=10397000 10011
[1500][SQLGetStmtAttrW][1500]PGAPI_GetStmtAttr Handle=10397000 10012
[1500][SQLGetStmtAttrW][1500]PGAPI_GetStmtAttr Handle=10397000 10013
[1500][SQLPrepareW][1500]PGAPI_Prepare: entering... len=24
[1500]**** PGAPI_Prepare: STMT_ALLOCATED, copy
[1500][SQLBindCol][1500]PGAPI_BindCol: entering...
[1500]**** PGAPI_BindCol: stmt = 10397000, icol = 1
[1500]**** : fCType=-8 rgb=8d1000 valusMax=100 pcb=12f760
[1500]extend_column_bindings: entering ... self=10397088, bindings_allocated=0, num_columns=1
[1500]exit extend_column_bindings
[1500] bound buffer[0] = 9244672
[1500][SQLExecute][1500]PGAPI_Execute: entering...
[1500]PGAPI_Execute: clear errors...
[1500]recycle statement: self= 10397000
[1500]APD_free_params: ENTER, self=10397144
[1500]IPD_free_params: ENTER, self=10397172
[1500]IPD_free_params: EXIT
[1500]Exec_with_parameters_resolved: copying statement params: trans_status=2, len=24, stmt='SELECT name FROM unicode'
[1500] stmt_with_params = 'SELECT name FROM unicode'
[1500] Sending SELECT statement on stmt=10397000, cursor_name='SQL_CUR009EA548'
[1500]send_query(): conn=10371264, query='SELECT name FROM unicode'
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 45, global_socket_buffersize=4096
[1500]send_query: got id = 'P'
[1500]send_query: got id = 'T'
[1500]QR_fetch_tuples: cursor = '', self->cursor=0
[1500]num_fields = 1
[1500]READING ATTTYPMOD
[1500]CI_read_fields: fieldname='name', adtid=25, adtsize=-1, atttypmod=-1
[1500]QR_fetch_tuples: past CI_read_fields: num_fields = 1
[1500]MALLOC: tuple_size = 100, size = 800
[1500]next_tuple: inTuples = true, falling through: fcount = 101, fetch_count = 101
[1500]qresult: len=5, buffer='Michi'
[1500]end of tuple list -- setting inUse to false: this = 10397464
[1500]_next_tuple: 'C' fetch_total = 1 & this_fetch = 1
[1500]send_query: got id = 'Z'
[1500] done sending the query:
[1500]extend_column_bindings: entering ... self=10397088, bindings_allocated=1, num_columns=1
[1500]exit extend_column_bindings
[1500][[SQLFetch]][1500]PGAPI_ExtendedFetch: stmt=10397000
[1500]SQL_FETCH_NEXT: num_tuples=1, currtuple=-1
[1500]PGAPI_ExtendedFetch: new currTuple = -1
[1500]manual_result = 0, use_declarefetch = 0
[1500]**** SC_fetch: manual_result
[1500]fetch: cols=1, lf=0, opts = 10397088, opts->bindings = 10365072, buffer[] = 9244672
[1500]type = 25
[1500]value = 'Michi'
[1500]copy_and_convert: field_type = 25, fctype = -8, value = 'Michi', cbValueMax=100
[1500]DEFAULT: len = 10, ptr = 'M'
[1500] SQL_C_CHAR, default: len = 10, cbValueMax = 100, rgbValueBindRow = 'M'
[1500]copy_and_convert: retval = 0
[1500][[SQLEndTran]][1500]entering PGAPI_Transact: hdbc=10371264, henv=0
[1500]PGAPI_Transact: sending on conn 10371264 'ROLLBACK'
[1500]send_query(): conn=10371264, query='ROLLBACK'
[1500]send_query: done sending query
[1500]in QR_Constructor
[1500]exit QR_Constructor
[1500]read 11, global_socket_buffersize=4096
[1500]send_query: got id = 'C'
[1500]send_query: ok - 'C' - ROLLBACK
[1500]send_query: setting cmdbuffer = 'ROLLBACK'
[1500]send_query: returning res = 10397936
[1500]send_query: got id = 'Z'
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=0
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500][[SQLFreeHandle]][1500]PGAPI_FreeStmt: entering...hstmt=10397000, fOption=1
[1500]QResult: in DESTRUCTOR
[1500]QResult: free memory in, fcount=1
[1500]row = 0, num_fields = 1
[1500]free [lf=0] 10397856
[1500]QResult: free memory out
[1500]QResult: exit DESTRUCTOR
[1500]SC_Destructor: self=10397000, self->result=0, self->hdbc=10371264
[1500]reset_a_column_binding: entering ... self=10397088, bindings_allocated=1, icol=1
[1500]APD_free_params: ENTER, self=10397144
[1500]IPD_free_params: ENTER, self=10397172
[1500]IPD_free_params: EXIT
[1500]SC_Destructor: EXIT
[1500][SQLDisconnect][1500]PGAPI_Disconnect: entering...
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: psqlodbc30w.dll: wrong string termination after SQLFetch for
@ 2003-12-23 05:20 Hiroshi Inoue <Inoue@tpf.co.jp>
parent: zisi1@gmx.net
0 siblings, 0 replies; 3+ messages in thread
From: Hiroshi Inoue @ 2003-12-23 05:20 UTC (permalink / raw)
To: zisi1@gmx.net; +Cc: pgsql-odbc
zisi1@gmx.net wrote:
>
> Hi,
>
> I have the problem described below in an ODBC application which
> occurs only with PostgreSQL and PostgreSQL-ODBC drivers:
>
> When I fetch string data via ODBC of a column with the "text"
> datatype (but also when the datatype is "varchar") of a unicode
> encoded database into a SQLWCHAR-buffer, the string termination
> in the out-buffer is set wrong, as only the first byte of the
> string-termination is set to 0 (i.e., SQLWCHAR character at
> relevant position is 0xcdcd before fetch, and set to 0xcd00 after
> fetch instead of 0x000).
Could you try the dll at
http://www.geocities.jp/inocchichichi/psqlodbc/ ?
regards,
Hiroshi Inoue
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-12-23 05:20 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-16 09:21 psqlodbc30w.dll: wrong string termination after SQLFetch for SQL_C_WCHAR buffer bound via SQLBindCol Michael Ziehensack <Michael.Ziehensack@boc-eu.com>
2003-12-16 09:42 psqlodbc30w.dll: wrong string termination after SQLFetch for SQL_C_WCHAR buffer bound via SQLBindCol zisi1@gmx.net
2003-12-23 05:20 ` Re: psqlodbc30w.dll: wrong string termination after SQLFetch for Hiroshi Inoue <Inoue@tpf.co.jp>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox