Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fHCmV-0005M2-Ta for pgsql-odbc@arkaria.postgresql.org; Fri, 11 May 2018 18:28:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fHCmU-0003yU-I4 for pgsql-odbc@arkaria.postgresql.org; Fri, 11 May 2018 18:28:38 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fH4QV-0004rU-Kg for pgsql-odbc@lists.postgresql.org; Fri, 11 May 2018 09:33:23 +0000 Received: from mail1.digital-dispatch.com ([207.102.78.7] helo=caex2010.digital-dispatch.com) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fH4QR-0001tk-ON for pgsql-odbc@postgresql.org; Fri, 11 May 2018 09:33:22 +0000 Received: from CAEX2010.digital-dispatch.com ([fe80::6c22:f9fb:1084:15e9]) by CAEX2010.digital-dispatch.com ([fe80::6c22:f9fb:1084:15e9%10]) with mapi id 14.03.0181.006; Fri, 11 May 2018 02:33:21 -0700 From: Jari Siikarla To: "pgsql-odbc@postgresql.org" CC: Jari Siikarla Subject: Bug report: x64 Row status Array uses wrong data type Thread-Topic: Bug report: x64 Row status Array uses wrong data type Thread-Index: AdPpBPbuz8XFgQuYSx+nlv6BHKNQBA== Date: Fri, 11 May 2018 09:33:20 +0000 Message-ID: <08FA934FA252D048A8B6D2018D96549A262C8FE7@CAEX2010.digital-dispatch.com> Accept-Language: fi-FI, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [88.114.240.130] Content-Type: multipart/alternative; boundary="_000_08FA934FA252D048A8B6D2018D96549A262C8FE7CAEX2010digital_" MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_08FA934FA252D048A8B6D2018D96549A262C8FE7CAEX2010digital_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Thank you for psq odbc driver! I've found an issue with 64 bit driver. The array returned from fetch for row statuses uses 16 bit values instead of 64 bit values. Tested on x64 Windows (7, 10, srv2012 and srv2016) with 64 bit psqlodbc-09.06.0500 (Unicode and ANSI) Client is set ODBC version 2 Changing SQLUSMALLINT to SQLSETPOSIROW in descriptor.h for two structs and in the code handling these structs fixed the issue. Code in psqlodbc-10.02.0000 is the same for these parts. struct IRDFields_ { StatementClass *stmt; SQLULEN *row= sFetched; -> SQLSETPOSIROW *rowStatusArr= ay; UInt4 = nfields; SQLSMALLINT allocated; FIELD_INFO **fi; }; struct IPDFields_ { SQLULEN = *param_processed_ptr; -> SQLSETPOSIROW = *param_status_ptr; SQLSMALLINT allocate= d; ParameterImplClass *parameters; }; Below pseudo code reproduces the issue: SQLUINTEGER rowsFetched=3D0; SQLSETPOSIROW pRowStatus[1]; SQLRETURN retCode; pRowStatus[0]=3D-1; // 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF retCode=3DSQLSetStmtAttr(hStmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)1, 0); retCode=3DSQLSetStmtAttr(hStmt, SQL_ATTR_ROWS_FETCHED_PTR, &rowsFetched, 0)= ; retCode=3DSQLSetStmtAttr(hStmt, SQL_ATTR_ROW_STATUS_PTR, pRowStatus, 0); retCode=3DSQLFetchScroll(hStmt, SQL_FETCH_NEXT, 1); // pRowStatus // after fetch 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00 // exected to be 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 Thank you, Jari Siikarla --_000_08FA934FA252D048A8B6D2018D96549A262C8FE7CAEX2010digital_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi

 

Thank you for psq odbc driver!<= o:p>

 

I’ve found an issue with = 64 bit driver.

The array returned from fetch f= or row statuses uses 16 bit values

instead of 64 bit values.<= /o:p>

 

Tested on x64 Windows (7, 10, s= rv2012 and srv2016)

with 64 bit psqlodbc-09.06.0500= (Unicode and ANSI)

Client is set ODBC version 2

 

 

 

Changing SQLUSMALLINT to SQLSET= POSIROW in descriptor.h

for two structs and in the code= handling these structs fixed the issue.

Code in psqlodbc-10.02.0000 is = the same for these parts.

 

 

 

struct IRDFields_

{

     &= nbsp;           &nbs= p;         StatementClass &nbs= p;            &= nbsp;           *stmt;

     &= nbsp;           &nbs= p;         SQLULEN   = ;            &n= bsp;            = ;         *rowsFetched;<= /span>

->    &n= bsp;            = ;       SQLSETPOSIROW    =             &nb= sp;      *rowStatusArray;

     &= nbsp;           &nbs= p;         UInt4   &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   nfields;

     &= nbsp;           &nbs= p;         SQLSMALLINT  alloca= ted;

     &= nbsp;           &nbs= p;         FIELD_INFO  &n= bsp;   **fi;

};

 

struct IPDFields_

{

     &= nbsp;           &nbs= p;         SQLULEN   = ;            &n= bsp;            = ;            &n= bsp;            = ;            *param_= processed_ptr;

->    &n= bsp;            = ;       SQLSETPOSIROW    =             &nb= sp;            =             &nb= sp;        *param_status_ptr;=

     &= nbsp;           &nbs= p;         SQLSMALLINT  &= nbsp;           &nbs= p;            &= nbsp; allocated;

     &= nbsp;           &nbs= p;         ParameterImplClass =             &nb= sp;    *parameters;

};

 

 

 

Below pseudo code reproduces th= e issue:

 

SQLUINTEGER rowsFetched=3D0;

SQLSETPOSIROW pRowStatus[1];

SQLRETURN retCode;

 

pRowStatus[0]=3D-1; // 0xFF, 0x= FF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF

 

retCode=3DSQLSetStmtAttr(hStmt,= SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)1, 0);

retCode=3DSQLSetStmtAttr(hStmt,= SQL_ATTR_ROWS_FETCHED_PTR, &rowsFetched, 0);

retCode=3DSQLSetStmtAttr(hStmt,= SQL_ATTR_ROW_STATUS_PTR, pRowStatus, 0);

retCode=3DSQLFetchScroll(hStmt,= SQL_FETCH_NEXT, 1);

 

// pRowStatus=

// after fetch   0xFF= , 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00

// exected to be 0x00, 0x00, 0x= 00, 0x00, 0x00, 0x00, 0x00, 0x00

 

Thank you,

Jari Siikarla=

--_000_08FA934FA252D048A8B6D2018D96549A262C8FE7CAEX2010digital_--