MySQL DateTime support, samples Linux compile

This commit is contained in:
aleks-f
2012-12-14 19:48:10 -06:00
parent 245dc64c7e
commit 2a81e59e8c
19 changed files with 6905 additions and 14 deletions

View File

@@ -64,7 +64,7 @@ Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = 0;
// Parameters for barebone-test
#define MYSQL_USER "root"
#define MYSQL_PWD "poco"
#define MYSQL_HOST "localhost"
#define MYSQL_HOST "192.168.1.33"
#define MYSQL_PORT 3306
#define MYSQL_DB "test"
@@ -417,6 +417,15 @@ void MySQLTest::testEmptyDB()
}
void MySQLTest::testDateTime()
{
if (!_pSession) fail ("Test not available.");
recreatePersonDateTimeTable();
_pExecutor->dateTime();
}
void MySQLTest::testBLOB()
{
if (!_pSession) fail ("Test not available.");
@@ -697,6 +706,15 @@ void MySQLTest::recreatePersonBLOBTable()
}
void MySQLTest::recreatePersonDateTimeTable()
{
dropTable("Person");
try { *_pSession << "CREATE TABLE Person (LastName VARCHAR(30), FirstName VARCHAR(30), Address VARCHAR(30), Birthday DATETIME)", now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail ("recreatePersonDateTimeTable()"); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail ("recreatePersonDateTimeTable()"); }
}
void MySQLTest::recreateIntsTable()
{
dropTable("Strings");
@@ -833,6 +851,7 @@ CppUnit::Test* MySQLTest::suite()
CppUnit_addTest(pSuite, MySQLTest, testIllegalRange);
CppUnit_addTest(pSuite, MySQLTest, testSingleSelect);
CppUnit_addTest(pSuite, MySQLTest, testEmptyDB);
CppUnit_addTest(pSuite, MySQLTest, testDateTime);
//CppUnit_addTest(pSuite, MySQLTest, testBLOB);
CppUnit_addTest(pSuite, MySQLTest, testBLOBStmt);
CppUnit_addTest(pSuite, MySQLTest, testFloat);