Date: Thursday, March 9, 2006 @ 11:36:57
  Author: marc
    Path: /cvsroot/carob/odbsequoia/src

Modified: stmt.cpp (1.16 -> 1.17) stmt.hpp (1.12 -> 1.13)

Extracted row_count(...) method from SQLRowCount(...)


----------+
 stmt.cpp |   18 +++++++++++++-----
 stmt.hpp |    7 +++++--
 2 files changed, 18 insertions(+), 7 deletions(-)


Index: odbsequoia/src/stmt.cpp
diff -u odbsequoia/src/stmt.cpp:1.16 odbsequoia/src/stmt.cpp:1.17
--- odbsequoia/src/stmt.cpp:1.16        Wed Mar  8 21:04:32 2006
+++ odbsequoia/src/stmt.cpp     Thu Mar  9 11:36:57 2006
@@ -65,17 +65,25 @@
     return SQL_SUCCESS;
 }
 
-SQLRETURN // FIXME : use descriptors instead
+SQLRETURN
 SQLRowCount(SQLHSTMT shdle, SQLLEN * rowcount)
 {
     ODBCStatement * self_p = objectify(shdle);
     self_p->clear_diags();
 
-    if (S5 != self_p->state
-        && S4 != self_p->state)
-        return SQL_ERROR; // TODO: HY010. No: done by DM! Use assert?
+    _PROTECT_SQLRETURN(self_p, row_count(shdle, rowcount));
+
+}
+
+SQLRETURN
+ODBCStatement::row_count(SQLHSTMT shdle, SQLLEN * rowcount)
+{
+    // DM will probably catch this before us
+    if (S5 != state
+        && S4 != state)
+        throw ODBSeqException(L"HY010", L"invalid state for SQLRowCount, 
neither S4 nor S5");
 
-    *rowcount = self_p->carob_stmt->getUpdateCount();
+    *rowcount = carob_stmt->getUpdateCount();
 
 //    if (-1 == *rowcount) // driver-defined in S5. We could return RS.length.
 //        *rowcount = ? ;
Index: odbsequoia/src/stmt.hpp
diff -u odbsequoia/src/stmt.hpp:1.12 odbsequoia/src/stmt.hpp:1.13
--- odbsequoia/src/stmt.hpp:1.12        Wed Mar  8 21:20:17 2006
+++ odbsequoia/src/stmt.hpp     Thu Mar  9 11:36:57 2006
@@ -58,6 +58,11 @@
     bind_col(SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
              SQLPOINTER TargetValuePtr, SQLINTEGER BufferLength,
              SQLLEN * StrLen_or_Ind);
+    SQLRETURN
+    fetch();
+
+    SQLRETURN
+    row_count(SQLHSTMT shdle, SQLLEN * rowcount);
 
     const std::wstring&
     get_carob_diagids() const
@@ -77,8 +82,6 @@
         return owner.get_odbc_diagids();
     };
 
-    SQLRETURN
-    fetch();
 
 protected:
     SQLRETURN

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

Reply via email to