You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by td...@apache.org on 2013/07/31 17:08:21 UTC

svn commit: r1508904 - in /apr/apr-util/branches/1.5.x: CHANGES dbd/apr_dbd_odbc.c

Author: tdonovan
Date: Wed Jul 31 15:08:21 2013
New Revision: 1508904

URL: http://svn.apache.org/r1508904
Log:
Fix warnings in odbc driver on 64bit systems. PR 55197, from trunk r1508903

Modified:
    apr/apr-util/branches/1.5.x/CHANGES
    apr/apr-util/branches/1.5.x/dbd/apr_dbd_odbc.c

Modified: apr/apr-util/branches/1.5.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/CHANGES?rev=1508904&r1=1508903&r2=1508904&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.5.x/CHANGES [utf-8] Wed Jul 31 15:08:21 2013
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.5.3
 
+  *) Fix warnings in odbc driver on 64bit systems.
+     PR 55197  [Tom Donovan]
+
   *) Add support to apr_memcache for unix domain sockets. PR 54573 [Remi
      Gacogne <rgacogne+asf aquaray.com>]
 

Modified: apr/apr-util/branches/1.5.x/dbd/apr_dbd_odbc.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/dbd/apr_dbd_odbc.c?rev=1508904&r1=1508903&r2=1508904&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/dbd/apr_dbd_odbc.c (original)
+++ apr/apr-util/branches/1.5.x/dbd/apr_dbd_odbc.c Wed Jul 31 15:08:21 2013
@@ -114,9 +114,9 @@ struct apr_dbd_t
     char lastError[MAX_ERROR_STRING];
     int defaultBufferSize;      /* used for CLOBs in text mode, 
                                  * and when fld size is indeterminate */
-    int transaction_mode;
-    int dboptions;              /* driver options re SQLGetData */
-    int default_transaction_mode;
+    intptr_t transaction_mode;
+    intptr_t dboptions;         /* driver options re SQLGetData */
+    intptr_t default_transaction_mode;
     int can_commit;             /* controls end_trans behavior */
 };
 
@@ -359,7 +359,7 @@ static SQLRETURN odbc_set_result_column(
                                         SQLHANDLE stmt)
 {
     SQLRETURN rc;
-    int maxsize, textsize, realsize, type, isunsigned = 1;
+    intptr_t maxsize, textsize, realsize, type, isunsigned = 1;
 
     /* discover the sql type */
     rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_UNSIGNED, NULL, 0, NULL,
@@ -409,7 +409,7 @@ static SQLRETURN odbc_set_result_column(
       type = SQL_C_CHAR;
     }
 
-    res->coltypes[icol] = type;
+    res->coltypes[icol] = (SQLSMALLINT)type;
 
     /* size if retrieved as text */
     rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_DISPLAY_SIZE, NULL, 0,
@@ -441,12 +441,12 @@ static SQLRETURN odbc_set_result_column(
 
         res->colptrs[icol] =  NULL;
         res->colstate[icol] = COL_AVAIL;
-        res->colsizes[icol] = maxsize;
+        res->colsizes[icol] = (SQLINTEGER)maxsize;
         rc = SQL_SUCCESS;
     }
     else {
         res->colptrs[icol] = apr_pcalloc(res->pool, maxsize);
-        res->colsizes[icol] = maxsize;
+        res->colsizes[icol] = (SQLINTEGER)maxsize;
         if (res->apr_dbd->dboptions & SQL_GD_BOUND) {
             /* we are allowed to call SQLGetData if we need to */
             rc = SQLBindCol(stmt, icol + 1, res->coltypes[icol], 
@@ -747,7 +747,7 @@ static void *odbc_get(const apr_dbd_row_
     SQLRETURN rc;
     SQLLEN indicator;
     int state = row->res->colstate[col];
-    int options = row->res->apr_dbd->dboptions;
+    intptr_t options = row->res->apr_dbd->dboptions;
 
     switch (state) {
     case (COL_UNAVAIL):
@@ -817,13 +817,13 @@ static apr_status_t odbc_parse_params(ap
                                int *connect, SQLCHAR **datasource, 
                                SQLCHAR **user, SQLCHAR **password, 
                                int *defaultBufferSize, int *nattrs,
-                               int **attrs, int **attrvals)
+                               int **attrs, intptr_t **attrvals)
 {
     char *seps, *last, *next, *name[MAX_PARAMS], *val[MAX_PARAMS];
     int nparams = 0, i, j;
 
     *attrs = apr_pcalloc(pool, MAX_PARAMS * sizeof(char *));
-    *attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(int));
+    *attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(intptr_t));
     *nattrs = 0;
     seps = DEFAULTSEPS;
     name[nparams] = apr_strtok(apr_pstrdup(pool, params), seps, &last);
@@ -1062,7 +1062,8 @@ static apr_dbd_t *odbc_open(apr_pool_t *
     SQLHANDLE err_h = NULL;
     SQLCHAR  *datasource = (SQLCHAR *)"", *user = (SQLCHAR *)"",
              *password = (SQLCHAR *)"";
-    int nattrs = 0, *attrs = NULL, *attrvals = NULL, connect = 0;
+    int nattrs = 0, *attrs = NULL,  connect = 0;
+    intptr_t *attrvals = NULL;
 
     err_step = "SQLAllocHandle (SQL_HANDLE_DBC)";
     err_htype = SQL_HANDLE_ENV;
@@ -1116,10 +1117,10 @@ static apr_dbd_t *odbc_open(apr_pool_t *
         handle->default_transaction_mode = 0;
         handle->can_commit = APR_DBD_TRANSACTION_IGNORE_ERRORS;
         SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION,
-                   &(handle->default_transaction_mode), sizeof(int), NULL);
+                   &(handle->default_transaction_mode), sizeof(intptr_t), NULL);
         handle->transaction_mode = handle->default_transaction_mode;
         SQLGetInfo(hdbc, SQL_GETDATA_EXTENSIONS ,&(handle->dboptions),
-                   sizeof(int), NULL);
+                   sizeof(intptr_t), NULL);
         apr_pool_cleanup_register(pool, handle, odbc_close_cleanup, apr_pool_cleanup_null);
         return handle;
     }