Date: Friday, January 27, 2006 @ 18:49:08
Author: marc
Path: /cvsroot/carob/carob/test/40-Parameter-PreparedStatement
Modified: TestParameterStatement.cpp (1.3 -> 1.4)
TestParameterStatement.hpp (1.2 -> 1.3)
Added draft testStrings() (testing |!%>)
----------------------------+
TestParameterStatement.cpp | 30 +++++++++++++++++++++++++++++-
TestParameterStatement.hpp | 2 ++
2 files changed, 31 insertions(+), 1 deletion(-)
Index: carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
diff -u
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.3
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.4
--- carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.3
Fri Jan 27 18:32:44 2006
+++ carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
Fri Jan 27 18:49:08 2006
@@ -226,10 +226,35 @@
DriverResultSet * drs = stmt->executeQuery(std::wstring() + L"SELECT * from
" + TABLE_NAME);
CPPUNIT_ASSERT(drs->next());
- CPPUNIT_ASSERT(0 == drs->getAsInt(1));
+ CPPUNIT_ASSERT(0 == drs->getAsInt(1)); // FIXME: replace by getBoolean()
CPPUNIT_ASSERT(1 == drs->getAsInt(2));
}
+void TestParameterStatement::testStrings()
+{
+ const std::wstring TABLE_TYPE(L"(str varchar(100))");
+ const std::wstring TABLE_NAME(L"stringtable");
+
+ wstring fctName(L"TestParameterStatement::testStrings");
+
+ createOrReplaceTable(connectionPtr, TABLE_NAME, TABLE_TYPE);
+
+ ParameterStatement* pstmt = connectionPtr->
+ createParameterStatement(wstring() + L"INSERT into " + TABLE_NAME + L"
values (?)");
+
+ wstring teststring(L"|!%>");
+
+ pstmt->setString(1, teststring);
+ 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(teststring == drs->getString(1)); // FIXME: replace by
getBoolean()
+}
+
CppUnit::Test* TestParameterStatement::suite()
{
@@ -255,6 +280,9 @@
suiteOfTests->addTest(new CppUnit::TestCaller<TestParameterStatement>(
"testBoolean",
&TestParameterStatement::testBoolean));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestParameterStatement>(
+ "testStrings",
+ &TestParameterStatement::testStrings));
return suiteOfTests;
}
Index: carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp
diff -u
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp:1.2
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp:1.3
--- carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp:1.2
Fri Jan 27 18:32:44 2006
+++ carob/test/40-Parameter-PreparedStatement/TestParameterStatement.hpp
Fri Jan 27 18:49:08 2006
@@ -73,6 +73,8 @@
void testExecuteWithUpdate();
void testBoolean();
+
+ void testStrings();
};
#endif /*TESTPARAMETERSTATEMENT_H_*/
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits