mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-04 19:13:30 +01:00
- fixed bug in SQLite Extractor (DateTime extraction not returning false when value is NullPointerException, see http://pocoproject.org/forum/viewtopic.php?f=12&t=5141#p9363 )
- fixed code indentation (spaces to tabs)
This commit is contained in:
parent
0ca3bbc848
commit
dbda035719
@ -681,6 +681,7 @@ CppUnit::Test* ODBCDB2Test::suite()
|
|||||||
CppUnit_addTest(pSuite, ODBCDB2Test, testSessionTransaction);
|
CppUnit_addTest(pSuite, ODBCDB2Test, testSessionTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCDB2Test, testTransaction);
|
CppUnit_addTest(pSuite, ODBCDB2Test, testTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCDB2Test, testTransactor);
|
CppUnit_addTest(pSuite, ODBCDB2Test, testTransactor);
|
||||||
|
CppUnit_addTest(pSuite, ODBCDB2Test, testNullable);
|
||||||
CppUnit_addTest(pSuite, ODBCDB2Test, testReconnect);
|
CppUnit_addTest(pSuite, ODBCDB2Test, testReconnect);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
|
@ -497,6 +497,7 @@ CppUnit::Test* ODBCMySQLTest::suite()
|
|||||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testSessionTransaction);
|
CppUnit_addTest(pSuite, ODBCMySQLTest, testSessionTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testTransaction);
|
CppUnit_addTest(pSuite, ODBCMySQLTest, testTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testTransactor);
|
CppUnit_addTest(pSuite, ODBCMySQLTest, testTransactor);
|
||||||
|
CppUnit_addTest(pSuite, ODBCMySQLTest, testNullable);
|
||||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testReconnect);
|
CppUnit_addTest(pSuite, ODBCMySQLTest, testReconnect);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
|
@ -933,6 +933,7 @@ CppUnit::Test* ODBCOracleTest::suite()
|
|||||||
CppUnit_addTest(pSuite, ODBCOracleTest, testSessionTransaction);
|
CppUnit_addTest(pSuite, ODBCOracleTest, testSessionTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCOracleTest, testTransaction);
|
CppUnit_addTest(pSuite, ODBCOracleTest, testTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCOracleTest, testTransactor);
|
CppUnit_addTest(pSuite, ODBCOracleTest, testTransactor);
|
||||||
|
CppUnit_addTest(pSuite, ODBCOracleTest, testNullable);
|
||||||
CppUnit_addTest(pSuite, ODBCOracleTest, testReconnect);
|
CppUnit_addTest(pSuite, ODBCOracleTest, testReconnect);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
|
@ -659,6 +659,7 @@ CppUnit::Test* ODBCPostgreSQLTest::suite()
|
|||||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testSessionTransaction);
|
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testSessionTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransaction);
|
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransactor);
|
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransactor);
|
||||||
|
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testNullable);
|
||||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testReconnect);
|
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testReconnect);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
|
@ -809,6 +809,7 @@ CppUnit::Test* ODBCSQLServerTest::suite()
|
|||||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testSessionTransaction);
|
CppUnit_addTest(pSuite, ODBCSQLServerTest, testSessionTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testTransaction);
|
CppUnit_addTest(pSuite, ODBCSQLServerTest, testTransaction);
|
||||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testTransactor);
|
CppUnit_addTest(pSuite, ODBCSQLServerTest, testTransactor);
|
||||||
|
CppUnit_addTest(pSuite, ODBCSQLServerTest, testNullable);
|
||||||
CppUnit_addTest(pSuite, ODBCSQLServerTest, testReconnect);
|
CppUnit_addTest(pSuite, ODBCSQLServerTest, testReconnect);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
|
@ -1204,6 +1204,21 @@ void ODBCTest::testTransactor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ODBCTest::testNullable()
|
||||||
|
{
|
||||||
|
if (!_pSession) fail ("Test not available.");
|
||||||
|
|
||||||
|
for (int i = 0; i < 8;)
|
||||||
|
{
|
||||||
|
recreatePersonTable();
|
||||||
|
_pSession->setFeature("autoBind", bindValue(i));
|
||||||
|
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||||
|
_pExecutor->nullable();
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ODBCTest::testReconnect()
|
void ODBCTest::testReconnect()
|
||||||
{
|
{
|
||||||
if (!_pSession) fail ("Test not available.");
|
if (!_pSession) fail ("Test not available.");
|
||||||
|
@ -167,6 +167,7 @@ public:
|
|||||||
virtual void testSessionTransaction();
|
virtual void testSessionTransaction();
|
||||||
virtual void testTransaction();
|
virtual void testTransaction();
|
||||||
virtual void testTransactor();
|
virtual void testTransactor();
|
||||||
|
virtual void testNullable();
|
||||||
|
|
||||||
virtual void testReconnect();
|
virtual void testReconnect();
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ using Poco::Message;
|
|||||||
using Poco::NotFoundException;
|
using Poco::NotFoundException;
|
||||||
using Poco::InvalidAccessException;
|
using Poco::InvalidAccessException;
|
||||||
using Poco::InvalidArgumentException;
|
using Poco::InvalidArgumentException;
|
||||||
|
using Poco::NotImplementedException;
|
||||||
using Poco::BadCastException;
|
using Poco::BadCastException;
|
||||||
using Poco::RangeException;
|
using Poco::RangeException;
|
||||||
|
|
||||||
@ -3786,6 +3787,12 @@ void SQLExecutor::transactor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SQLExecutor::nullable()
|
||||||
|
{
|
||||||
|
throw NotImplementedException("TODO - see SQLite test for nullable");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SQLExecutor::reconnect()
|
void SQLExecutor::reconnect()
|
||||||
{
|
{
|
||||||
std::string funct = "reconnect()";
|
std::string funct = "reconnect()";
|
||||||
|
@ -518,6 +518,7 @@ public:
|
|||||||
void sessionTransaction(const std::string& connect);
|
void sessionTransaction(const std::string& connect);
|
||||||
void transaction(const std::string& connect);
|
void transaction(const std::string& connect);
|
||||||
void transactor();
|
void transactor();
|
||||||
|
void nullable();
|
||||||
|
|
||||||
void reconnect();
|
void reconnect();
|
||||||
|
|
||||||
|
@ -71,8 +71,7 @@ Extractor::~Extractor()
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
|
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -80,8 +79,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int32& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int64(_pStmt, (int) pos);
|
val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -90,8 +88,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
|||||||
#ifndef POCO_LONG_IS_64_BIT
|
#ifndef POCO_LONG_IS_64_BIT
|
||||||
bool Extractor::extract(std::size_t pos, long& val)
|
bool Extractor::extract(std::size_t pos, long& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -100,8 +97,7 @@ bool Extractor::extract(std::size_t pos, long& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, double& val)
|
bool Extractor::extract(std::size_t pos, double& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_double(_pStmt, (int) pos);
|
val = sqlite3_column_double(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -109,8 +105,7 @@ bool Extractor::extract(std::size_t pos, double& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, std::string& val)
|
bool Extractor::extract(std::size_t pos, std::string& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
const char *pBuf = reinterpret_cast<const char*>(sqlite3_column_text(_pStmt, (int) pos));
|
const char *pBuf = reinterpret_cast<const char*>(sqlite3_column_text(_pStmt, (int) pos));
|
||||||
if (!pBuf)
|
if (!pBuf)
|
||||||
val.clear();
|
val.clear();
|
||||||
@ -122,8 +117,7 @@ bool Extractor::extract(std::size_t pos, std::string& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
|
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -131,8 +125,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int8& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
|
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -140,8 +133,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
|
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -149,8 +141,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int16& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
|
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -158,8 +149,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
|
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -167,8 +157,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = sqlite3_column_int64(_pStmt, (int) pos);
|
val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -176,8 +165,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, bool& val)
|
bool Extractor::extract(std::size_t pos, bool& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = (0 != sqlite3_column_int(_pStmt, (int) pos));
|
val = (0 != sqlite3_column_int(_pStmt, (int) pos));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -185,8 +173,7 @@ bool Extractor::extract(std::size_t pos, bool& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, float& val)
|
bool Extractor::extract(std::size_t pos, float& val)
|
||||||
{
|
{
|
||||||
if (isNull(pos))
|
if (isNull(pos)) return false;
|
||||||
return false;
|
|
||||||
val = static_cast<float>(sqlite3_column_double(_pStmt, (int) pos));
|
val = static_cast<float>(sqlite3_column_double(_pStmt, (int) pos));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -202,6 +189,7 @@ bool Extractor::extract(std::size_t pos, char& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Date& val)
|
bool Extractor::extract(std::size_t pos, Date& val)
|
||||||
{
|
{
|
||||||
|
if (isNull(pos)) return false;
|
||||||
std::string str;
|
std::string str;
|
||||||
extract(pos, str);
|
extract(pos, str);
|
||||||
int tzd;
|
int tzd;
|
||||||
@ -213,6 +201,7 @@ bool Extractor::extract(std::size_t pos, Date& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, Time& val)
|
bool Extractor::extract(std::size_t pos, Time& val)
|
||||||
{
|
{
|
||||||
|
if (isNull(pos)) return false;
|
||||||
std::string str;
|
std::string str;
|
||||||
extract(pos, str);
|
extract(pos, str);
|
||||||
int tzd;
|
int tzd;
|
||||||
@ -224,6 +213,7 @@ bool Extractor::extract(std::size_t pos, Time& val)
|
|||||||
|
|
||||||
bool Extractor::extract(std::size_t pos, DateTime& val)
|
bool Extractor::extract(std::size_t pos, DateTime& val)
|
||||||
{
|
{
|
||||||
|
if (isNull(pos)) return false;
|
||||||
std::string dt;
|
std::string dt;
|
||||||
extract(pos, dt);
|
extract(pos, dt);
|
||||||
int tzd;
|
int tzd;
|
||||||
|
Binary file not shown.
@ -44,6 +44,7 @@
|
|||||||
#include "Poco/Data/SQLite/Utility.h"
|
#include "Poco/Data/SQLite/Utility.h"
|
||||||
#include "Poco/Data/SQLite/SQLiteException.h"
|
#include "Poco/Data/SQLite/SQLiteException.h"
|
||||||
#include "Poco/Data/TypeHandler.h"
|
#include "Poco/Data/TypeHandler.h"
|
||||||
|
#include "Poco/Data/Nullable.h"
|
||||||
#include "Poco/Data/DataException.h"
|
#include "Poco/Data/DataException.h"
|
||||||
#include "Poco/Tuple.h"
|
#include "Poco/Tuple.h"
|
||||||
#include "Poco/Any.h"
|
#include "Poco/Any.h"
|
||||||
@ -73,6 +74,7 @@ using Poco::Data::Time;
|
|||||||
using Poco::Data::AbstractExtractionVec;
|
using Poco::Data::AbstractExtractionVec;
|
||||||
using Poco::Data::AbstractExtractionVecVec;
|
using Poco::Data::AbstractExtractionVecVec;
|
||||||
using Poco::Data::AbstractBindingVec;
|
using Poco::Data::AbstractBindingVec;
|
||||||
|
using Poco::Data::Nullable;
|
||||||
using Poco::Data::NotConnectedException;
|
using Poco::Data::NotConnectedException;
|
||||||
using Poco::Tuple;
|
using Poco::Tuple;
|
||||||
using Poco::Any;
|
using Poco::Any;
|
||||||
@ -1958,6 +1960,42 @@ void SQLiteTest::testPrimaryKeyConstraint()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SQLiteTest::testNullable()
|
||||||
|
{
|
||||||
|
Session ses (Poco::Data::SQLite::Connector::KEY, "dummy.db");
|
||||||
|
ses << "DROP TABLE IF EXISTS NullableTest", now;
|
||||||
|
|
||||||
|
ses << "CREATE TABLE NullableTest (i INTEGER, r REAL, s VARCHAR, d DATETIME)", now;
|
||||||
|
|
||||||
|
ses << "INSERT INTO NullableTest VALUES(:i, :r, :s, :d)", use(null), use(null), use(null), use(null), now;
|
||||||
|
|
||||||
|
Nullable<int> i = 1;
|
||||||
|
Nullable<double> f = 1.5;
|
||||||
|
Nullable<std::string> s = "abc";
|
||||||
|
Nullable<DateTime> d = DateTime();
|
||||||
|
|
||||||
|
assert (!i.isNull());
|
||||||
|
assert (!f.isNull());
|
||||||
|
assert (!s.isNull());
|
||||||
|
assert (!d.isNull());
|
||||||
|
|
||||||
|
ses << "SELECT i, r, s FROM NullableTest", into(i), into(f), into(s), into(d), now;
|
||||||
|
|
||||||
|
assert (i.isNull());
|
||||||
|
assert (f.isNull());
|
||||||
|
assert (s.isNull());
|
||||||
|
assert (d.isNull());
|
||||||
|
|
||||||
|
RecordSet rs(ses, "SELECT * FROM NullableTest");
|
||||||
|
|
||||||
|
rs.moveFirst();
|
||||||
|
assert (rs.isNull("i"));
|
||||||
|
assert (rs.isNull("r"));
|
||||||
|
assert (rs.isNull("s"));
|
||||||
|
assert (rs.isNull("d"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SQLiteTest::testNull()
|
void SQLiteTest::testNull()
|
||||||
{
|
{
|
||||||
Session ses (Poco::Data::SQLite::Connector::KEY, "dummy.db");
|
Session ses (Poco::Data::SQLite::Connector::KEY, "dummy.db");
|
||||||
@ -2564,6 +2602,7 @@ CppUnit::Test* SQLiteTest::suite()
|
|||||||
CppUnit_addTest(pSuite, SQLiteTest, testDateTime);
|
CppUnit_addTest(pSuite, SQLiteTest, testDateTime);
|
||||||
CppUnit_addTest(pSuite, SQLiteTest, testInternalExtraction);
|
CppUnit_addTest(pSuite, SQLiteTest, testInternalExtraction);
|
||||||
CppUnit_addTest(pSuite, SQLiteTest, testPrimaryKeyConstraint);
|
CppUnit_addTest(pSuite, SQLiteTest, testPrimaryKeyConstraint);
|
||||||
|
CppUnit_addTest(pSuite, SQLiteTest, testNullable);
|
||||||
CppUnit_addTest(pSuite, SQLiteTest, testNull);
|
CppUnit_addTest(pSuite, SQLiteTest, testNull);
|
||||||
CppUnit_addTest(pSuite, SQLiteTest, testRowIterator);
|
CppUnit_addTest(pSuite, SQLiteTest, testRowIterator);
|
||||||
CppUnit_addTest(pSuite, SQLiteTest, testAsync);
|
CppUnit_addTest(pSuite, SQLiteTest, testAsync);
|
||||||
|
@ -115,6 +115,7 @@ public:
|
|||||||
|
|
||||||
void testInternalExtraction();
|
void testInternalExtraction();
|
||||||
void testPrimaryKeyConstraint();
|
void testPrimaryKeyConstraint();
|
||||||
|
void testNullable();
|
||||||
void testNull();
|
void testNull();
|
||||||
void testRowIterator();
|
void testRowIterator();
|
||||||
void testAsync();
|
void testAsync();
|
||||||
|
@ -146,7 +146,7 @@ public:
|
|||||||
return _isNull;
|
return _isNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNull(bool isNull)
|
void setNull(bool isNull = true)
|
||||||
/// Change Nullable "isNull" sign
|
/// Change Nullable "isNull" sign
|
||||||
{
|
{
|
||||||
_isNull = isNull;
|
_isNull = isNull;
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "Poco/Dynamic/Var.h"
|
#include "Poco/Dynamic/Var.h"
|
||||||
#include "Poco/Data/DynamicLOB.h"
|
#include "Poco/Data/DynamicLOB.h"
|
||||||
#include "Poco/Data/DynamicDateTime.h"
|
#include "Poco/Data/DynamicDateTime.h"
|
||||||
|
#include "Poco/Data/Nullable.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -92,6 +93,7 @@ using Poco::Data::AbstractExtractionVec;
|
|||||||
using Poco::Data::AbstractExtractionVecVec;
|
using Poco::Data::AbstractExtractionVecVec;
|
||||||
using Poco::Data::AbstractBinding;
|
using Poco::Data::AbstractBinding;
|
||||||
using Poco::Data::AbstractBindingVec;
|
using Poco::Data::AbstractBindingVec;
|
||||||
|
using Poco::Data::Nullable;
|
||||||
using Poco::Data::NotConnectedException;
|
using Poco::Data::NotConnectedException;
|
||||||
|
|
||||||
|
|
||||||
@ -1385,6 +1387,38 @@ void DataTest::testExternalBindingAndExtraction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DataTest::testNullable()
|
||||||
|
{
|
||||||
|
Nullable<int> i;
|
||||||
|
Nullable<double> f;
|
||||||
|
Nullable<std::string> s;
|
||||||
|
|
||||||
|
assert (i.isNull());
|
||||||
|
assert (f.isNull());
|
||||||
|
assert (s.isNull());
|
||||||
|
|
||||||
|
i = 1;
|
||||||
|
f = 1.5;
|
||||||
|
s = "abc";
|
||||||
|
|
||||||
|
assert (!i.isNull());
|
||||||
|
assert (!f.isNull());
|
||||||
|
assert (!s.isNull());
|
||||||
|
|
||||||
|
assert (i == 1);
|
||||||
|
assert (f == 1.5);
|
||||||
|
assert (s == "abc");
|
||||||
|
|
||||||
|
i.setNull();
|
||||||
|
f.setNull();
|
||||||
|
s.setNull();
|
||||||
|
|
||||||
|
assert (i.isNull());
|
||||||
|
assert (f.isNull());
|
||||||
|
assert (s.isNull());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DataTest::setUp()
|
void DataTest::setUp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1415,6 +1449,7 @@ CppUnit::Test* DataTest::suite()
|
|||||||
CppUnit_addTest(pSuite, DataTest, testRowFormat);
|
CppUnit_addTest(pSuite, DataTest, testRowFormat);
|
||||||
CppUnit_addTest(pSuite, DataTest, testDateAndTime);
|
CppUnit_addTest(pSuite, DataTest, testDateAndTime);
|
||||||
CppUnit_addTest(pSuite, DataTest, testExternalBindingAndExtraction);
|
CppUnit_addTest(pSuite, DataTest, testExternalBindingAndExtraction);
|
||||||
|
CppUnit_addTest(pSuite, DataTest, testNullable);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
void testRowFormat();
|
void testRowFormat();
|
||||||
void testDateAndTime();
|
void testDateAndTime();
|
||||||
void testExternalBindingAndExtraction();
|
void testExternalBindingAndExtraction();
|
||||||
|
void testNullable();
|
||||||
|
|
||||||
void setUp();
|
void setUp();
|
||||||
void tearDown();
|
void tearDown();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user