Hi All, Adrian Studer found a bug in version 3.7.18 on AIX/PostgreSQL (bytea/text field fetching: long<->int related problem). It's possible that the bug can occur on any 64-bit platform. I attached the diff for pgClient.cpp file that should fix the bug. -- Best regards, Sergey Chumakov, SQLAPI++ development team
Index: pgClient.cpp =================================================================== RCS file: /home/yas/cvs/SQLPro/SQLAPI/pgClient.cpp,v retrieving revision 1.21 diff -u -w -b -r1.21 pgClient.cpp --- pgClient.cpp 10 Jul 2006 10:24:21 -0000 1.21 +++ pgClient.cpp 2 Nov 2006 14:09:08 -0000 @@ -1569,19 +1569,19 @@ break; case SA_dtLongBinary: Field.m_eDataType = SA_dtLongBinary; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtLongChar: Field.m_eDataType = SA_dtLongChar; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtBLob: Field.m_eDataType = SA_dtBLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; case SA_dtCLob: Field.m_eDataType = SA_dtCLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; default: assert(false); // unknown type @@ -1943,7 +1943,7 @@ void *pAddlData) { pgConnectionHandles *pConH = (pgConnectionHandles *)m_pCommand->Connection()->NativeHandles(); - Oid blobOid = *((long*)vr.m_pScalar); + Oid blobOid = *((Oid*)vr.m_pScalar); SAConnection *pSAConnection = m_pCommand->Connection(); // Start transaction if not started
Index: pgClient.cpp =================================================================== RCS file: /home/yas/cvs/SQLPro/SQLAPI/pgClient.cpp,v retrieving revision 1.21 diff -u -w -b -r1.21 pgClient.cpp --- pgClient.cpp 10 Jul 2006 10:24:21 -0000 1.21 +++ pgClient.cpp 2 Nov 2006 14:09:08 -0000 @@ -1569,19 +1569,19 @@ break; case SA_dtLongBinary: Field.m_eDataType = SA_dtLongBinary; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtLongChar: Field.m_eDataType = SA_dtLongChar; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtBLob: Field.m_eDataType = SA_dtBLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; case SA_dtCLob: Field.m_eDataType = SA_dtCLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; default: assert(false); // unknown type @@ -1943,7 +1943,7 @@ void *pAddlData) { pgConnectionHandles *pConH = (pgConnectionHandles *)m_pCommand->Connection()->NativeHandles(); - Oid blobOid = *((long*)vr.m_pScalar); + Oid blobOid = *((Oid*)vr.m_pScalar); SAConnection *pSAConnection = m_pCommand->Connection(); // Start transaction if not started
Index: pgClient.cpp =================================================================== RCS file: /home/yas/cvs/SQLPro/SQLAPI/pgClient.cpp,v retrieving revision 1.21 diff -u -w -b -r1.21 pgClient.cpp --- pgClient.cpp 10 Jul 2006 10:24:21 -0000 1.21 +++ pgClient.cpp 2 Nov 2006 14:09:08 -0000 @@ -1569,19 +1569,19 @@ break; case SA_dtLongBinary: Field.m_eDataType = SA_dtLongBinary; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtLongChar: Field.m_eDataType = SA_dtLongChar; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtBLob: Field.m_eDataType = SA_dtBLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; case SA_dtCLob: Field.m_eDataType = SA_dtCLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; default: assert(false); // unknown type @@ -1943,7 +1943,7 @@ void *pAddlData) { pgConnectionHandles *pConH = (pgConnectionHandles *)m_pCommand->Connection()->NativeHandles(); - Oid blobOid = *((long*)vr.m_pScalar); + Oid blobOid = *((Oid*)vr.m_pScalar); SAConnection *pSAConnection = m_pCommand->Connection(); // Start transaction if not started
Index: pgClient.cpp =================================================================== RCS file: /home/yas/cvs/SQLPro/SQLAPI/pgClient.cpp,v retrieving revision 1.21 diff -u -w -b -r1.21 pgClient.cpp --- pgClient.cpp 10 Jul 2006 10:24:21 -0000 1.21 +++ pgClient.cpp 2 Nov 2006 14:09:08 -0000 @@ -1569,19 +1569,19 @@ break; case SA_dtLongBinary: Field.m_eDataType = SA_dtLongBinary; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtLongChar: Field.m_eDataType = SA_dtLongChar; - *(long*)Field.m_pScalar = nTuple; // Pass tuple id + *(int*)Field.m_pScalar = nTuple; // Pass tuple id break; case SA_dtBLob: Field.m_eDataType = SA_dtBLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; case SA_dtCLob: Field.m_eDataType = SA_dtCLob; - *(long*)Field.m_pScalar = atol(sValue); // Pass Oid of the large object (should be LOB!!!) as long + *(Oid*)Field.m_pScalar = strtoul(sValue, NULL, 10); // Pass Oid of the large object (should be LOB!!!) as long break; default: assert(false); // unknown type @@ -1943,7 +1943,7 @@ void *pAddlData) { pgConnectionHandles *pConH = (pgConnectionHandles *)m_pCommand->Connection()->NativeHandles(); - Oid blobOid = *((long*)vr.m_pScalar); + Oid blobOid = *((Oid*)vr.m_pScalar); SAConnection *pSAConnection = m_pCommand->Connection(); // Start transaction if not started