mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 00:07:59 +02:00
This commit is contained in:

committed by
Aleksandar Fabijanic

parent
15c076b3ea
commit
f8bacb47b5
@@ -497,6 +497,14 @@ void MySQLTest::testBLOBStmt()
|
||||
}
|
||||
|
||||
|
||||
void MySQLTest::testLongText()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
recreatePersonLongTextTable();
|
||||
_pExecutor->longText();
|
||||
}
|
||||
|
||||
void MySQLTest::testUnsignedInts()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
@@ -763,6 +771,13 @@ void MySQLTest::recreatePersonBLOBTable()
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail ("recreatePersonBLOBTable()"); }
|
||||
}
|
||||
|
||||
void MySQLTest::recreatePersonLongTextTable()
|
||||
{
|
||||
dropTable("Person");
|
||||
try { *_pSession << "CREATE TABLE Person (LastName VARCHAR(30), FirstName VARCHAR(30), Address VARCHAR(30), Info LONGTEXT)", now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail ("recreatePersonBLOBTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail ("recreatePersonBLOBTable()"); }
|
||||
}
|
||||
|
||||
void MySQLTest::recreatePersonDateTimeTable()
|
||||
{
|
||||
@@ -957,6 +972,7 @@ CppUnit::Test* MySQLTest::suite()
|
||||
CppUnit_addTest(pSuite, MySQLTest, testDateTime);
|
||||
//CppUnit_addTest(pSuite, MySQLTest, testBLOB);
|
||||
CppUnit_addTest(pSuite, MySQLTest, testBLOBStmt);
|
||||
CppUnit_addTest(pSuite, MySQLTest, testLongText);
|
||||
CppUnit_addTest(pSuite, MySQLTest, testUnsignedInts);
|
||||
CppUnit_addTest(pSuite, MySQLTest, testFloat);
|
||||
CppUnit_addTest(pSuite, MySQLTest, testDouble);
|
||||
|
@@ -81,6 +81,7 @@ public:
|
||||
void testDateTime();
|
||||
void testBLOB();
|
||||
void testBLOBStmt();
|
||||
void testLongText();
|
||||
|
||||
void testUnsignedInts();
|
||||
void testFloat();
|
||||
@@ -121,6 +122,7 @@ private:
|
||||
void dropTable(const std::string& tableName);
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonLongTextTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreatePersonDateTable();
|
||||
void recreatePersonTimeTable();
|
||||
|
@@ -1429,6 +1429,33 @@ void SQLExecutor::blobStmt()
|
||||
poco_assert (res == blob);
|
||||
}
|
||||
|
||||
void SQLExecutor::longText()
|
||||
{
|
||||
std::string funct = "longText()";
|
||||
std::string lastName("lastname");
|
||||
std::string firstName("firstname");
|
||||
std::string address("Address");
|
||||
std::string info("0123456789");
|
||||
|
||||
Poco::Data::CLOB img("0123456789", 10);
|
||||
int count = 0;
|
||||
try { *_pSession << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(info), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
|
||||
try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
assert (count == 1);
|
||||
|
||||
std::string res;
|
||||
poco_assert (res.size() == 0);
|
||||
Statement stmt = (*_pSession << "SELECT Info FROM Person", into(res));
|
||||
try { stmt.execute(); }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
poco_assert (res == info);
|
||||
}
|
||||
|
||||
void SQLExecutor::tuples()
|
||||
{
|
||||
|
@@ -82,6 +82,7 @@ public:
|
||||
|
||||
void blob(unsigned int bigSize = ~0);
|
||||
void blobStmt();
|
||||
void longText();
|
||||
void dateTime();
|
||||
void date();
|
||||
void time();
|
||||
|
Reference in New Issue
Block a user