tags 358949 patch thanks The 64-bit issues in the psqlodbc driver turned out to be quite extensive, but attached is a patch which fixes everything I could find. Most of these were specific to the ODBC headers, but some of them were just silly type size assumptions in the psqlodbc code itself.
This patch implements full 64-bit compatibility with the unreleased UnixODBC 2.2.12; there is one 64-bit ABI change between 2.2.11 and 2.2.12 (SQLParamOptions) that is still pending in Debian. I'll be uploading unixodbc 2.2.11-13 with this change as soon as I finish reviewing its effect on all related packages, but in the meantime psqlodbc will still FTBFS on the 64-bit archs. -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. [EMAIL PROTECTED] http://www.debian.org/
diff -u psqlodbc-08.01.0200/debian/changelog psqlodbc-08.01.0200/debian/changelog --- psqlodbc-08.01.0200/debian/changelog +++ psqlodbc-08.01.0200/debian/changelog @@ -1,3 +1,11 @@ +psqlodbc (1:08.01.0200-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix the build for the true 64-bit ABI exported by UnixODBC on 64-bit + architectures. Closes: #358949. + + -- Steve Langasek <[EMAIL PROTECTED]> Sun, 9 Apr 2006 00:52:58 -0700 + psqlodbc (1:08.01.0200-1) unstable; urgency=low * New upstream release only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/qresult.c 2005-11-04 07:17:49.000000000 -0800 +++ psqlodbc-08.01.0200/qresult.c 2006-04-09 02:08:11.000000000 -0700 @@ -763,7 +763,7 @@ if (field_lf >= effective_cols) { if (field_lf == effective_cols) - sscanf(buffer, "(%lu,%hu)", + sscanf(buffer, "(%u,%hu)", &this_keyset->blocknum, &this_keyset->offset); else this_keyset->oid = strtoul(buffer, NULL, 10); only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/odbcapi30.c +++ psqlodbc-08.01.0200/odbcapi30.c @@ -70,9 +70,9 @@ RETCODE SQL_API SQLBindParam(HSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, - SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision, + SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, PTR ParameterValue, - SQLINTEGER *StrLen_or_Ind) + SQLLEN *StrLen_or_Ind) { RETCODE ret; int BufferLength = 512; /* Is it OK ? */ @@ -162,7 +162,7 @@ /* SQLExtendedFetch -> SQLFetchScroll */ RETCODE SQL_API SQLFetchScroll(HSTMT StatementHandle, - SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset) + SQLSMALLINT FetchOrientation, SQLROWOFFSET FetchOffset) { CSTR func = "SQLFetchScroll"; StatementClass *stmt = (StatementClass *) StatementHandle; @@ -252,7 +252,7 @@ SQLSMALLINT RecNumber, SQLCHAR *Name, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type, SQLSMALLINT *SubType, - SQLINTEGER *Length, SQLSMALLINT *Precision, + SQLLEN *Length, SQLSMALLINT *Precision, SQLSMALLINT *Scale, SQLSMALLINT *Nullable) { mylog("[[SQLGetDescRec]]\n"); @@ -397,10 +397,10 @@ RETCODE SQL_API SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type, - SQLSMALLINT SubType, SQLINTEGER Length, + SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale, - PTR Data, SQLINTEGER *StringLength, - SQLINTEGER *Indicator) + PTR Data, SQLLEN *StringLength, + SQLLEN *Indicator) { mylog("[[SQLSetDescRec]]\n"); mylog("Error not implemented\n"); only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/statement.c +++ psqlodbc-08.01.0200/statement.c @@ -1053,7 +1053,7 @@ SC_set_current_col(self, -1); result = copy_and_convert_field(self, 0, buf, SQL_C_ULONG, bookmark->buffer + offset, 0, - (SDWORD *) (bookmark->used ? bookmark->used + (offset >> 2) : NULL)); + (bookmark->used ? bookmark->used + (offset >> 2) : NULL)); } if (self->options.retrieve_data == SQL_RD_OFF) /* data isn't required */ @@ -1383,7 +1383,7 @@ apdopts->parameters[0].CType, apdopts->parameters[0].buffer, apdopts->parameters[0].buflen, - (SDWORD *) apdopts->parameters[0].used); + apdopts->parameters[0].used); if (ret != SQL_SUCCESS) { SC_set_error(self, STMT_EXEC_ERROR, "GetData to Procedure return failed."); only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/dlg_specific.c +++ psqlodbc-08.01.0200/dlg_specific.c @@ -206,12 +206,12 @@ unfoldCXAttribute(ConnInfo *ci, const char *value) { int count; - UInt4 flag; + unsigned long flag; if (strlen(value) < 2) { count = 3; - sscanf(value, "%lx", (long unsigned int *) &flag); + sscanf(value, "%lx", &flag); } else { @@ -219,7 +219,7 @@ memcpy(cnt, value, 2); cnt[2] = '\0'; sscanf(cnt, "%x", &count); - sscanf(value + 2, "%lx", (long unsigned int *) &flag); + sscanf(value + 2, "%lx", &flag); } ci->disallow_premature = (char)((flag & BIT_DISALLOWPREMATURE) != 0); ci->allow_keyset = (char)((flag & BIT_UPDATABLECURSORS) != 0); only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/convert.c +++ psqlodbc-08.01.0200/convert.c @@ -379,14 +379,14 @@ SC_set_current_col(stmt, -1); return copy_and_convert_field(stmt, field_type, value, (Int2) bic->returntype, (PTR) (bic->buffer + offset), - (SDWORD) bic->buflen, (SDWORD *) (bic->used + (offset >> 2))); + (SDWORD) bic->buflen, (bic->used + (offset >> 2))); } /* This is called by SQLGetData() */ int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, - PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue) + PTR rgbValue, SDWORD cbValueMax, SQLLEN *pcbValue) { CSTR func = "copy_and_convert_field"; ARDFields *opts = SC_get_ARDF(stmt); only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/convert.h +++ psqlodbc-08.01.0200/convert.h @@ -37,7 +37,7 @@ int copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col); int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, - PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue); + PTR rgbValue, SDWORD cbValueMax, SQLLEN *pcbValue); int copy_statement_with_parameters(StatementClass *stmt, BOOL); BOOL convert_money(const char *s, char *sout, size_t soutmax); only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/bind.c +++ psqlodbc-08.01.0200/bind.c @@ -34,11 +34,11 @@ SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, - SQLUINTEGER cbColDef, + SQLULEN cbColDef, SQLSMALLINT ibScale, PTR rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER *pcbValue) + SQLLEN cbValueMax, + SQLLEN *pcbValue) { StatementClass *stmt = (StatementClass *) hstmt; CSTR func = "PGAPI_BindParameter"; @@ -71,7 +71,7 @@ /* store the given info */ apdopts->parameters[ipar].buflen = cbValueMax; apdopts->parameters[ipar].buffer = rgbValue; - apdopts->parameters[ipar].used = (Int4 *) pcbValue; + apdopts->parameters[ipar].used = pcbValue; apdopts->parameters[ipar].CType = fCType; ipdopts->parameters[ipar].SQLType = fSqlType; ipdopts->parameters[ipar].paramType = fParamType; @@ -139,8 +139,8 @@ SQLUSMALLINT icol, SQLSMALLINT fCType, PTR rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER *pcbValue) + SQLLEN cbValueMax, + SQLLEN *pcbValue) { StatementClass *stmt = (StatementClass *) hstmt; CSTR func = "PGAPI_BindCol"; @@ -198,7 +198,7 @@ bookmark = ARD_AllocBookmark(opts); bookmark->buffer = rgbValue; - bookmark->used = (Int4 *) pcbValue; + bookmark->used = pcbValue; bookmark->buflen = cbValueMax; bookmark->returntype = fCType; } @@ -250,7 +250,7 @@ /* ok, bind that column */ opts->bindings[icol].buflen = cbValueMax; opts->bindings[icol].buffer = rgbValue; - opts->bindings[icol].used = (Int4 *) pcbValue; + opts->bindings[icol].used = pcbValue; opts->bindings[icol].returntype = fCType; if (SQL_C_NUMERIC == fCType) @@ -278,7 +278,7 @@ PGAPI_DescribeParam(HSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType, - SQLUINTEGER *pcbColDef, + SQLULEN *pcbColDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable) { @@ -331,8 +331,8 @@ /* Sets multiple values (arrays) for the set of parameter markers. */ RETCODE SQL_API PGAPI_ParamOptions(HSTMT hstmt, - SQLUINTEGER crow, - SQLUINTEGER *pirow) + SQLULEN crow, + SQLULEN *pirow) { CSTR func = "PGAPI_ParamOptions"; StatementClass *stmt = (StatementClass *) hstmt; only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/bind.h +++ psqlodbc-08.01.0200/bind.h @@ -19,7 +19,7 @@ { Int4 buflen; /* size of buffer */ char *buffer; /* pointer to the buffer */ - Int4 *used; /* used space in the buffer (for strings + SQLLEN *used; /* used space in the buffer (for strings * not counting the '\0') */ Int2 returntype; /* kind of conversion to be applied when * returning (SQL_C_DEFAULT, @@ -45,7 +45,7 @@ { Int4 buflen; char *buffer; - Int4 *used; + SQLLEN *used; Int2 CType; Int2 precision; /* the precision for numeric or timestamp type */ Int2 scale; /* the scale for numeric type */ only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/odbcapiw.c +++ psqlodbc-08.01.0200/odbcapiw.c @@ -175,7 +175,7 @@ RETCODE SQL_API SQLDescribeColW(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLWCHAR *ColumnName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, - SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) { RETCODE ret; only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/execute.c +++ psqlodbc-08.01.0200/execute.c @@ -561,7 +561,7 @@ } for (i = 0; i < param_count; i++) { - Int4 *pcVal = apdopts->parameters[i].used; + SQLLEN *pcVal = apdopts->parameters[i].used; apdopts->parameters[i].data_at_exec = FALSE; if (pcVal) only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/info.c +++ psqlodbc-08.01.0200/info.c @@ -2488,7 +2488,7 @@ char isunique[10], isclustered[10], ishash[MAX_INFO_STRING]; - SDWORD index_name_len, + SQLLEN index_name_len, fields_vector_len; TupleNode *row; int i; @@ -2498,7 +2498,7 @@ table_qualifier[MAX_INFO_STRING], relhasrules[10]; char **column_names = NULL; - SQLINTEGER column_name_len; + SQLLEN column_name_len; int total_columns = 0; ConnInfo *ci; char buf[256]; @@ -2950,7 +2950,7 @@ StatementClass *tbl_stmt; char tables_query[INFO_INQUIRY_LEN]; char attname[MAX_INFO_STRING]; - SDWORD attname_len; + SQLLEN attname_len; char *pktab; char pkscm[TABLE_NAME_STORAGE_LEN + 1]; Int2 result_cols; only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/options.c +++ psqlodbc-08.01.0200/options.c @@ -279,13 +279,13 @@ if (stmt) { SC_set_error(stmt, STMT_NOT_IMPLEMENTED_ERROR, "Unknown statement option (Set)"); - sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam); + sprintf(option, "fOption=%d, vParam=%d", fOption, vParam); SC_log_error(func, option, stmt); } if (conn) { CC_set_error(conn, STMT_NOT_IMPLEMENTED_ERROR, "Unknown statement option (Set)"); - sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam); + sprintf(option, "fOption=%d, vParam=%d", fOption, vParam); CC_log_error(func, option, conn); } only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/odbcapi.c +++ psqlodbc-08.01.0200/odbcapi.c @@ -78,8 +78,8 @@ RETCODE SQL_API SQLBindCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, - PTR TargetValue, SQLINTEGER BufferLength, - SQLINTEGER *StrLen_or_Ind) + PTR TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind) { RETCODE ret; StatementClass *stmt = (StatementClass *) StatementHandle; @@ -253,7 +253,7 @@ SQLDescribeCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, - SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) { RETCODE ret; @@ -381,8 +381,8 @@ RETCODE SQL_API SQLGetData(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, - PTR TargetValue, SQLINTEGER BufferLength, - SQLINTEGER *StrLen_or_Ind) + PTR TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind) { RETCODE ret; StatementClass *stmt = (StatementClass *) StatementHandle; @@ -511,7 +511,7 @@ RETCODE SQL_API SQLPutData(HSTMT StatementHandle, - PTR Data, SQLINTEGER StrLen_or_Ind) + PTR Data, SQLLEN StrLen_or_Ind) { RETCODE ret; StatementClass *stmt = (StatementClass *) StatementHandle; @@ -526,7 +526,7 @@ RETCODE SQL_API SQLRowCount(HSTMT StatementHandle, - SQLINTEGER *RowCount) + SQLLEN *RowCount) { RETCODE ret; StatementClass *stmt = (StatementClass *) StatementHandle; @@ -557,9 +557,9 @@ RETCODE SQL_API SQLSetParam(HSTMT StatementHandle, SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType, - SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision, + SQLSMALLINT ParameterType, SQLULEN LengthPrecision, SQLSMALLINT ParameterScale, PTR ParameterValue, - SQLINTEGER *StrLen_or_Ind) + SQLLEN *StrLen_or_Ind) { mylog("[SQLSetParam]"); SC_clear_error((StatementClass *) StatementHandle); @@ -835,7 +835,7 @@ HSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType, - SQLUINTEGER *pcbParamDef, + SQLULEN *pcbParamDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable) { @@ -855,8 +855,8 @@ SQLExtendedFetch( HSTMT hstmt, SQLUSMALLINT fFetchType, - SQLINTEGER irow, - SQLUINTEGER *pcrow, + SQLROWOFFSET irow, + SQLROWSETSIZE *pcrow, SQLUSMALLINT *rgfRowStatus) { RETCODE ret; @@ -1021,8 +1021,8 @@ RETCODE SQL_API SQLParamOptions( HSTMT hstmt, - SQLUINTEGER crow, - SQLUINTEGER *pirow) + SQLULEN crow, + SQLULEN *pirow) { RETCODE ret; StatementClass *stmt = (StatementClass *) hstmt; @@ -1238,7 +1238,7 @@ RETCODE SQL_API SQLSetPos( HSTMT hstmt, - SQLUSMALLINT irow, + SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock) { @@ -1323,11 +1323,11 @@ SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, - SQLUINTEGER cbColDef, + SQLULEN cbColDef, SQLSMALLINT ibScale, PTR rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER *pcbValue) + SQLLEN cbValueMax, + SQLLEN *pcbValue) { RETCODE ret; StatementClass *stmt = (StatementClass *) hstmt; only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/pgapifunc.h +++ psqlodbc-08.01.0200/pgapifunc.h @@ -29,8 +29,8 @@ SQLUSMALLINT icol, SQLSMALLINT fCType, PTR rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER *pcbValue); + SQLLEN cbValueMax, + SQLLEN *pcbValue); RETCODE SQL_API PGAPI_Cancel(HSTMT StatementHandle); RETCODE SQL_API PGAPI_Columns(HSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, @@ -58,7 +58,7 @@ RETCODE SQL_API PGAPI_DescribeCol(HSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, - SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable); RETCODE SQL_API PGAPI_Disconnect(HDBC ConnectionHandle); RETCODE SQL_API PGAPI_Error(HENV henv, @@ -113,8 +113,8 @@ SQLUSMALLINT icol, SQLSMALLINT fCType, PTR rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER *pcbValue); + SQLLEN cbValueMax, + SQLLEN *pcbValue); RETCODE SQL_API PGAPI_GetFunctions(HDBC ConnectionHandle, SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported); RETCODE SQL_API PGAPI_GetFunctions30(HDBC ConnectionHandle, @@ -140,7 +140,7 @@ PTR rgbValue, SQLINTEGER cbValue); RETCODE SQL_API PGAPI_RowCount(HSTMT hstmt, - SQLINTEGER *pcrow); + SQLLEN *pcrow); RETCODE SQL_API PGAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, SQLPOINTER vParam); @@ -193,7 +193,7 @@ RETCODE SQL_API PGAPI_DescribeParam(HSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT *pfSqlType, - SQLUINTEGER *pcbColDef, + SQLULEN *pcbColDef, SQLSMALLINT *pibScale, SQLSMALLINT *pfNullable); RETCODE SQL_API PGAPI_ExtendedFetch(HSTMT hstmt, @@ -230,8 +230,8 @@ HSTMT hstmt, SQLSMALLINT *pcpar); RETCODE SQL_API PGAPI_ParamOptions(HSTMT hstmt, - SQLUINTEGER crow, - SQLUINTEGER *pirow); + SQLULEN crow, + SQLULEN *pirow); RETCODE SQL_API PGAPI_PrimaryKeys( HSTMT hstmt, SQLCHAR *szCatalogName, @@ -278,11 +278,11 @@ SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, - SQLUINTEGER cbColDef, + SQLULEN cbColDef, SQLSMALLINT ibScale, PTR rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER *pcbValue); + SQLLEN cbValueMax, + SQLLEN *pcbValue); RETCODE SQL_API PGAPI_SetScrollOptions( HSTMT hstmt, UWORD fConcurrency, only in patch2: unchanged: --- psqlodbc-08.01.0200.orig/results.c +++ psqlodbc-08.01.0200/results.c @@ -35,7 +35,7 @@ RETCODE SQL_API PGAPI_RowCount(HSTMT hstmt, - SQLINTEGER *pcrow) + SQLLEN *pcrow) { CSTR func = "PGAPI_RowCount"; StatementClass *stmt = (StatementClass *) hstmt; @@ -162,7 +162,7 @@ SWORD cbColNameMax, SWORD FAR * pcbColName, SWORD FAR * pfSqlType, - UDWORD FAR * pcbColDef, + SQLULEN FAR * pcbColDef, SWORD FAR * pibScale, SWORD FAR * pfNullable) { @@ -763,8 +763,8 @@ SQLUSMALLINT icol, SQLSMALLINT fCType, PTR rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER *pcbValue) + SQLLEN cbValueMax, + SQLLEN *pcbValue) { CSTR func = "PGAPI_GetData"; QResultClass *res; @@ -2394,7 +2394,8 @@ RETCODE ret; UInt4 oid, offset, blocknum; UInt2 pgoffset; - Int4 *used, bind_size = opts->bind_size; + SQLLEN *used; + Int4 bind_size = opts->bind_size; s.stmt = stmt; s.irow = irow; @@ -2496,7 +2497,7 @@ (SQLSMALLINT) fi[i]->decimal_digits, bindings[i].buffer, bindings[i].buflen, - (SQLINTEGER *) bindings[i].used); + (SQLLEN *) bindings[i].used); } } } @@ -2676,7 +2677,7 @@ bookmark->returntype, bookmark->buffer + offset, bookmark->buflen, - (SDWORD *) (bookmark->used + (bookmark->used ? (bookmark->used + (offset >> 2)) : NULL)); } @@ -2766,7 +2767,8 @@ char addstr[4096]; RETCODE ret; UInt4 offset; - Int4 *used, bind_size = opts->bind_size; + SQLLEN *used; + Int4 bind_size = opts->bind_size; Int4 fieldtype; mylog("POS ADD fi=%x ti=%x\n", fi, stmt->ti); @@ -2832,7 +2834,7 @@ (SQLSMALLINT) fi[i]->decimal_digits, bindings[i].buffer, bindings[i].buflen, - (SQLINTEGER *) bindings[i].used); + (SQLLEN *) bindings[i].used); } } else