mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-13 14:45:36 +02:00
eliminate some gcc warnings, move register/unregister to be called only once
This commit is contained in:
@@ -71,15 +71,16 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::Connector::registerConnector();
|
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
Utility::dataSources(_dataSources);
|
Utility::dataSources(_dataSources);
|
||||||
checkODBCSetup();
|
checkODBCSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
||||||
{
|
{
|
||||||
|
ODBC::Connector::registerConnector();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
@@ -91,7 +92,8 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
|||||||
|
|
||||||
if (_pSession && _pSession->isConnected())
|
if (_pSession && _pSession->isConnected())
|
||||||
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
||||||
if (!_pExecutor) _pExecutor = new SQLExecutor("DB2 SQL Executor", _pSession);
|
if (!_pExecutor)
|
||||||
|
_pExecutor = new SQLExecutor("DB2 SQL Executor", _pSession);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!_pSession && !beenHere)
|
if (!_pSession && !beenHere)
|
||||||
@@ -103,7 +105,6 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
|||||||
|
|
||||||
ODBCDB2Test::~ODBCDB2Test()
|
ODBCDB2Test::~ODBCDB2Test()
|
||||||
{
|
{
|
||||||
ODBC::Connector::unregisterConnector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -71,15 +71,16 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::Connector::registerConnector();
|
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
Utility::dataSources(_dataSources);
|
Utility::dataSources(_dataSources);
|
||||||
checkODBCSetup();
|
checkODBCSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
||||||
{
|
{
|
||||||
|
ODBC::Connector::registerConnector();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
@@ -91,7 +92,8 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
|||||||
|
|
||||||
if (_pSession && _pSession->isConnected())
|
if (_pSession && _pSession->isConnected())
|
||||||
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
||||||
if (!_pExecutor) _pExecutor = new SQLExecutor("MySQL SQL Executor", _pSession);
|
if (!_pExecutor)
|
||||||
|
_pExecutor = new SQLExecutor("MySQL SQL Executor", _pSession);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!_pSession && !beenHere)
|
if (!_pSession && !beenHere)
|
||||||
@@ -103,7 +105,6 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCMySQLTest::~ODBCMySQLTest()
|
ODBCMySQLTest::~ODBCMySQLTest()
|
||||||
{
|
{
|
||||||
ODBC::Connector::unregisterConnector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -71,15 +71,16 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::Connector::registerConnector();
|
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
Utility::dataSources(_dataSources);
|
Utility::dataSources(_dataSources);
|
||||||
checkODBCSetup();
|
checkODBCSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
||||||
{
|
{
|
||||||
|
ODBC::Connector::registerConnector();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
@@ -91,7 +92,8 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
|||||||
|
|
||||||
if (_pSession && _pSession->isConnected())
|
if (_pSession && _pSession->isConnected())
|
||||||
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
||||||
if (!_pExecutor) _pExecutor = new SQLExecutor("Oracle SQL Executor", _pSession);
|
if (!_pExecutor)
|
||||||
|
_pExecutor = new SQLExecutor("Oracle SQL Executor", _pSession);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!_pSession && !beenHere)
|
if (!_pSession && !beenHere)
|
||||||
@@ -103,7 +105,6 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCOracleTest::~ODBCOracleTest()
|
ODBCOracleTest::~ODBCOracleTest()
|
||||||
{
|
{
|
||||||
ODBC::Connector::unregisterConnector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -71,15 +71,16 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::Connector::registerConnector();
|
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
Utility::dataSources(_dataSources);
|
Utility::dataSources(_dataSources);
|
||||||
checkODBCSetup();
|
checkODBCSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
||||||
{
|
{
|
||||||
|
ODBC::Connector::registerConnector();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
@@ -91,7 +92,8 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
|||||||
|
|
||||||
if (_pSession && _pSession->isConnected())
|
if (_pSession && _pSession->isConnected())
|
||||||
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
||||||
if (!_pExecutor) _pExecutor = new SQLExecutor("PostgreSQL SQL Executor", _pSession);
|
if (!_pExecutor)
|
||||||
|
_pExecutor = new SQLExecutor("PostgreSQL SQL Executor", _pSession);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!_pSession && !beenHere)
|
if (!_pSession && !beenHere)
|
||||||
@@ -103,7 +105,6 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCPostgreSQLTest::~ODBCPostgreSQLTest()
|
ODBCPostgreSQLTest::~ODBCPostgreSQLTest()
|
||||||
{
|
{
|
||||||
ODBC::Connector::unregisterConnector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -130,12 +131,6 @@ void ODBCPostgreSQLTest::testSimpleAccess()
|
|||||||
if (!_pSession) fail ("Test not available.");
|
if (!_pSession) fail ("Test not available.");
|
||||||
|
|
||||||
std::string tableName("Person");
|
std::string tableName("Person");
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
recreatePersonTable();
|
|
||||||
|
|
||||||
//*_pSession << "SELECT count(*) FROM sys.all_all_tables WHERE table_name = upper(?)", into(count), use(tableName), now;
|
|
||||||
//assert (1 == count);
|
|
||||||
|
|
||||||
for (int i = 0; i < 8;)
|
for (int i = 0; i < 8;)
|
||||||
{
|
{
|
||||||
@@ -861,16 +856,18 @@ void ODBCPostgreSQLTest::checkODBCSetup()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (!dsnFound)
|
if (!dsnFound)
|
||||||
{
|
{
|
||||||
std::cout << "PostgreSQL DSN NOT found, tests will fail." << std::endl;
|
std::cout << "PostgreSQL DSN NOT found, tests will fail." << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pSession)
|
if (!_pSession)
|
||||||
format(_dbConnString, "DSN=%s;", _dsn);
|
_dbConnString = "DRIVER={PostgreSQL ANSI};UID=postgres;PWD=postgres;SERVER=a-fabijanic.nucorsteel.com;Port=5432;Database=postgres";
|
||||||
|
//format(_dbConnString, "DSN=%s;", _dsn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -71,15 +71,16 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::Connector::registerConnector();
|
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
Utility::dataSources(_dataSources);
|
Utility::dataSources(_dataSources);
|
||||||
checkODBCSetup();
|
checkODBCSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
||||||
{
|
{
|
||||||
|
ODBC::Connector::registerConnector();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
@@ -91,7 +92,9 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
|||||||
|
|
||||||
if (_pSession && _pSession->isConnected())
|
if (_pSession && _pSession->isConnected())
|
||||||
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
|
||||||
if (!_pExecutor) _pExecutor = new SQLExecutor("SQLServer SQL Executor", _pSession);
|
if (!_pExecutor)
|
||||||
|
_pExecutor = new SQLExecutor("SQLServer SQL Executor", _pSession);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!_pSession && !beenHere)
|
if (!_pSession && !beenHere)
|
||||||
@@ -103,7 +106,6 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCSQLServerTest::~ODBCSQLServerTest()
|
ODBCSQLServerTest::~ODBCSQLServerTest()
|
||||||
{
|
{
|
||||||
ODBC::Connector::unregisterConnector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -69,14 +69,15 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::Connector::registerConnector();
|
|
||||||
if (_drivers.empty())
|
if (_drivers.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
checkODBCSetup();
|
checkODBCSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
if (!_pSession && !_dbConnString.empty() && !beenHere)
|
||||||
{
|
{
|
||||||
|
ODBC::Connector::registerConnector();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
@@ -88,7 +89,8 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
|||||||
|
|
||||||
if (_pSession && _pSession->isConnected())
|
if (_pSession && _pSession->isConnected())
|
||||||
std::cout << "*** Connected to " << _dbConnString << std::endl;
|
std::cout << "*** Connected to " << _dbConnString << std::endl;
|
||||||
if (!_pExecutor) _pExecutor = new SQLExecutor("SQLite SQL Executor", _pSession);
|
if (!_pExecutor)
|
||||||
|
_pExecutor = new SQLExecutor("SQLite SQL Executor", _pSession);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!_pSession && !beenHere)
|
if (!_pSession && !beenHere)
|
||||||
@@ -100,7 +102,6 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCSQLiteTest::~ODBCSQLiteTest()
|
ODBCSQLiteTest::~ODBCSQLiteTest()
|
||||||
{
|
{
|
||||||
ODBC::Connector::unregisterConnector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -169,6 +169,7 @@ SQLExecutor::SQLExecutor(const std::string& name, Poco::Data::Session* pSession)
|
|||||||
|
|
||||||
SQLExecutor::~SQLExecutor()
|
SQLExecutor::~SQLExecutor()
|
||||||
{
|
{
|
||||||
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -231,7 +232,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
|||||||
float fifth = 1.5;
|
float fifth = 1.5;
|
||||||
SQLLEN li = SQL_NTS;
|
SQLLEN li = SQL_NTS;
|
||||||
SQLINTEGER size = (SQLINTEGER) str[0].size();
|
SQLINTEGER size = (SQLINTEGER) str[0].size();
|
||||||
|
|
||||||
if (SQLExecutor::PB_AT_EXEC == bindMode)
|
if (SQLExecutor::PB_AT_EXEC == bindMode)
|
||||||
li = SQL_LEN_DATA_AT_EXEC(size);
|
li = SQL_LEN_DATA_AT_EXEC(size);
|
||||||
|
|
||||||
@@ -275,7 +276,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
|||||||
SQL_LONGVARBINARY,
|
SQL_LONGVARBINARY,
|
||||||
(SQLUINTEGER) size,
|
(SQLUINTEGER) size,
|
||||||
0,
|
0,
|
||||||
(SQLPOINTER) str[2].c_str(),
|
(SQLPOINTER) str[2].data(),
|
||||||
size,
|
size,
|
||||||
&li);
|
&li);
|
||||||
assert (SQL_SUCCEEDED(rc));
|
assert (SQL_SUCCEEDED(rc));
|
||||||
@@ -338,7 +339,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
|||||||
rc = SQLPrepare(hstmt, pStr, (SQLINTEGER) sql.length());
|
rc = SQLPrepare(hstmt, pStr, (SQLINTEGER) sql.length());
|
||||||
assert (SQL_SUCCEEDED(rc));
|
assert (SQL_SUCCEEDED(rc));
|
||||||
|
|
||||||
char chr[3][5] = { 0 };
|
char chr[3][5] = {{ 0 }};
|
||||||
SQLLEN lengths[5] = { 0 };
|
SQLLEN lengths[5] = { 0 };
|
||||||
fourth = 0;
|
fourth = 0;
|
||||||
fifth = 0.0f;
|
fifth = 0.0f;
|
||||||
@@ -460,6 +461,8 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
|||||||
// Environment end
|
// Environment end
|
||||||
rc = SQLFreeHandle(SQL_HANDLE_ENV, henv);
|
rc = SQLFreeHandle(SQL_HANDLE_ENV, henv);
|
||||||
assert (SQL_SUCCEEDED(rc));
|
assert (SQL_SUCCEEDED(rc));
|
||||||
|
|
||||||
|
std::cout << "barebone end" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -629,7 +632,6 @@ void SQLExecutor::insertEmptyVector()
|
|||||||
{
|
{
|
||||||
std::string funct = "insertEmptyVector()";
|
std::string funct = "insertEmptyVector()";
|
||||||
std::vector<std::string> str;
|
std::vector<std::string> str;
|
||||||
int count = 100;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -749,7 +751,6 @@ void SQLExecutor::limits()
|
|||||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
std::vector<int> retData;
|
std::vector<int> retData;
|
||||||
try { *_pSession << "SELECT * FROM Strings", into(retData), limit(50), now; }
|
try { *_pSession << "SELECT * FROM Strings", into(retData), limit(50), now; }
|
||||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||||
@@ -775,7 +776,6 @@ void SQLExecutor::limitZero()
|
|||||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
std::vector<int> retData;
|
std::vector<int> retData;
|
||||||
try { *_pSession << "SELECT * FROM Strings", into(retData), limit(0), now; }// stupid test, but at least we shouldn't crash
|
try { *_pSession << "SELECT * FROM Strings", into(retData), limit(0), now; }// stupid test, but at least we shouldn't crash
|
||||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||||
@@ -797,7 +797,6 @@ void SQLExecutor::limitOnce()
|
|||||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
std::vector<int> retData;
|
std::vector<int> retData;
|
||||||
Statement stmt = (*_pSession << "SELECT * FROM Strings", into(retData), limit(50), now);
|
Statement stmt = (*_pSession << "SELECT * FROM Strings", into(retData), limit(50), now);
|
||||||
assert (!stmt.done());
|
assert (!stmt.done());
|
||||||
@@ -829,7 +828,6 @@ void SQLExecutor::limitPrepare()
|
|||||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
std::vector<int> retData;
|
std::vector<int> retData;
|
||||||
Statement stmt = (*_pSession << "SELECT * FROM Strings", into(retData), limit(50));
|
Statement stmt = (*_pSession << "SELECT * FROM Strings", into(retData), limit(50));
|
||||||
assert (retData.size() == 0);
|
assert (retData.size() == 0);
|
||||||
@@ -847,7 +845,7 @@ void SQLExecutor::limitPrepare()
|
|||||||
|
|
||||||
try { stmt.execute(); }// will restart execution!
|
try { stmt.execute(); }// will restart execution!
|
||||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||||
size_t s = retData.size();
|
|
||||||
assert (!stmt.done());
|
assert (!stmt.done());
|
||||||
assert (retData.size() == 150);
|
assert (retData.size() == 150);
|
||||||
for (int x = 0; x < 150; ++x)
|
for (int x = 0; x < 150; ++x)
|
||||||
@@ -1644,7 +1642,7 @@ void SQLExecutor::internalExtraction()
|
|||||||
s = rset.value("cnt", 0).convert<std::string>();
|
s = rset.value("cnt", 0).convert<std::string>();
|
||||||
assert ("4" == s);
|
assert ("4" == s);
|
||||||
|
|
||||||
try { const Column<int>& col1 = rset.column<int>(100); fail ("must fail"); }
|
try { rset.column<int>(100); fail ("must fail"); }
|
||||||
catch (RangeException&) { }
|
catch (RangeException&) { }
|
||||||
|
|
||||||
try { rset.value<std::string>(0,0); fail ("must fail"); }
|
try { rset.value<std::string>(0,0); fail ("must fail"); }
|
||||||
@@ -1653,7 +1651,7 @@ void SQLExecutor::internalExtraction()
|
|||||||
stmt = (*_pSession << "DELETE FROM Vectors", now);
|
stmt = (*_pSession << "DELETE FROM Vectors", now);
|
||||||
rset = stmt;
|
rset = stmt;
|
||||||
|
|
||||||
try { const Column<int>& col1 = rset.column<int>(0); fail ("must fail"); }
|
try { rset.column<int>(0); fail ("must fail"); }
|
||||||
catch (RangeException&) { }
|
catch (RangeException&) { }
|
||||||
}
|
}
|
||||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||||
|
Reference in New Issue
Block a user