apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r390400 - /apr/apr-util/trunk/dbd/apr_dbd_oracle.c
Date Fri, 31 Mar 2006 12:10:18 GMT
Author: niq
Date: Fri Mar 31 04:10:16 2006
New Revision: 390400

URL: http://svn.apache.org/viewcvs?rev=390400&view=rev
Log:
apr_dbd_get_name patch for Oracle driver (Chris Darroch)

Modified:
    apr/apr-util/trunk/dbd/apr_dbd_oracle.c

Modified: apr/apr-util/trunk/dbd/apr_dbd_oracle.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_oracle.c?rev=390400&r1=390399&r2=390400&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_oracle.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_oracle.c Fri Mar 31 04:10:16 2006
@@ -181,6 +181,7 @@
         char *stringval;
         OCILobLocator *lobval;
     } buf;
+    const char *name;
 } define_arg;
 
 struct apr_dbd_prepared_t {
@@ -525,6 +526,16 @@
 }
 #endif
 
+static const char *dbd_oracle_get_name(const apr_dbd_results_t *res, int n)
+{
+    define_arg *val = &res->statement->out[n];
+
+    if ((n < 0) || (n >= res->statement->nout)) {
+        return NULL;
+    }
+    return val->name;
+}
+
 static int dbd_oracle_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
                               apr_dbd_row_t **rowp, int rownum)
 {
@@ -988,6 +999,8 @@
     int_errorcode;
     ub2 paramtype[DBD_ORACLE_MAX_COLUMNS];
     ub2 paramsize[DBD_ORACLE_MAX_COLUMNS];
+    const char *paramname[DBD_ORACLE_MAX_COLUMNS];
+    ub4 paramnamelen[DBD_ORACLE_MAX_COLUMNS];
     /* Perl uses 0 where we used 1 */
     sql->status = OCIStmtExecute(sql->svc, stmt->stmt, sql->err, 0, 0,
                                  NULL, NULL, OCI_DESCRIBE_ONLY);
@@ -1016,6 +1029,10 @@
             sql->status = OCIAttrGet(parms, OCI_DTYPE_PARAM,
                                      &paramsize[stmt->nout],
                                      0, OCI_ATTR_DATA_SIZE, sql->err);
+            sql->status = OCIAttrGet(parms, OCI_DTYPE_PARAM,
+                                     &paramname[stmt->nout],
+                                     &paramnamelen[stmt->nout],
+                                     OCI_ATTR_NAME, sql->err);
             ++stmt->nout;
         }
     }
@@ -1033,6 +1050,8 @@
     for (i=0; i<stmt->nout; ++i) {
         stmt->out[i].type = paramtype[i];
         stmt->out[i].len = stmt->out[i].sz = paramsize[i];
+        stmt->out[i].name = apr_pstrmemdup(stmt->pool,
+                                           paramname[i], paramnamelen[i]);
         switch (stmt->out[i].type) {
         default:
             switch (stmt->out[i].type) {
@@ -1890,6 +1909,7 @@
     dbd_oracle_pvquery,
     dbd_oracle_pvselect,
     dbd_oracle_pquery,
-    dbd_oracle_pselect
+    dbd_oracle_pselect,
+    dbd_oracle_get_name
 };
 #endif



Mime
View raw message