Re: gda-odbc



>>>>> On Thu, 07 Sep 2000 11:34:19 +0000,
>>>>> "NG" == Nick Gorham <nick easysoft com> wrote:

NG> I have commeted some changes that should make the odbc provider work with odbc 2.x, If someone could give it a try and let me know if I have missed anything...

Because I was not able to compile it in my environment, I
fixed one typo and made a patch to can compile it.

please check it.

--
Akira TAGOH
diff -ruN --exclude=CVS libgda.orig/providers/gda-odbc-server/gda-odbc-connection.c libgda/providers/gda-odbc-server/gda-odbc-connection.c
--- libgda.orig/providers/gda-odbc-server/gda-odbc-connection.c	Thu Sep  7 20:31:25 2000
+++ libgda/providers/gda-odbc-server/gda-odbc-connection.c	Thu Sep  7 22:56:08 2000
@@ -183,7 +183,7 @@
 #if (ODBCVER >= 0x0300)
     rc = SQLSetConnectAttr( od_cnc->hdbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0 );
 #else
-    rc = SQLSetConnectOption( od_cnc->hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0 );
+    rc = SQLSetConnectOption( od_cnc->hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF );
 #endif
     if ( SQL_SUCCEEDED( rc ))
     {
@@ -300,7 +300,7 @@
 #if (ODBCVER >= 0x0300)
     rc = SQLSetConnectAttr( od_cnc->hdbc, SQL_ATTR_TRACE, (SQLPOINTER)SQL_OPT_TRACE_ON, 0 );
 #else
-    rc = SQLSetConnectOption( od_cnc->hdbc, SQL_TRACE, (SQLPOINTER)SQL_OPT_TRACE_ON, 0 );
+    rc = SQLSetConnectOption( od_cnc->hdbc, SQL_OPT_TRACE, (SQLPOINTER)SQL_OPT_TRACE_ON );
 #endif
     if ( SQL_SUCCEEDED( rc ))
     {
@@ -332,7 +332,7 @@
 #if (ODBCVER >= 0x0300)
     rc = SQLSetConnectAttr( od_cnc->hdbc, SQL_ATTR_TRACE, SQL_OPT_TRACE_OFF, 0 );
 #else
-    rc = SQLSetConnectOption( od_cnc->hdbc, SQL_TRACE, SQL_OPT_TRACE_OFF, 0 );
+    rc = SQLSetConnectOption( od_cnc->hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF );
 #endif
     if ( SQL_SUCCEEDED( rc ))
     {
@@ -474,7 +474,7 @@
 
 #if (ODBCVER >= 0x0300)
     case SQL_TYPE_TIMESTAMP:
-#else
+#endif
     case SQL_TIMESTAMP:
       return GDA_TypeDbTimestamp;
   }
diff -ruN --exclude=CVS libgda.orig/providers/gda-odbc-server/gda-odbc-recordset.c libgda/providers/gda-odbc-server/gda-odbc-recordset.c
--- libgda.orig/providers/gda-odbc-server/gda-odbc-recordset.c	Thu Sep  7 20:31:25 2000
+++ libgda/providers/gda-odbc-server/gda-odbc-recordset.c	Thu Sep  7 22:56:09 2000
@@ -18,6 +18,10 @@
 
 #include "gda-odbc.h"
 
+#ifndef SQL_NO_DATA
+#define SQL_NO_DATA SQL_NO_DATA_FOUND
+#endif
+
 int map_cols( ODBC_Recordset *odbc_recset, int col )
 {
     if ( odbc_recset -> mapped_cols )
@@ -228,9 +232,9 @@
         case SQL_DATE:
           {
               rc = SQLGetData( odbc_recset->hstmt, map_cols( odbc_recset, i ) + 1, 
-                      SQL_C_DATE, &field->value->_u.dbd, sizeof( SQL_TIME_STRUCT ), &len );
+                      SQL_C_DATE, &field->value->_u.dbd, sizeof( TIME_STRUCT ), &len );
               gda_server_field_set_actual_length((Gda_ServerField *) node->data, 
-                      sizeof( SQL_DATE_STRUCT ));
+                      sizeof( DATE_STRUCT ));
               field->value->_d = GDA_TypeDbDate;
           }
           break;
@@ -238,9 +242,9 @@
         case SQL_TIME:
           {
               rc = SQLGetData( odbc_recset->hstmt, map_cols( odbc_recset, i ) + 1, 
-                      SQL_C_TIME, &field->value->_u.dbt, sizeof( SQL_TIME_STRUCT ), &len );
+                      SQL_C_TIME, &field->value->_u.dbt, sizeof( TIME_STRUCT ), &len );
               gda_server_field_set_actual_length((Gda_ServerField *) node->data, 
-                      sizeof( SQL_TIME_STRUCT ));
+                      sizeof( TIME_STRUCT ));
               field->value->_d = GDA_TypeDbTime;
           }
           break;
@@ -248,9 +252,9 @@
         case SQL_TIMESTAMP:
           {
               rc = SQLGetData( odbc_recset->hstmt, map_cols( odbc_recset, 1 ) + 1, 
-                      SQL_C_TIMESTAMP, &field->value->_u.dbtstamp, sizeof( SQL_TIMESTAMP_STRUCT ), &len );
+                      SQL_C_TIMESTAMP, &field->value->_u.dbtstamp, sizeof( TIMESTAMP_STRUCT ), &len );
               gda_server_field_set_actual_length((Gda_ServerField *) node->data, 
-                      sizeof( SQL_TIMESTAMP_STRUCT ));
+                      sizeof( TIMESTAMP_STRUCT ));
               field->value->_d = GDA_TypeDbTimestamp;
           }
           break;
@@ -340,7 +344,7 @@
 #if (ODBCVER >= 0x0300)
     rc = SQLFetchScroll( odbc_recset->hstmt, SQL_FETCH_PRIOR, 0 );
 #else
-    rc = SQLExtendedFetch( odbc_recset->hstmt, SQL_FETCH_PRIOR, 0, NULL );
+    rc = SQLExtendedFetch( odbc_recset->hstmt, SQL_FETCH_PRIOR, 0, NULL, NULL );
 #endif 
 
     if ( rc == SQL_NO_DATA )
diff -ruN --exclude=CVS libgda.orig/providers/gda-odbc-server/gda-odbc.h libgda/providers/gda-odbc-server/gda-odbc.h
--- libgda.orig/providers/gda-odbc-server/gda-odbc.h	Thu Aug 10 18:32:33 2000
+++ libgda/providers/gda-odbc-server/gda-odbc.h	Thu Sep  7 22:56:09 2000
@@ -27,6 +27,10 @@
 #include <sqlext.h>
 #include <gda-server.h>
 
+#ifndef SQL_SUCCEEDED
+#define SQL_SUCCEEDED(x) (x == SQL_SUCCESS)
+#endif
+
 /*
  * Per-object specific structures
  */


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