mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
GH #192: Unsigned integer values not handled properly in result sets
This commit is contained in:
@@ -471,6 +471,15 @@ void MySQLTest::testBLOBStmt()
|
||||
}
|
||||
|
||||
|
||||
void MySQLTest::testUnsignedInts()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
recreateUnsignedIntsTable();
|
||||
_pExecutor->unsignedInts();
|
||||
}
|
||||
|
||||
|
||||
void MySQLTest::testFloat()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
@@ -755,6 +764,15 @@ void MySQLTest::recreateStringsTable()
|
||||
}
|
||||
|
||||
|
||||
void MySQLTest::recreateUnsignedIntsTable()
|
||||
{
|
||||
dropTable("Strings");
|
||||
try { *_pSession << "CREATE TABLE Strings (str INTEGER UNSIGNED)", now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail ("recreateUnsignedIntegersTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail ("recreateUnsignedIntegersTable()"); }
|
||||
}
|
||||
|
||||
|
||||
void MySQLTest::recreateFloatsTable()
|
||||
{
|
||||
dropTable("Strings");
|
||||
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
void testBLOB();
|
||||
void testBLOBStmt();
|
||||
|
||||
void testUnsignedInts();
|
||||
void testFloat();
|
||||
void testDouble();
|
||||
|
||||
@@ -134,6 +135,7 @@ private:
|
||||
void recreatePersonTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateUnsignedIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
|
||||
@@ -497,6 +497,29 @@ void SQLExecutor::insertSingleBulk()
|
||||
}
|
||||
|
||||
|
||||
void SQLExecutor::unsignedInts()
|
||||
{
|
||||
std::string funct = "unsignedInts()";
|
||||
unsigned int data = UINT32_MAX;
|
||||
unsigned int ret = 0;
|
||||
|
||||
try { *_pSession << "INSERT INTO Strings VALUES (?)", use(data), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
|
||||
int count = 0;
|
||||
try { *_pSession << "SELECT COUNT(*) FROM Strings", 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);
|
||||
|
||||
try { *_pSession << "SELECT str FROM Strings", into(ret), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
|
||||
assert (ret == data);
|
||||
}
|
||||
|
||||
|
||||
void SQLExecutor::floats()
|
||||
{
|
||||
std::string funct = "floats()";
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
void dateTime();
|
||||
void date();
|
||||
void time();
|
||||
void unsignedInts();
|
||||
void floats();
|
||||
void doubles();
|
||||
void tuples();
|
||||
|
||||
Reference in New Issue
Block a user