Date: Friday, January 27, 2006 @ 18:32:44
  Author: marc
    Path: /cvsroot/carob/carob/test/40-Parameter-PreparedStatement

Modified: TestParameterStatement.cpp (1.2 -> 1.3)
          TestParameterStatement.hpp (1.1 -> 1.2)

Added write/read testBoolean()


----------------------------+
 TestParameterStatement.cpp |   32 +++++++++++++++++++++++++++++++-
 TestParameterStatement.hpp |    2 ++
 2 files changed, 33 insertions(+), 1 deletion(-)


Index: carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
diff -u 
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.2 
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.3
--- carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.2    
Thu Jan 12 17:33:46 2006
+++ carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp        
Fri Jan 27 18:32:44 2006
@@ -16,7 +16,7 @@
  * limitations under the License.
  *
  * Initial developer(s): Zsolt Simon
- * Contributor(s): 
+ * Contributor(s): Marc Herbert
  */
 
 #include <iostream>
@@ -204,6 +204,33 @@
   CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
 }
 
+
+void TestParameterStatement::testBoolean()
+{
+  const std::wstring TABLE_TYPE(L"(b1 boolean, b2 boolean)");
+  const std::wstring TABLE_NAME(L"booltable");
+
+  wstring fctName(L"TestParameterStatement::testBoolean");
+  
+  createOrReplaceTable(connectionPtr, TABLE_NAME, TABLE_TYPE);
+
+  ParameterStatement* pstmt = connectionPtr->
+    createParameterStatement(std::wstring() + L"INSERT into " + TABLE_NAME + 
L" values (?, ?)");
+
+  pstmt->setBoolean(1, false);
+  pstmt->setBoolean(2, true);
+  int uc = pstmt->executeUpdate();
+  CPPUNIT_ASSERT(1 == uc);
+
+  Statement* stmt = connectionPtr-> createStatement();
+
+  DriverResultSet * drs = stmt->executeQuery(std::wstring() + L"SELECT * from 
" + TABLE_NAME);
+  CPPUNIT_ASSERT(drs->next());
+  CPPUNIT_ASSERT(0 == drs->getAsInt(1));
+  CPPUNIT_ASSERT(1 == drs->getAsInt(2));
+}
+
+
 CppUnit::Test* TestParameterStatement::suite()
 {
   CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( 
"TestParameterStatement" );
@@ -225,6 +252,9 @@
   suiteOfTests->addTest(new CppUnit::TestCaller<TestParameterStatement>(
                                  "testExecuteWithUpdate", 
                                  
&TestParameterStatement::testExecuteWithUpdate));
+  suiteOfTests->addTest(new CppUnit::TestCaller<TestParameterStatement>(
+                                 "testBoolean", 
+                                 &TestParameterStatement::testBoolean));
 
   return suiteOfTests;
 }
Index: carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp
diff -u 
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp:1.1 
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp:1.2
--- carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp:1.1    
Thu Dec 22 17:02:51 2005
+++ carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp        
Fri Jan 27 18:32:44 2006
@@ -71,6 +71,8 @@
    * Tests execute function with an update statement
    */
   void testExecuteWithUpdate();
+
+  void testBoolean();
 };
 
 #endif /*TESTPARAMETERSTATEMENT_H_*/

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

Reply via email to