hi,

We've run accross the need to use the oracle driver from libdbi, but it
has not error checking at all.

I'm still testing the following patch, would it be possible to merge
something like this if it turns out to be working ok?

diff --git a/drivers/oracle/dbd_oracle.c b/drivers/oracle/dbd_oracle.c
index 2796cd6..a38c32b 100755
--- a/drivers/oracle/dbd_oracle.c
+++ b/drivers/oracle/dbd_oracle.c
@@ -290,17 +290,22 @@ dbi_result_t *dbd_query_null(dbi_conn_t *conn, const char 
unsigned *statement, s
        
        if( OCIStmtPrepare(stmt, Oconn->err, (char  *) statement,
                           (ub4) st_length, (ub4) OCI_NTV_SYNTAX, (ub4) 
OCI_DEFAULT)) {
+                OCIHandleFree(stmt, OCI_HTYPE_STMT);
                return NULL;
        }
        
        OCIAttrGet(stmt, OCI_HTYPE_STMT, (dvoid *) &stmttype,
                   (ub4 *) 0, (ub4) OCI_ATTR_STMT_TYPE, Oconn->err);
        
-       OCIStmtExecute(Oconn->svc, stmt, Oconn->err, 
+       status = OCIStmtExecute(Oconn->svc, stmt, Oconn->err, 
                       (ub4) (stmttype == OCI_STMT_SELECT ? 0 : 1), 
                       (ub4) 0, (CONST OCISnapshot *) NULL, (OCISnapshot *) 
NULL, 
                       MY_OCI_STMT_SCROLLABLE_READONLY);
 
+       if( status != OCI_SUCCESS) {
+                OCIHandleFree(stmt, OCI_HTYPE_STMT);
+               return NULL;
+       }
        
        if( stmttype == OCI_STMT_SELECT) { 
 


-- 
Bazsi


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Libdbi-drivers-devel mailing list
Libdbi-drivers-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel

Reply via email to