[gnome-db] Patch: Oracle 9i Support



The following patch is what I regard as the minimum set of changes
required for libgda to support Oracle 9i.

The change to configure.in is to make libgda-oracle.so link against the
shared version of the OCI client library rather than an extensive list
of archive libraries - this saves having to work out what the list of
libraries should be for Oracle 9i.

The changes to the gda-oracle-provider.c and gda-oracle-recordset.c are
to work around what appears to a bug with pre-fetching on Oracle version
9.2.0.2.0

Steve.


--- libgda-0.10.0-sjf3/configure.in	Thu Jan 16 00:10:20 2003
+++ libgda-0.10.0-libtest/configure.in	Wed Feb 19 15:50:46 2003
@@ -525,10 +525,7 @@
 	else
 		AC_DEFINE(HAVE_ORACLE)
 		ORACLE_CFLAGS="-I${ORACLE_HOME}/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I${ORACLE_HOME}/network/public"
-		ORACLE_LIBS="-L${ORACLE_HOME}/lib -lm -ldl -lserver8 -lclient8 \
-		-lgeneric8 -lcommon8 -lvsn8 -lagent8 -lmm -lclntst8 \
-            	-lslax8 -lsql8 -lcore8 -lnls8 -lplc8 -lplp8 -lpls8 \
-               	-lpsa8"
+		ORACLE_LIBS="-L${ORACLE_HOME}/lib -lm -ldl -lclntsh"
 	fi
 fi
 
--- libgda-0.10.0-sjf3/providers/oracle/gda-oracle-provider.c	Mon Feb 10 23:02:28 2003
+++ libgda-0.10.0-libtest/providers/oracle/gda-oracle-provider.c	Wed Feb 19 15:18:29 2003
@@ -554,6 +554,7 @@
 	GdaOracleConnectionData *priv_data;
 	gchar **arr;
 	gint result;
+	ub4 prefetch = 200;
 
 	priv_data = g_object_get_data (G_OBJECT (cnc), OBJECT_DATA_ORACLE_HANDLE);
 	if (!priv_data) {
@@ -586,7 +587,18 @@
 				OCIHandleFree ((dvoid *) stmthp, OCI_HTYPE_STMT);
 				return NULL;
 			}
-				
+
+			result = OCIAttrSet (stmthp,
+					     OCI_HTYPE_STMT,
+					     &prefetch,
+					     0,
+					     OCI_ATTR_PREFETCH_ROWS,
+					     priv_data->herr);
+			if (!gda_oracle_check_result (result, cnc, priv_data, OCI_HTYPE_ERROR,
+					_("Could not set the Oracle statement pre-fetch row count"))) {
+				OCIHandleFree ((dvoid *) stmthp, OCI_HTYPE_STMT);
+				return NULL;
+			}
 
 			result = OCIStmtExecute (priv_data->hservice,
 						stmthp,
--- libgda-0.10.0-sjf3/providers/oracle/gda-oracle-recordset.c	Thu Jan 16 00:13:26 2003
+++ libgda-0.10.0-libtest/providers/oracle/gda-oracle-recordset.c	Wed Feb 19 15:18:54 2003
@@ -106,17 +106,19 @@
 			break;
 		}
 
-		ora_value->value = g_malloc0 (ora_value->defined_size);
+		if (ora_value->defined_size == 0)
+		    ora_value->value = NULL;
+		else
+		    ora_value->value = g_malloc0 (ora_value->defined_size+1);
 		ora_value->hdef = (OCIDefine *) 0;
 		ora_value->indicator = 0;
 		ora_value->gda_type = oracle_sqltype_to_gda_type (ora_value->sql_type);
-
 		result = OCIDefineByPos ((OCIStmt *) priv->hstmt,
 					(OCIDefine **) &(ora_value->hdef),
 					(OCIError *) priv->cdata->herr,
 					(ub4) i + 1,
 					ora_value->value,
-					ora_value->defined_size,
+					ora_value->defined_size+1,
 					(ub2) ora_value->sql_type,
 					(dvoid *) &(ora_value->indicator),
 					(ub2 *) 0,
@@ -303,6 +305,7 @@
 				(CONST OCISnapshot *) NULL,
 				(OCISnapshot *) NULL,
 				OCI_DEFAULT);
+	
 	if (!gda_oracle_check_result (result, priv_data->cnc, priv_data->cdata, 
 		OCI_HTYPE_ERROR, "Could not execute Oracle statement")) {
 		return 0;
--- libgda-0.10.0-sjf3/ChangeLog	Sat Feb  8 22:50:03 2003
+++ libgda-0.10.0-libtest/ChangeLog	Wed Feb 19 16:00:59 2003
@@ -1,3 +1,12 @@
+2003-02-19  Steve Fosdick <gnomedb pelvoux demon co uk>
+
+	* Add minimal support for Oracle 9i.
+
+	* configure.in: Changed to use the shared OCI client library.
+
+	* providers/oracle/gda-oracle-*.c: worked around what appears to
+	be a bug in pre-fetching in Oracle 9.2.0.2.0
+		
 2003-02-08  Steve Fosdick <gnomedb pelvoux demon co uk>
 
 	* providers/oracle/gda-oracle.[ch]: Introduced a default namespace


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]