apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdono...@apache.org
Subject svn commit: r1563992 - in /apr/apr-util/branches/1.5.x: CHANGES dbd/apr_dbd_odbc.c
Date Mon, 03 Feb 2014 18:41:55 GMT
Author: tdonovan
Date: Mon Feb  3 18:41:55 2014
New Revision: 1563992

URL: http://svn.apache.org/r1563992
Log:
Like r1557720 in trunk.  
MSVC6 has no intptr_t (a C99 type) and there is no signed 
inptr type in APR 1.5.  This change is local to the odbc driver
to avoid introducing a new apr type in a patch release.

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=1563992&r1=1563991&r2=1563992&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.5.x/CHANGES [utf-8] Mon Feb  3 18:41:55 2014
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.5.4
 
+  *) Fix to let ODBC driver build with MSVC6, which does not have intptr_t
+     [Tom Donovan]
+
   *) Windows cmake build: Fix an incompatiblity with Visual Studio
      generators.  [Jeff Trawick, Bert Huijben]
 

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=1563992&r1=1563991&r2=1563992&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 Mon Feb  3 18:41:55 2014
@@ -47,6 +47,21 @@
 #include <odbc/sqlext.h>
 #endif
 
+/*
+* MSVC6 does not support intptr_t (C99)
+* APR does not have a signed inptr type until 2.0  (r1557720)
+*/
+#if defined(_MSC_VER) && _MSC_VER < 1400
+#if APR_SIZEOF_VOIDP == 8
+#define   ODBC_INTPTR_T  apr_int64_t
+#else
+#define   ODBC_INTPTR_T  apr_int32_t
+#endif
+#else
+#define   ODBC_INTPTR_T  intptr_t
+#endif
+
+
 /* Driver name is "odbc" and the entry point is 'apr_dbd_odbc_driver' 
  * unless ODBC_DRIVER_NAME is defined and it is linked with another db library which
  * is ODBC source-compatible. e.g. DB2, Informix, TimesTen, mysql.  
@@ -114,9 +129,9 @@ struct apr_dbd_t
     char lastError[MAX_ERROR_STRING];
     int defaultBufferSize;      /* used for CLOBs in text mode, 
                                  * and when fld size is indeterminate */
-    intptr_t transaction_mode;
-    intptr_t dboptions;         /* driver options re SQLGetData */
-    intptr_t default_transaction_mode;
+    ODBC_INTPTR_T transaction_mode;
+    ODBC_INTPTR_T dboptions;         /* driver options re SQLGetData */
+    ODBC_INTPTR_T default_transaction_mode;
     int can_commit;             /* controls end_trans behavior */
 };
 
@@ -359,7 +374,7 @@ static SQLRETURN odbc_set_result_column(
                                         SQLHANDLE stmt)
 {
     SQLRETURN rc;
-    intptr_t maxsize, textsize, realsize, type, isunsigned = 1;
+    ODBC_INTPTR_T maxsize, textsize, realsize, type, isunsigned = 1;
 
     /* discover the sql type */
     rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_UNSIGNED, NULL, 0, NULL,
@@ -747,7 +762,7 @@ static void *odbc_get(const apr_dbd_row_
     SQLRETURN rc;
     SQLLEN indicator;
     int state = row->res->colstate[col];
-    intptr_t options = row->res->apr_dbd->dboptions;
+    ODBC_INTPTR_T options = row->res->apr_dbd->dboptions;
 
     switch (state) {
     case (COL_UNAVAIL):
@@ -817,13 +832,13 @@ static apr_status_t odbc_parse_params(ap
                                int *connect, SQLCHAR **datasource, 
                                SQLCHAR **user, SQLCHAR **password, 
                                int *defaultBufferSize, int *nattrs,
-                               int **attrs, intptr_t **attrvals)
+                               int **attrs, ODBC_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(intptr_t));
+    *attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(ODBC_INTPTR_T));
     *nattrs = 0;
     seps = DEFAULTSEPS;
     name[nparams] = apr_strtok(apr_pstrdup(pool, params), seps, &last);
@@ -1063,7 +1078,7 @@ static apr_dbd_t *odbc_open(apr_pool_t *
     SQLCHAR  *datasource = (SQLCHAR *)"", *user = (SQLCHAR *)"",
              *password = (SQLCHAR *)"";
     int nattrs = 0, *attrs = NULL,  connect = 0;
-    intptr_t *attrvals = NULL;
+    ODBC_INTPTR_T *attrvals = NULL;
 
     err_step = "SQLAllocHandle (SQL_HANDLE_DBC)";
     err_htype = SQL_HANDLE_ENV;
@@ -1117,10 +1132,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(intptr_t), NULL);
+                   &(handle->default_transaction_mode), sizeof(ODBC_INTPTR_T), NULL);
         handle->transaction_mode = handle->default_transaction_mode;
         SQLGetInfo(hdbc, SQL_GETDATA_EXTENSIONS ,&(handle->dboptions),
-                   sizeof(intptr_t), NULL);
+                   sizeof(ODBC_INTPTR_T), NULL);
         apr_pool_cleanup_register(pool, handle, odbc_close_cleanup, apr_pool_cleanup_null);
         return handle;
     }



Mime
View raw message