Date: Wednesday, March 8, 2006 @ 18:57:24
  Author: marc
    Path: /cvsroot/carob/odbsequoia/src

Modified: descriptors.cpp (1.3 -> 1.4) descriptors_records.cpp (1.1 ->
          1.2) descriptors_records.hpp (1.2 -> 1.3)

extracted method AppDescRecord::fetch_col(...) from the column loop inside 
method ODBCAppDesc::fetchRow(...)


-------------------------+
 descriptors.cpp         |   19 ++-----------------
 descriptors_records.cpp |   24 ++++++++++++++++++++++++
 descriptors_records.hpp |    6 ++++++
 3 files changed, 32 insertions(+), 17 deletions(-)


Index: odbsequoia/src/descriptors.cpp
diff -u odbsequoia/src/descriptors.cpp:1.3 odbsequoia/src/descriptors.cpp:1.4
--- odbsequoia/src/descriptors.cpp:1.3  Wed Mar  8 18:50:25 2006
+++ odbsequoia/src/descriptors.cpp      Wed Mar  8 18:57:24 2006
@@ -23,7 +23,6 @@
 #include "descriptors.hpp"
 
 #include "util.hpp"
-#include "odbc_exception.hpp"
 
 #include "DriverResultSet.hpp"
 
@@ -117,23 +116,9 @@
     {
         if (*rec_col != 0) // is this row bound ? Else ignore it
         {
-            AppDescRecord& rec = * static_cast<AppDescRecord *>(*rec_col);
+            AppDescRecord& record = * static_cast<AppDescRecord *>(*rec_col);
 
-            if (rs.isNull(rs_col))
-            {
-                if (0 == rec.indicator_ptr)
-                    throw ODBSeqException(L"22002",
-                                          L"Cannot flag SQL_NULL_DATA"
-                                          L"because indicator_ptr is null");
-   
-                * rec.indicator_ptr = SQL_NULL_DATA;
-                continue;
-            }
-
-            // case (type == SQL_C_INT)
-            * static_cast<int *>(rec.data_ptr) = rs.getAsInt(rs_col);
-            if (rec.octet_length_ptr != 0)
-                * rec.octet_length_ptr = sizeof(int);
+            record.fetch_col(rs, rs_col);
 
         }
     }
Index: odbsequoia/src/descriptors_records.cpp
diff -u odbsequoia/src/descriptors_records.cpp:1.1 
odbsequoia/src/descriptors_records.cpp:1.2
--- odbsequoia/src/descriptors_records.cpp:1.1  Fri Feb 24 16:12:43 2006
+++ odbsequoia/src/descriptors_records.cpp      Wed Mar  8 18:57:24 2006
@@ -22,6 +22,10 @@
 
 #include "descriptors_records.hpp"
 
+#include "odbc_exception.hpp"
+
+#include "DriverResultSet.hpp"
+
 using namespace ODBSeqNS;
 
 /**** Base records ***/
@@ -51,6 +55,26 @@
     return SQL_SUCCESS;
 }
 
+void
+AppDescRecord::fetch_col(CarobNS::DriverResultSet& rs, int rs_col)
+{
+    if (rs.isNull(rs_col))
+    {
+        if (0 == indicator_ptr)
+            throw ODBSeqException(L"22002",
+                                  L"Cannot flag SQL_NULL_DATA"
+                                  L"because indicator_ptr is null");
+   
+        * indicator_ptr = SQL_NULL_DATA;
+        return;
+    }
+
+    // case (type == SQL_C_INT)
+    * static_cast<int *>(data_ptr) = rs.getAsInt(rs_col);
+    if (octet_length_ptr != 0)
+        * octet_length_ptr = sizeof(int);
+
+}
 /*
  * Local Variables:
  * c-file-style: "bsd"
Index: odbsequoia/src/descriptors_records.hpp
diff -u odbsequoia/src/descriptors_records.hpp:1.2 
odbsequoia/src/descriptors_records.hpp:1.3
--- odbsequoia/src/descriptors_records.hpp:1.2  Wed Mar  8 18:22:53 2006
+++ odbsequoia/src/descriptors_records.hpp      Wed Mar  8 18:57:24 2006
@@ -29,6 +29,10 @@
 
 /* There is one record per column/parameter */
 
+namespace CarobNS {
+class DriverResultSet;
+}
+
 namespace ODBSeqNS {
 
 
@@ -68,6 +72,8 @@
     SQLRETURN
     bind_col(SQLSMALLINT TargetType, SQLPOINTER TargetValuePtr,
              SQLINTEGER BufferLength, SQLLEN * StrLen_or_Ind);
+    void
+    fetch_col(CarobNS::DriverResultSet& rs, int rs_col);
 
 public: // public to avoid cluttering the code with getters/setters
     SQLPOINTER data_ptr;

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to