Date: Monday, November 28, 2005 @ 16:01:17
  Author: gilles
    Path: /cvsroot/carob/carob/test

Modified: TestStatement.cpp (1.6 -> 1.7)

Modified ReadGood so it now uses/tests fetchSize = 1, ResultSetMetadata and 
toString method


-------------------+
 TestStatement.cpp |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)


Index: carob/test/TestStatement.cpp
diff -u carob/test/TestStatement.cpp:1.6 carob/test/TestStatement.cpp:1.7
--- carob/test/TestStatement.cpp:1.6    Mon Nov 28 13:50:12 2005
+++ carob/test/TestStatement.cpp        Mon Nov 28 16:01:17 2005
@@ -26,6 +26,7 @@
 #include "DriverResultSet.hpp"
 #include "TestStatement.hpp"
 #include "RequestWithResultSetParameters.hpp"
+#include "ResultSetMetaData.hpp"
 #include "Statement.hpp"
 
 
@@ -91,6 +92,7 @@
   {
     logDebug(fctName, L"Executing read - should succeed");
   }
+  statementPtr->setFetchSize(1);
   DriverResultSet* drsPtr = statementPtr->executeQuery(
       L"select * from address;");
   if (isDebugEnabled())
@@ -98,16 +100,17 @@
     logDebug(fctName, L"Read succeeded. Displaying 50 rows:");
   }
   //Display 50 rows for debugging...
-    
+  //Use metadata and to string
+  ResultSetMetaData rsmd(drsPtr);
 //    wcerr<<L"Row\tId\tName\tCost"<<endl;
   wcerr<<L"Row\tId\tFirstName\tLastName"<<endl;
   for (int i=0; i<50; i++)
   {
     drsPtr->next();
-    int32_t* iPtr = drsPtr->getInt(1);
-    wstring* wsPtr = drsPtr->getString(2);
-    wstring* ws2Ptr = drsPtr->getString(3);
-    wcerr<<i+1<<L"\t"<<*iPtr<<L"\t"<<*wsPtr<<L"\t\t"<<*ws2Ptr<<endl;
+    wcerr<<i+1<<L"\t";
+    for (int j=0; j<rsmd.getColumnCount(); j++)
+      wcerr<<*(drsPtr->getString(j+1))<<L"\t";
+    wcerr<<endl;
   }
   delete statementPtr;
 }

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

Reply via email to