mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-09 14:13:30 +02:00
some renaming and clean-up
This commit is contained in:
@@ -221,7 +221,7 @@
|
||||
RelativePath=".\include\Poco\Data\SessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionInstantiator.h">
|
||||
RelativePath=".\include\Poco\Data\Connector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Statement.h">
|
||||
@@ -288,7 +288,7 @@
|
||||
RelativePath=".\src\SessionImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp">
|
||||
RelativePath=".\src\Connector.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Statement.cpp">
|
||||
|
@@ -257,6 +257,10 @@
|
||||
RelativePath=".\include\Poco\Data\Common.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Connector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Data.h"
|
||||
>
|
||||
@@ -301,10 +305,6 @@
|
||||
RelativePath=".\include\Poco\Data\SessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionInstantiator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Statement.h"
|
||||
>
|
||||
@@ -357,6 +357,10 @@
|
||||
RelativePath=".\src\BLOBStream.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DataException.cpp"
|
||||
>
|
||||
@@ -389,10 +393,6 @@
|
||||
RelativePath=".\src\SessionImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Statement.cpp"
|
||||
>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/Main/Data/Makefile#10 $
|
||||
# $Id: //poco/Main/Data/Makefile#11 $
|
||||
#
|
||||
# Makefile for Poco Data
|
||||
#
|
||||
@@ -13,7 +13,7 @@ objects = AbstractBinder AbstractBinding AbstractExtraction \
|
||||
BLOB BLOBStream DataException Limit MetaColumn \
|
||||
PooledSessionHolder PooledSessionImpl \
|
||||
Range RecordSet Session SessionFactory SessionImpl \
|
||||
SessionInstantiator SessionPool Statement StatementCreator StatementImpl
|
||||
Connector SessionPool Statement StatementCreator StatementImpl
|
||||
|
||||
target = PocoData
|
||||
target_version = $(LIBVERSION)
|
||||
|
@@ -16,7 +16,7 @@ endif
|
||||
|
||||
objects = Binder ConnectionHandle DataTypes EnvironmentHandle \
|
||||
Extractor ODBCColumn ODBCException ODBCStatementImpl Parameter Preparation \
|
||||
SessionImpl SessionInstantiator Utility
|
||||
SessionImpl Connector Utility
|
||||
|
||||
target = PocoODBC
|
||||
target_version = $(LIBVERSION)
|
||||
|
@@ -154,6 +154,9 @@
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ConnectionHandle.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Connector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\DataTypes.h">
|
||||
</File>
|
||||
@@ -193,9 +196,6 @@
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\SessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\SessionInstantiator.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Utility.h">
|
||||
</File>
|
||||
@@ -209,6 +209,9 @@
|
||||
<File
|
||||
RelativePath=".\src\ConnectionHandle.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DataTypes.cpp">
|
||||
</File>
|
||||
@@ -236,9 +239,6 @@
|
||||
<File
|
||||
RelativePath=".\src\SessionImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Utility.cpp">
|
||||
</File>
|
||||
|
@@ -217,6 +217,10 @@
|
||||
RelativePath=".\include\Poco\Data\ODBC\ConnectionHandle.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Connector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\DataTypes.h"
|
||||
>
|
||||
@@ -269,10 +273,6 @@
|
||||
RelativePath=".\include\Poco\Data\ODBC\SessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\SessionInstantiator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Utility.h"
|
||||
>
|
||||
@@ -289,6 +289,10 @@
|
||||
RelativePath=".\src\ConnectionHandle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DataTypes.cpp"
|
||||
>
|
||||
@@ -325,10 +329,6 @@
|
||||
RelativePath=".\src\SessionImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Utility.cpp"
|
||||
>
|
||||
|
@@ -1,13 +1,13 @@
|
||||
//
|
||||
// SessionInstantiator.h
|
||||
// Connector.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/include/Poco/Data/ODBC/SessionInstantiator.h#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/include/Poco/Data/ODBC/Connector.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: SessionInstantiator
|
||||
// Module: Connector
|
||||
//
|
||||
// Definition of the SessionInstantiator class.
|
||||
// Definition of the Connector class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -36,12 +36,12 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_ODBC_SessionInstantiator_INCLUDED
|
||||
#define DataConnectors_ODBC_SessionInstantiator_INCLUDED
|
||||
#ifndef DataConnectors_ODBC_Connector_INCLUDED
|
||||
#define DataConnectors_ODBC_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/SessionInstantiator.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -49,31 +49,31 @@ namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API SessionInstantiator: public Poco::Data::SessionInstantiator
|
||||
/// SessionInstantiator instantiates SqLite SessionImpl objects.
|
||||
class ODBC_API Connector: public Poco::Data::Connector
|
||||
/// Connector instantiates SqLite SessionImpl objects.
|
||||
{
|
||||
public:
|
||||
static const std::string KEY;
|
||||
/// Keyword for creating ODBC sessions
|
||||
|
||||
SessionInstantiator();
|
||||
/// Creates the SessionInstantiator.
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
~SessionInstantiator();
|
||||
/// Destroys the SessionInstantiator.
|
||||
~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> create(const std::string& initString);
|
||||
/// Creates a ODBC SessionImpl object and initializes it with the given initString.
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||
/// Creates a ODBC SessionImpl object and initializes it with the given connectionString.
|
||||
|
||||
static void addToFactory();
|
||||
/// Registers the SessionInstantiator under the Keyword SessionInstantiator::KEY at the Poco::Data::SessionFactory
|
||||
static void registerConnector();
|
||||
/// Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
|
||||
static void removeFromFactory();
|
||||
/// Unregisters the SessionInstantiator under the Keyword SessionInstantiator::KEY at the Poco::Data::SessionFactory
|
||||
static void unregisterConnector();
|
||||
/// Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // DataConnectors_ODBC_SessionInstantiator_INCLUDED
|
||||
#endif // DataConnectors_ODBC_Connector_INCLUDED
|
@@ -1,11 +1,11 @@
|
||||
//
|
||||
// SessionInstantiator.cpp
|
||||
// Connector.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/src/SessionInstantiator.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/src/Connector.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: SessionInstantiator
|
||||
// Module: Connector
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,7 +34,7 @@
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/SessionImpl.h"
|
||||
#include "Poco/Data/SessionFactory.h"
|
||||
|
||||
@@ -44,32 +44,32 @@ namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
const std::string SessionInstantiator::KEY("ODBC");
|
||||
const std::string Connector::KEY("ODBC");
|
||||
|
||||
|
||||
SessionInstantiator::SessionInstantiator()
|
||||
Connector::Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SessionInstantiator::~SessionInstantiator()
|
||||
Connector::~Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> SessionInstantiator::create(const std::string& initString)
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> Connector::createSession(const std::string& connectionString)
|
||||
{
|
||||
return Poco::AutoPtr<Poco::Data::SessionImpl>(new SessionImpl(initString));
|
||||
return Poco::AutoPtr<Poco::Data::SessionImpl>(new SessionImpl(connectionString));
|
||||
}
|
||||
|
||||
|
||||
void SessionInstantiator::addToFactory()
|
||||
void Connector::registerConnector()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().add(KEY, new SessionInstantiator());
|
||||
Poco::Data::SessionFactory::instance().add(KEY, new Connector());
|
||||
}
|
||||
|
||||
|
||||
void SessionInstantiator::removeFromFactory()
|
||||
void Connector::unregisterConnector()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().remove(KEY);
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCAccessTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCAccessTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCAccessTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
@@ -69,7 +69,7 @@ ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
||||
{
|
||||
static bool beenHere = false;
|
||||
|
||||
ODBC::SessionInstantiator::addToFactory();
|
||||
ODBC::Connector::registerConnector();
|
||||
if (_drivers.empty() || _dataSources.empty())
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
@@ -80,7 +80,7 @@ ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
||||
{
|
||||
try
|
||||
{
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||
}catch (ConnectionException& ex)
|
||||
{
|
||||
std::cout << "!!! WARNING: Connection failed. Access tests will fail !!!" << std::endl;
|
||||
@@ -100,7 +100,7 @@ ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
||||
|
||||
ODBCAccessTest::~ODBCAccessTest()
|
||||
{
|
||||
ODBC::SessionInstantiator::removeFromFactory();
|
||||
ODBC::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCDB2Test.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCDB2Test.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCDB2Test.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
@@ -71,7 +71,7 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
||||
{
|
||||
static bool beenHere = false;
|
||||
|
||||
ODBC::SessionInstantiator::addToFactory();
|
||||
ODBC::Connector::registerConnector();
|
||||
if (_drivers.empty() || _dataSources.empty())
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
@@ -82,7 +82,7 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
||||
{
|
||||
try
|
||||
{
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||
}catch (ConnectionException& ex)
|
||||
{
|
||||
std::cout << "!!! WARNING: Connection failed. DB2 tests will fail !!!" << std::endl;
|
||||
@@ -103,7 +103,7 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
||||
|
||||
ODBCDB2Test::~ODBCDB2Test()
|
||||
{
|
||||
ODBC::SessionInstantiator::removeFromFactory();
|
||||
ODBC::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCMySQLTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCMySQLTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCMySQLTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
@@ -71,7 +71,7 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
||||
{
|
||||
static bool beenHere = false;
|
||||
|
||||
ODBC::SessionInstantiator::addToFactory();
|
||||
ODBC::Connector::registerConnector();
|
||||
if (_drivers.empty() || _dataSources.empty())
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
@@ -82,7 +82,7 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
||||
{
|
||||
try
|
||||
{
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||
}catch (ConnectionException& ex)
|
||||
{
|
||||
std::cout << "!!! WARNING: Connection failed. MySQL tests will fail !!!" << std::endl;
|
||||
@@ -103,7 +103,7 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
||||
|
||||
ODBCMySQLTest::~ODBCMySQLTest()
|
||||
{
|
||||
ODBC::SessionInstantiator::removeFromFactory();
|
||||
ODBC::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCOracleTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCOracleTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCOracleTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
@@ -71,7 +71,7 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
||||
{
|
||||
static bool beenHere = false;
|
||||
|
||||
ODBC::SessionInstantiator::addToFactory();
|
||||
ODBC::Connector::registerConnector();
|
||||
if (_drivers.empty() || _dataSources.empty())
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
@@ -82,7 +82,7 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
||||
{
|
||||
try
|
||||
{
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||
}catch (ConnectionException& ex)
|
||||
{
|
||||
std::cout << "!!! WARNING: Connection failed. Oracle tests will fail !!!" << std::endl;
|
||||
@@ -103,7 +103,7 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
||||
|
||||
ODBCOracleTest::~ODBCOracleTest()
|
||||
{
|
||||
ODBC::SessionInstantiator::removeFromFactory();
|
||||
ODBC::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCPostgreSQLTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
@@ -71,7 +71,7 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
||||
{
|
||||
static bool beenHere = false;
|
||||
|
||||
ODBC::SessionInstantiator::addToFactory();
|
||||
ODBC::Connector::registerConnector();
|
||||
if (_drivers.empty() || _dataSources.empty())
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
@@ -82,7 +82,7 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
||||
{
|
||||
try
|
||||
{
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||
}catch (ConnectionException& ex)
|
||||
{
|
||||
std::cout << "!!! WARNING: Connection failed. PostgreSQL tests will fail !!!" << std::endl;
|
||||
@@ -103,7 +103,7 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
||||
|
||||
ODBCPostgreSQLTest::~ODBCPostgreSQLTest()
|
||||
{
|
||||
ODBC::SessionInstantiator::removeFromFactory();
|
||||
ODBC::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCSQLServerTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
@@ -71,7 +71,7 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
||||
{
|
||||
static bool beenHere = false;
|
||||
|
||||
ODBC::SessionInstantiator::addToFactory();
|
||||
ODBC::Connector::registerConnector();
|
||||
if (_drivers.empty() || _dataSources.empty())
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
@@ -82,7 +82,7 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
||||
{
|
||||
try
|
||||
{
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||
}catch (ConnectionException& ex)
|
||||
{
|
||||
std::cout << "!!! WARNING: Connection failed. SQL Server tests will fail !!!" << std::endl;
|
||||
@@ -103,7 +103,7 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
||||
|
||||
ODBCSQLServerTest::~ODBCSQLServerTest()
|
||||
{
|
||||
ODBC::SessionInstantiator::removeFromFactory();
|
||||
ODBC::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCSQLiteTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCSQLiteTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/ODBC/testsuite/src/ODBCSQLiteTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
@@ -69,7 +69,7 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
||||
{
|
||||
static bool beenHere = false;
|
||||
|
||||
ODBC::SessionInstantiator::addToFactory();
|
||||
ODBC::Connector::registerConnector();
|
||||
if (_drivers.empty())
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
@@ -79,7 +79,7 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
||||
{
|
||||
try
|
||||
{
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
||||
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||
}catch (ConnectionException& ex)
|
||||
{
|
||||
std::cout << "!!! WARNING: Connection failed. SQLite tests will fail !!!" << std::endl;
|
||||
@@ -100,7 +100,7 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
||||
|
||||
ODBCSQLiteTest::~ODBCSQLiteTest()
|
||||
{
|
||||
ODBC::SessionInstantiator::removeFromFactory();
|
||||
ODBC::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/RecordSet.h"
|
||||
#include "Poco/Data/ODBC/SessionInstantiator.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/Main/Data/SQLite/Makefile#2 $
|
||||
# $Id: //poco/Main/Data/SQLite/Makefile#3 $
|
||||
#
|
||||
# Makefile for Poco SQLite
|
||||
#
|
||||
@@ -10,7 +10,7 @@ include $(POCO_BASE)/build/rules/global
|
||||
|
||||
SYSFLAGS += -DTHREADSAFE -DNO_TCL
|
||||
|
||||
objects = Binder Extractor SessionImpl SessionInstantiator \
|
||||
objects = Binder Extractor SessionImpl Connector \
|
||||
SQLiteException SQLiteStatementImpl Utility \
|
||||
sqlite3
|
||||
|
||||
|
@@ -158,7 +158,7 @@
|
||||
RelativePath=".\include\Poco\Data\SQLite\SessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SQLite\SessionInstantiator.h">
|
||||
RelativePath=".\include\Poco\Data\SQLite\Connector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SQLite\SQLite.h">
|
||||
@@ -186,7 +186,7 @@
|
||||
RelativePath=".\src\SessionImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp">
|
||||
RelativePath=".\src\Connector.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SQLiteException.cpp">
|
||||
|
@@ -213,6 +213,10 @@
|
||||
RelativePath=".\include\Poco\Data\SQLite\Binder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SQLite\Connector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SQLite\Extractor.h"
|
||||
>
|
||||
@@ -221,10 +225,6 @@
|
||||
RelativePath=".\include\Poco\Data\SQLite\SessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SQLite\SessionInstantiator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SQLite\SQLite.h"
|
||||
>
|
||||
@@ -249,6 +249,10 @@
|
||||
RelativePath=".\src\Binder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Extractor.cpp"
|
||||
>
|
||||
@@ -257,10 +261,6 @@
|
||||
RelativePath=".\src\SessionImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SQLiteException.cpp"
|
||||
>
|
||||
|
@@ -1,13 +1,13 @@
|
||||
//
|
||||
// SessionInstantiator.h
|
||||
// Connector.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/SQLite/include/Poco/Data/SQLite/SessionInstantiator.h#2 $
|
||||
// $Id: //poco/Main/Data/SQLite/include/Poco/Data/SQLite/Connector.h#2 $
|
||||
//
|
||||
// Library: SQLite
|
||||
// Package: SQLite
|
||||
// Module: SessionInstantiator
|
||||
// Module: Connector
|
||||
//
|
||||
// Definition of the SessionInstantiator class.
|
||||
// Definition of the Connector class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -36,12 +36,12 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_SQLite_SessionInstantiator_INCLUDED
|
||||
#define DataConnectors_SQLite_SessionInstantiator_INCLUDED
|
||||
#ifndef DataConnectors_SQLite_Connector_INCLUDED
|
||||
#define DataConnectors_SQLite_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/SQLite/SQLite.h"
|
||||
#include "Poco/Data/SessionInstantiator.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -49,31 +49,31 @@ namespace Data {
|
||||
namespace SQLite {
|
||||
|
||||
|
||||
class SQLite_API SessionInstantiator: public Poco::Data::SessionInstantiator
|
||||
/// SessionInstantiator instantiates SqLite SessionImpl objects.
|
||||
class SQLite_API Connector: public Poco::Data::Connector
|
||||
/// Connector instantiates SqLite SessionImpl objects.
|
||||
{
|
||||
public:
|
||||
static const std::string KEY;
|
||||
/// Keyword for creating SQLite sessions.
|
||||
/// Keyword for creating SQLite sessions ("SQLite").
|
||||
|
||||
SessionInstantiator();
|
||||
/// Creates the SessionInstantiator.
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
~SessionInstantiator();
|
||||
/// Destroys the SessionInstantiator.
|
||||
~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> create(const std::string& initString);
|
||||
/// Creates a SQLite SessionImpl object and initializes it with the given initString.
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||
/// Creates a SQLite SessionImpl object and initializes it with the given connectionString.
|
||||
|
||||
static void addToFactory();
|
||||
/// Registers the SessionInstantiator under the Keyword SessionInstantiator::KEY at the Poco::Data::SessionFactory.
|
||||
static void registerConnector();
|
||||
/// Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory.
|
||||
|
||||
static void removeFromFactory();
|
||||
/// Unregisters the SessionInstantiator under the Keyword SessionInstantiator::KEY at the Poco::Data::SessionFactory.
|
||||
static void unregisterConnector();
|
||||
/// Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory.
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
|
||||
#endif // DataConnectors_SQLite_SessionInstantiator_INCLUDED
|
||||
#endif // DataConnectors_SQLite_Connector_INCLUDED
|
@@ -1,11 +1,11 @@
|
||||
//
|
||||
// SessionInstantiator.cpp
|
||||
// Connector.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/SQLite/src/SessionInstantiator.cpp#2 $
|
||||
// $Id: //poco/Main/Data/SQLite/src/Connector.cpp#2 $
|
||||
//
|
||||
// Library: SQLite
|
||||
// Package: SQLite
|
||||
// Module: SessionInstantiator
|
||||
// Module: Connector
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,7 +34,7 @@
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/SQLite/SessionInstantiator.h"
|
||||
#include "Poco/Data/SQLite/Connector.h"
|
||||
#include "Poco/Data/SQLite/SessionImpl.h"
|
||||
#include "Poco/Data/SessionFactory.h"
|
||||
|
||||
@@ -44,32 +44,32 @@ namespace Data {
|
||||
namespace SQLite {
|
||||
|
||||
|
||||
const std::string SessionInstantiator::KEY("sqlite");
|
||||
const std::string Connector::KEY("SQLite");
|
||||
|
||||
|
||||
SessionInstantiator::SessionInstantiator()
|
||||
Connector::Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SessionInstantiator::~SessionInstantiator()
|
||||
Connector::~Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> SessionInstantiator::create(const std::string& initString)
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> Connector::createSession(const std::string& connectionString)
|
||||
{
|
||||
return Poco::AutoPtr<Poco::Data::SessionImpl>(new SessionImpl(initString));
|
||||
return Poco::AutoPtr<Poco::Data::SessionImpl>(new SessionImpl(connectionString));
|
||||
}
|
||||
|
||||
|
||||
void SessionInstantiator::addToFactory()
|
||||
void Connector::registerConnector()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().add(KEY, new SessionInstantiator());
|
||||
Poco::Data::SessionFactory::instance().add(KEY, new Connector());
|
||||
}
|
||||
|
||||
|
||||
void SessionInstantiator::removeFromFactory()
|
||||
void Connector::unregisterConnector()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().remove(KEY);
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SQLiteTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/SQLite/testsuite/src/SQLiteTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/SQLite/testsuite/src/SQLiteTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/Data/RecordSet.h"
|
||||
#include "Poco/Data/SQLite/SessionInstantiator.h"
|
||||
#include "Poco/Data/SQLite/Connector.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Exception.h"
|
||||
@@ -153,13 +153,13 @@ private:
|
||||
|
||||
SQLiteTest::SQLiteTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
SQLite::SessionInstantiator::addToFactory();
|
||||
SQLite::Connector::registerConnector();
|
||||
}
|
||||
|
||||
|
||||
SQLiteTest::~SQLiteTest()
|
||||
{
|
||||
SQLite::SessionInstantiator::removeFromFactory();
|
||||
SQLite::Connector::unregisterConnector();
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ void SQLiteTest::testTAC()
|
||||
if (aFile.exists())
|
||||
aFile.remove();
|
||||
|
||||
Session ses (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "sqlite.db"));
|
||||
Session ses (SessionFactory::instance().create(SQLite::Connector::KEY, "sqlite.db"));
|
||||
|
||||
ses << "CREATE TABLE LogTest (Id INTEGER PRIMARY KEY, Time INTEGER, Value INTEGER)", now;
|
||||
//ses << "PRAGMA synchronous = OFF", now;
|
||||
@@ -193,7 +193,7 @@ void SQLiteTest::testTAC()
|
||||
|
||||
void SQLiteTest::testSimpleAccess()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
assert (tmp.isConnected());
|
||||
std::string tableName("Person");
|
||||
std::string lastName("lastname");
|
||||
@@ -221,7 +221,7 @@ void SQLiteTest::testSimpleAccess()
|
||||
|
||||
void SQLiteTest::testInsertCharPointer()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::string tableName("Person");
|
||||
std::string lastName("lastname");
|
||||
std::string firstName("firstname");
|
||||
@@ -245,7 +245,7 @@ void SQLiteTest::testInsertCharPointer()
|
||||
|
||||
void SQLiteTest::testInsertCharPointer2()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::string tableName("Person");
|
||||
std::string lastName("lastname");
|
||||
std::string firstName("firstname");
|
||||
@@ -271,7 +271,7 @@ void SQLiteTest::testInsertCharPointer2()
|
||||
|
||||
void SQLiteTest::testComplexType()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
@@ -292,7 +292,7 @@ void SQLiteTest::testComplexType()
|
||||
|
||||
void SQLiteTest::testSimpleAccessVector()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::vector<std::string> lastNames;
|
||||
std::vector<std::string> firstNames;
|
||||
std::vector<std::string> addresses;
|
||||
@@ -329,7 +329,7 @@ void SQLiteTest::testSimpleAccessVector()
|
||||
|
||||
void SQLiteTest::testComplexTypeVector()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::vector<Person> people;
|
||||
people.push_back(Person("LN1", "FN1", "ADDR1", 1));
|
||||
people.push_back(Person("LN2", "FN2", "ADDR2", 2));
|
||||
@@ -348,7 +348,7 @@ void SQLiteTest::testComplexTypeVector()
|
||||
|
||||
void SQLiteTest::testInsertVector()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::vector<std::string> str;
|
||||
str.push_back("s1");
|
||||
str.push_back("s2");
|
||||
@@ -373,7 +373,7 @@ void SQLiteTest::testInsertVector()
|
||||
|
||||
void SQLiteTest::testInsertEmptyVector()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::vector<std::string> str;
|
||||
|
||||
int count = 100;
|
||||
@@ -392,7 +392,7 @@ void SQLiteTest::testInsertEmptyVector()
|
||||
|
||||
void SQLiteTest::testInsertSingleBulk()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Strings", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||
int x = 0;
|
||||
@@ -413,7 +413,7 @@ void SQLiteTest::testInsertSingleBulk()
|
||||
|
||||
void SQLiteTest::testInsertSingleBulkVec()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Strings", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||
std::vector<int> data;
|
||||
@@ -438,7 +438,7 @@ void SQLiteTest::testInsertSingleBulkVec()
|
||||
|
||||
void SQLiteTest::testLimit()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Strings", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||
std::vector<int> data;
|
||||
@@ -461,7 +461,7 @@ void SQLiteTest::testLimit()
|
||||
|
||||
void SQLiteTest::testLimitZero()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Strings", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||
std::vector<int> data;
|
||||
@@ -480,7 +480,7 @@ void SQLiteTest::testLimitZero()
|
||||
|
||||
void SQLiteTest::testLimitOnce()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Strings", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||
std::vector<int> data;
|
||||
@@ -511,7 +511,7 @@ void SQLiteTest::testLimitOnce()
|
||||
|
||||
void SQLiteTest::testLimitPrepare()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Strings", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||
std::vector<int> data;
|
||||
@@ -545,7 +545,7 @@ void SQLiteTest::testLimitPrepare()
|
||||
|
||||
void SQLiteTest::testPrepare()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Strings", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||
std::vector<int> data;
|
||||
@@ -566,7 +566,7 @@ void SQLiteTest::testPrepare()
|
||||
|
||||
void SQLiteTest::testSetSimple()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::set<std::string> lastNames;
|
||||
std::set<std::string> firstNames;
|
||||
std::set<std::string> addresses;
|
||||
@@ -603,7 +603,7 @@ void SQLiteTest::testSetSimple()
|
||||
|
||||
void SQLiteTest::testSetComplex()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::set<Person> people;
|
||||
people.insert(Person("LN1", "FN1", "ADDR1", 1));
|
||||
people.insert(Person("LN2", "FN2", "ADDR2", 2));
|
||||
@@ -622,7 +622,7 @@ void SQLiteTest::testSetComplex()
|
||||
|
||||
void SQLiteTest::testSetComplexUnique()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::vector<Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
people.push_back(p1);
|
||||
@@ -648,7 +648,7 @@ void SQLiteTest::testSetComplexUnique()
|
||||
|
||||
void SQLiteTest::testMultiSetSimple()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multiset<std::string> lastNames;
|
||||
std::multiset<std::string> firstNames;
|
||||
std::multiset<std::string> addresses;
|
||||
@@ -685,7 +685,7 @@ void SQLiteTest::testMultiSetSimple()
|
||||
|
||||
void SQLiteTest::testMultiSetComplex()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multiset<Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
people.insert(p1);
|
||||
@@ -710,7 +710,7 @@ void SQLiteTest::testMultiSetComplex()
|
||||
|
||||
void SQLiteTest::testMapComplex()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::map<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -731,7 +731,7 @@ void SQLiteTest::testMapComplex()
|
||||
|
||||
void SQLiteTest::testMapComplexUnique()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -755,7 +755,7 @@ void SQLiteTest::testMapComplexUnique()
|
||||
|
||||
void SQLiteTest::testMultiMapComplex()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -779,7 +779,7 @@ void SQLiteTest::testMultiMapComplex()
|
||||
|
||||
void SQLiteTest::testSelectIntoSingle()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -799,7 +799,7 @@ void SQLiteTest::testSelectIntoSingle()
|
||||
|
||||
void SQLiteTest::testSelectIntoSingleStep()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -824,7 +824,7 @@ void SQLiteTest::testSelectIntoSingleStep()
|
||||
|
||||
void SQLiteTest::testSelectIntoSingleFail()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -850,7 +850,7 @@ void SQLiteTest::testSelectIntoSingleFail()
|
||||
|
||||
void SQLiteTest::testLowerLimitOk()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -876,7 +876,7 @@ void SQLiteTest::testLowerLimitOk()
|
||||
|
||||
void SQLiteTest::testSingleSelect()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -901,7 +901,7 @@ void SQLiteTest::testSingleSelect()
|
||||
|
||||
void SQLiteTest::testLowerLimitFail()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -927,7 +927,7 @@ void SQLiteTest::testLowerLimitFail()
|
||||
|
||||
void SQLiteTest::testCombinedLimits()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -950,7 +950,7 @@ void SQLiteTest::testCombinedLimits()
|
||||
|
||||
void SQLiteTest::testRange()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -972,7 +972,7 @@ void SQLiteTest::testRange()
|
||||
|
||||
void SQLiteTest::testCombinedIllegalLimits()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -999,7 +999,7 @@ void SQLiteTest::testCombinedIllegalLimits()
|
||||
|
||||
void SQLiteTest::testIllegalRange()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
std::multimap<std::string, Person> people;
|
||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||
@@ -1025,7 +1025,7 @@ void SQLiteTest::testIllegalRange()
|
||||
|
||||
void SQLiteTest::testEmptyDB()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
|
||||
@@ -1045,7 +1045,7 @@ void SQLiteTest::testBLOB()
|
||||
std::string lastName("lastname");
|
||||
std::string firstName("firstname");
|
||||
std::string address("Address");
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Image BLOB)", now;
|
||||
BLOB img("0123456789", 10);
|
||||
@@ -1064,7 +1064,7 @@ void SQLiteTest::testBLOBStmt()
|
||||
{
|
||||
// the following test will fail becuase we use a temporary object as parameter to use
|
||||
/*
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Image BLOB)", now;
|
||||
BLOB img("0123456789", 10);
|
||||
@@ -1084,7 +1084,7 @@ void SQLiteTest::testBLOBStmt()
|
||||
|
||||
void SQLiteTest::testTuple10()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||
@@ -1103,7 +1103,7 @@ void SQLiteTest::testTuple10()
|
||||
|
||||
void SQLiteTest::testTupleVector10()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||
@@ -1132,7 +1132,7 @@ void SQLiteTest::testTupleVector10()
|
||||
|
||||
void SQLiteTest::testTuple9()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||
@@ -1151,7 +1151,7 @@ void SQLiteTest::testTuple9()
|
||||
|
||||
void SQLiteTest::testTupleVector9()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||
@@ -1180,7 +1180,7 @@ void SQLiteTest::testTupleVector9()
|
||||
|
||||
void SQLiteTest::testTuple8()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||
@@ -1199,7 +1199,7 @@ void SQLiteTest::testTuple8()
|
||||
|
||||
void SQLiteTest::testTupleVector8()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||
@@ -1228,7 +1228,7 @@ void SQLiteTest::testTupleVector8()
|
||||
|
||||
void SQLiteTest::testTuple7()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER)", now;
|
||||
@@ -1246,7 +1246,7 @@ void SQLiteTest::testTuple7()
|
||||
|
||||
void SQLiteTest::testTupleVector7()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER)", now;
|
||||
@@ -1274,7 +1274,7 @@ void SQLiteTest::testTupleVector7()
|
||||
|
||||
void SQLiteTest::testTuple6()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER)", now;
|
||||
@@ -1292,7 +1292,7 @@ void SQLiteTest::testTuple6()
|
||||
|
||||
void SQLiteTest::testTupleVector6()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER)", now;
|
||||
@@ -1320,7 +1320,7 @@ void SQLiteTest::testTupleVector6()
|
||||
|
||||
void SQLiteTest::testTuple5()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER)", now;
|
||||
@@ -1338,7 +1338,7 @@ void SQLiteTest::testTuple5()
|
||||
|
||||
void SQLiteTest::testTupleVector5()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER)", now;
|
||||
@@ -1366,7 +1366,7 @@ void SQLiteTest::testTupleVector5()
|
||||
|
||||
void SQLiteTest::testTuple4()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER)", now;
|
||||
@@ -1384,7 +1384,7 @@ void SQLiteTest::testTuple4()
|
||||
|
||||
void SQLiteTest::testTupleVector4()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER)", now;
|
||||
@@ -1412,7 +1412,7 @@ void SQLiteTest::testTupleVector4()
|
||||
|
||||
void SQLiteTest::testTuple3()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER)", now;
|
||||
@@ -1430,7 +1430,7 @@ void SQLiteTest::testTuple3()
|
||||
|
||||
void SQLiteTest::testTupleVector3()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples "
|
||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER)", now;
|
||||
@@ -1458,7 +1458,7 @@ void SQLiteTest::testTupleVector3()
|
||||
|
||||
void SQLiteTest::testTuple2()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples (int0 INTEGER, int1 INTEGER)", now;
|
||||
|
||||
@@ -1475,7 +1475,7 @@ void SQLiteTest::testTuple2()
|
||||
|
||||
void SQLiteTest::testTupleVector2()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples (int0 INTEGER, int1 INTEGER)", now;
|
||||
|
||||
@@ -1502,7 +1502,7 @@ void SQLiteTest::testTupleVector2()
|
||||
|
||||
void SQLiteTest::testTuple1()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples (int0 INTEGER)", now;
|
||||
|
||||
@@ -1519,7 +1519,7 @@ void SQLiteTest::testTuple1()
|
||||
|
||||
void SQLiteTest::testTupleVector1()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Tuples", now;
|
||||
tmp << "CREATE TABLE Tuples (int0 INTEGER)", now;
|
||||
|
||||
@@ -1546,7 +1546,7 @@ void SQLiteTest::testTupleVector1()
|
||||
|
||||
void SQLiteTest::testInternalExtraction()
|
||||
{
|
||||
Session tmp (SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
Session tmp (SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
tmp << "DROP TABLE IF EXISTS Vectors", now;
|
||||
tmp << "CREATE TABLE Vectors (int0 INTEGER, flt0 REAL, str0 VARCHAR)", now;
|
||||
|
||||
|
@@ -1,13 +1,13 @@
|
||||
//
|
||||
// SessionInstantiator.h
|
||||
// Connector.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/SessionInstantiator.h#3 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/Connector.h#4 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
// Module: SessionInstantiator
|
||||
// Module: Connector
|
||||
//
|
||||
// Definition of the SessionInstantiator class.
|
||||
// Definition of the Connector class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef Data_SessionInstantiator_INCLUDED
|
||||
#define Data_SessionInstantiator_INCLUDED
|
||||
#ifndef Data_Connector_INCLUDED
|
||||
#define Data_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
@@ -49,22 +49,26 @@ namespace Poco {
|
||||
namespace Data {
|
||||
|
||||
|
||||
class Data_API SessionInstantiator
|
||||
/// A SessionInstantiator creates SessionImpl objects.
|
||||
class Data_API Connector
|
||||
/// A Connector creates SessionImpl objects.
|
||||
///
|
||||
/// Every connector library (like the SQLite or the ODBC connector)
|
||||
/// provides a subclass of this class, an instance of which is
|
||||
/// registered with the SessionFactory.
|
||||
{
|
||||
public:
|
||||
SessionInstantiator();
|
||||
/// Creates the SessionInstantiator.
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
virtual ~SessionInstantiator();
|
||||
/// Destroys the SessionInstantiator.
|
||||
virtual ~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
virtual Poco::AutoPtr<SessionImpl> create(const std::string& initString) = 0;
|
||||
/// Create a SessionImpl object and initialize it with the initString.
|
||||
virtual Poco::AutoPtr<SessionImpl> createSession(const std::string& connectionString) = 0;
|
||||
/// Create a SessionImpl object and initialize it with the given connectionString.
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_SessionInstantiator_INCLUDED
|
||||
#endif // Data_Connector_INCLUDED
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// RecordSet.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/RecordSet.h#4 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/RecordSet.h#5 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
if (pos > rExtractions.size())
|
||||
throw RangeException(format("Invalid column number: %z", pos));
|
||||
|
||||
ExtractionVecPtr pExtraction = dynamic_cast<ExtractionVecPtr>(rExtractions[pos-1].get());
|
||||
ExtractionVecPtr pExtraction = dynamic_cast<ExtractionVecPtr>(rExtractions[pos - 1].get());
|
||||
|
||||
if (pExtraction)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
DynamicAny value(const std::string& name, std::size_t row) const;
|
||||
/// Returns the reference to data value at named column, row location.
|
||||
|
||||
void moveFirst();
|
||||
bool moveFirst();
|
||||
/// Moves the row cursor to the first row.
|
||||
|
||||
bool moveNext();
|
||||
@@ -136,15 +136,21 @@ public:
|
||||
bool movePrevious();
|
||||
/// Moves the row cursor to the previous row.
|
||||
|
||||
void moveLast();
|
||||
bool moveLast();
|
||||
/// Moves the row cursor to the last row.
|
||||
|
||||
DynamicAny value(const std::string& name);
|
||||
/// Returns the value in the named column of the current row.
|
||||
|
||||
DynamicAny value(std::size_t index);
|
||||
/// Returns the value in the given column of the current row.
|
||||
|
||||
DynamicAny operator [] (const std::string& name);
|
||||
/// Returns the value in the named column of the current row.
|
||||
|
||||
DynamicAny operator [] (std::size_t index);
|
||||
/// Returns the value in the named column of the current row.
|
||||
|
||||
private:
|
||||
RecordSet();
|
||||
|
||||
@@ -199,46 +205,30 @@ inline Statement& RecordSet::operator = (const Statement& stmt)
|
||||
}
|
||||
|
||||
|
||||
inline void RecordSet::moveFirst()
|
||||
{
|
||||
_currentRow = 1;
|
||||
}
|
||||
|
||||
|
||||
inline bool RecordSet::moveNext()
|
||||
{
|
||||
if (_currentRow >= rowCount()) return false;
|
||||
++_currentRow;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline bool RecordSet::movePrevious()
|
||||
{
|
||||
if (0 == _currentRow) return false;
|
||||
--_currentRow;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline void RecordSet::moveLast()
|
||||
{
|
||||
_currentRow = rowCount();
|
||||
}
|
||||
|
||||
|
||||
inline DynamicAny RecordSet::value(const std::string& name)
|
||||
{
|
||||
return value(name, _currentRow);
|
||||
}
|
||||
|
||||
|
||||
inline DynamicAny RecordSet::value(std::size_t index)
|
||||
{
|
||||
return value(index, _currentRow);
|
||||
}
|
||||
|
||||
|
||||
inline DynamicAny RecordSet::operator [] (const std::string& name)
|
||||
{
|
||||
return value(name, _currentRow);
|
||||
}
|
||||
|
||||
|
||||
inline DynamicAny RecordSet::operator [] (std::size_t index)
|
||||
{
|
||||
return value(index, _currentRow);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Session.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/Session.h#6 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/Session.h#9 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/Data/StatementCreator.h"
|
||||
#include "Poco/Data/Binding.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Any.h"
|
||||
|
||||
@@ -60,20 +61,24 @@ class Data_API Session
|
||||
///
|
||||
/// Sessions are always created via the SessionFactory:
|
||||
///
|
||||
/// Session ses(SessionFactory::instance().create(dbKey, initString));
|
||||
/// Session ses(SessionFactory::instance().create(connectorKey, connectionString));
|
||||
///
|
||||
/// where the first param presents the type of session one wants to create (e.g. for SQLite one would choose "sqlite")
|
||||
/// and the second param is the initialization string that the session implementation requires to connect to the database.
|
||||
/// where the first param presents the type of session one wants to create (e.g., for SQLite one would choose "SQLite",
|
||||
/// for ODBC the key is "ODBC") and the second param is the connection string that the session implementation
|
||||
/// requires to connect to the database. The format of the connection string is specific to the actual connector.
|
||||
///
|
||||
/// A simpler form to create the session is to pass the connector key and connection string directly to
|
||||
/// the Session constructor.
|
||||
///
|
||||
/// A concrete example to open an SQLite database stored in the file "dummy.db" would be
|
||||
///
|
||||
/// Session tmp(SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
/// Session ses("SQLite", "dummy.db");
|
||||
///
|
||||
/// Via a Session one can create two different types of statements. First, statements that should only be executed once and immediately, and
|
||||
/// second, statements that should be executed multiple times, using a separate execute() call.
|
||||
/// The simple one is immediate execution:
|
||||
///
|
||||
/// ses << "CREATE TABLE Dummy (data INTEGER(10))", now;
|
||||
/// ses << "CREATE TABLE Dummy (data INTEGER(10))", now;
|
||||
///
|
||||
/// The now at the end of the statement is required, otherwise the statement
|
||||
/// would not be executed.
|
||||
@@ -81,13 +86,13 @@ class Data_API Session
|
||||
/// If one wants to reuse a Statement (and avoid the overhead of repeatedly parsing an SQL statement)
|
||||
/// one uses an explicit Statement object and its execute() method:
|
||||
///
|
||||
/// int i = 0;
|
||||
/// Statement stmt = (ses << "INSERT INTO Dummy VALUES(:data)", use(i));
|
||||
/// int i = 0;
|
||||
/// Statement stmt = (ses << "INSERT INTO Dummy VALUES(:data)", use(i));
|
||||
///
|
||||
/// for (i = 0; i < 100; ++i)
|
||||
/// {
|
||||
/// stmt.execute();
|
||||
/// }
|
||||
/// for (i = 0; i < 100; ++i)
|
||||
/// {
|
||||
/// stmt.execute();
|
||||
/// }
|
||||
///
|
||||
/// The above example assigns the variable i to the ":data" placeholder in the SQL query. The query is parsed and compiled exactly
|
||||
/// once, but executed 100 times. At the end the values 0 to 99 will be present in the Table "DUMMY".
|
||||
@@ -95,61 +100,74 @@ class Data_API Session
|
||||
/// A faster implementaton of the above code will simply create a vector of int
|
||||
/// and use the vector as parameter to the use clause (you could also use set or multiset instead):
|
||||
///
|
||||
/// std::vector<int> data;
|
||||
/// for (int i = 0; i < 100; ++i)
|
||||
/// {
|
||||
/// data.push_back(i);
|
||||
/// }
|
||||
/// ses << "INSERT INTO Dummy VALUES(:data)", use(data);
|
||||
/// std::vector<int> data;
|
||||
/// for (int i = 0; i < 100; ++i)
|
||||
/// {
|
||||
/// data.push_back(i);
|
||||
/// }
|
||||
/// ses << "INSERT INTO Dummy VALUES(:data)", use(data);
|
||||
///
|
||||
/// NEVER try to bind to an empty collection. This will give a BindingException during run-time!
|
||||
/// NEVER try to bind to an empty collection. This will give a BindingException at run-time!
|
||||
///
|
||||
/// Retrieving data from a database works similar, you could use simple data types, vectors, sets or multiset as your targets:
|
||||
/// std::set<int> retData;
|
||||
/// ses << "SELECT * FROM Dummy", into(retData));
|
||||
///
|
||||
/// std::set<int> retData;
|
||||
/// ses << "SELECT * FROM Dummy", into(retData));
|
||||
///
|
||||
/// Due to the blocking nature of the above call it is possible to partition the data retrieval into chunks by setting a limit to
|
||||
/// the maximum number of rows retrieved from the database:
|
||||
/// std::set<int> retData;
|
||||
/// Statement stmt = (ses << "SELECT * FROM Dummy", into(retData), limit(50));
|
||||
/// while (!stmt.done())
|
||||
/// {
|
||||
/// stmt.execute();
|
||||
/// }
|
||||
///
|
||||
/// std::set<int> retData;
|
||||
/// Statement stmt = (ses << "SELECT * FROM Dummy", into(retData), limit(50));
|
||||
/// while (!stmt.done())
|
||||
/// {
|
||||
/// stmt.execute();
|
||||
/// }
|
||||
///
|
||||
/// The "into" keyword is used to inform the statement where output results should be placed. The limit value ensures
|
||||
/// that during each run at most 50 rows are retrieved. Assuming DUMMY contains 100 rows, retData will contain 50
|
||||
/// that during each run at most 50 rows are retrieved. Assuming Dummy contains 100 rows, retData will contain 50
|
||||
/// elements after the first run and 100 after the second run, i.e.
|
||||
/// the collection is not cleared between consecutive runs. After the second execute stmt.done() will return true.
|
||||
///
|
||||
/// A prepared-Statement will behave exactly the same but a further call to execute() will simply reset the Statement, execute it again and
|
||||
/// append more data to the result set.
|
||||
/// A prepared Statement will behave exactly the same but a further call to execute() will simply reset the Statement,
|
||||
/// execute it again and append more data to the result set.
|
||||
///
|
||||
/// Note that it is possible to append several "bind" or "into" clauses to the statement. Theoretically, one could also have several
|
||||
/// limit clauses but only the last one that was added will be effective. Also several preconditions must be met concerning binds and intos.
|
||||
/// limit clauses but only the last one that was added will be effective.
|
||||
/// Also several preconditions must be met concerning binds and intos.
|
||||
/// Take the following example:
|
||||
/// ses << "CREATE TABLE Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3))";
|
||||
/// std::vector<std::string> nameVec; // [...] add some elements
|
||||
/// std::vector<int> ageVec; // [...] add some elements
|
||||
/// ses << "INSERT INTO Person (LastName, Age) VALUES(:ln, :age)", use(nameVec), use(ageVec);
|
||||
///
|
||||
/// ses << "CREATE TABLE Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3))";
|
||||
/// std::vector<std::string> nameVec; // [...] add some elements
|
||||
/// std::vector<int> ageVec; // [...] add some elements
|
||||
/// ses << "INSERT INTO Person (LastName, Age) VALUES(:ln, :age)", use(nameVec), use(ageVec);
|
||||
///
|
||||
/// The size of all use parameters MUST be the same, otherwise an exception is thrown. Furthermore,
|
||||
/// the amount of use clauses must match the number of wildcards in the query (to be more precisely:
|
||||
/// each binding has a numberOfColumnsHandled() value which is per default 1. The sum of all these values must match the wildcard count in the query.
|
||||
/// But this is only important if you have written your own TypeHandler specializations).
|
||||
/// If you plan to map complex object types to Tables take a look at the TypeHandler documentation.
|
||||
/// If you plan to map complex object types to tables see the TypeHandler documentation.
|
||||
/// For now, we simply assume we have written one TypeHandler for Person objects. Instead of having n different vectors,
|
||||
/// we have now one collection:
|
||||
/// std::vector<Person> people; // [...] add some elements
|
||||
/// ses << "INSERT INTO Person (LastName, FirstName, Age) VALUES(:ln, :fn, :age)", use(people);
|
||||
/// we have one collection:
|
||||
///
|
||||
/// std::vector<Person> people; // [...] add some elements
|
||||
/// ses << "INSERT INTO Person (LastName, FirstName, Age) VALUES(:ln, :fn, :age)", use(people);
|
||||
///
|
||||
/// which will insert all Person objects from the people vector to the database (and again, you can use set, multiset too,
|
||||
/// even map and multimap if Person provides an operator() which returns the key for the map)
|
||||
/// even map and multimap if Person provides an operator() which returns the key for the map).
|
||||
/// The same works for a SELECT statement with "into" clauses:
|
||||
/// std::vector<Person> people;
|
||||
/// ses << "SELECT * FROM PERSON", into(people);
|
||||
///
|
||||
/// std::vector<Person> people;
|
||||
/// ses << "SELECT * FROM PERSON", into(people);
|
||||
{
|
||||
public:
|
||||
Session(Poco::AutoPtr<SessionImpl> ptrImpl);
|
||||
/// Creates the Session.
|
||||
|
||||
Session(const std::string& connector, const std::string& connectionString);
|
||||
/// Creates a new session, using the given connector (which must have
|
||||
/// been registered), and connectionString.
|
||||
|
||||
Session(const Session&);
|
||||
/// Creates a session by copying another one.
|
||||
|
||||
@@ -170,6 +188,7 @@ public:
|
||||
}
|
||||
|
||||
StatementImpl* createStatementImpl();
|
||||
/// Creates a StatementImpl.
|
||||
|
||||
void begin();
|
||||
/// Starts a transaction.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SessionFactory.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/SessionFactory.h#3 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/SessionFactory.h#5 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/SessionInstantiator.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
@@ -53,33 +53,38 @@ namespace Data {
|
||||
|
||||
|
||||
class Data_API SessionFactory
|
||||
/// A SessionFactory is a singleton class that stores SessionInstantiators and allows to
|
||||
/// A SessionFactory is a singleton class that stores Connectors and allows to
|
||||
/// create Sessions of the required type:
|
||||
///
|
||||
/// Session ses(SessionFactory::instance().create(dbKey, initString));
|
||||
/// Session ses(SessionFactory::instance().create(connector, connectionString));
|
||||
///
|
||||
/// where the first param presents the type of session one wants to create (e.g. for SQLite one would choose "sqlite")
|
||||
/// and the second param is the initialization string that the session implementation requires to connect to the database.
|
||||
/// where the first param presents the type of session one wants to create (e.g. for SQLite one would choose "SQLite")
|
||||
/// and the second param is the connection string that the connector requires to connect to the database.
|
||||
///
|
||||
/// A concrete example to open an SQLite database stored in the file "dummy.db" would be
|
||||
///
|
||||
/// Session tmp(SessionFactory::instance().create(SQLite::SessionInstantiator::KEY, "dummy.db"));
|
||||
/// Session tmp(SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db"));
|
||||
///
|
||||
/// An even simpler way to create a session is to use the two argument constructor of Session, which
|
||||
/// automatically invokes the SessionFactory:
|
||||
///
|
||||
/// Session ses("SQLite", "dummy.db");
|
||||
{
|
||||
public:
|
||||
static SessionFactory& instance();
|
||||
/// returns the static instance of the singleton.
|
||||
|
||||
void add(const std::string& key, SessionInstantiator* pIn);
|
||||
/// Registers a SessionInstantiator under the given key at the factory. If a registration for that
|
||||
void add(const std::string& key, Connector* pIn);
|
||||
/// Registers a Connector under the given key at the factory. If a registration for that
|
||||
/// key is already active, the first registration will be kept, only its reference count will be increased.
|
||||
/// Always takes ownership of parameter pIn.
|
||||
|
||||
void remove(const std::string& key);
|
||||
/// Lowers the reference count for the SessionInstantiator registered under that key. If the count reaches zero,
|
||||
/// Lowers the reference count for the Connector registered under that key. If the count reaches zero,
|
||||
/// the object is removed.
|
||||
|
||||
Session create(const std::string& key, const std::string& initString);
|
||||
/// Creates a Session for the given key with the initString. Throws an Poco:Data::UnknownDataBaseException
|
||||
Session create(const std::string& key, const std::string& connectionString);
|
||||
/// Creates a Session for the given key with the connectionString. Throws an Poco:Data::UnknownDataBaseException
|
||||
/// if no instantiator is registered for that key.
|
||||
|
||||
private:
|
||||
@@ -91,12 +96,12 @@ private:
|
||||
struct SessionInfo
|
||||
{
|
||||
int cnt;
|
||||
Poco::SharedPtr<SessionInstantiator> ptrSI;
|
||||
SessionInfo(SessionInstantiator* pSI);
|
||||
Poco::SharedPtr<Connector> ptrSI;
|
||||
SessionInfo(Connector* pSI);
|
||||
};
|
||||
|
||||
typedef std::map<std::string, SessionInfo> Instantiators;
|
||||
Instantiators _instantiators;
|
||||
typedef std::map<std::string, SessionInfo> Connectors;
|
||||
Connectors _connectors;
|
||||
Poco::FastMutex _mutex;
|
||||
};
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SessionPool.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/SessionPool.h#2 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/SessionPool.h#4 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: SessionPooling
|
||||
@@ -73,16 +73,23 @@ class Data_API SessionPool
|
||||
/// Sessions found not to be connected to the database are purged
|
||||
/// from the pool whenever one of the following events occurs:
|
||||
///
|
||||
/// - JanitorTimer event
|
||||
/// - get() request
|
||||
/// - putBack() request
|
||||
/// - JanitorTimer event
|
||||
/// - get() request
|
||||
/// - putBack() request
|
||||
///
|
||||
/// Not connected idle sessions can not exist.
|
||||
///
|
||||
/// Usage example:
|
||||
///
|
||||
/// SessionPool pool("ODBC", "...");
|
||||
/// ...
|
||||
/// Session sess(pool.get());
|
||||
/// ...
|
||||
{
|
||||
public:
|
||||
SessionPool(const std::string& sessionKey, const std::string& initString, int minSessions = 1, int maxSessions = 32, int idleTime = 60);
|
||||
SessionPool(const std::string& sessionKey, const std::string& connectionString, int minSessions = 1, int maxSessions = 32, int idleTime = 60);
|
||||
/// Creates the SessionPool for sessions with the given sessionKey
|
||||
/// and initString.
|
||||
/// and connectionString.
|
||||
///
|
||||
/// The pool allows for at most maxSessions sessions to be created.
|
||||
/// If a session has been idle for more than idleTime seconds, and more than
|
||||
@@ -135,7 +142,7 @@ private:
|
||||
SessionPool& operator = (const SessionPool&);
|
||||
|
||||
std::string _sessionKey;
|
||||
std::string _initString;
|
||||
std::string _connectionString;
|
||||
int _minSessions;
|
||||
int _maxSessions;
|
||||
int _idleTime;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Statement.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/Statement.h#14 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/Statement.h#16 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -67,6 +67,20 @@ public:
|
||||
Statement(StatementImpl* pImpl);
|
||||
/// Creates the Statement.
|
||||
|
||||
Statement(Session& session);
|
||||
/// Creates the Statement for the given Session.
|
||||
///
|
||||
/// The following:
|
||||
///
|
||||
/// Statement stmt(sess);
|
||||
/// stmt << "SELECT * FROM Table", ...
|
||||
///
|
||||
/// is equivalent to:
|
||||
///
|
||||
/// Statement stmt(sess << "SELECT * FROM Table", ...);
|
||||
///
|
||||
/// but in some cases better readable.
|
||||
|
||||
~Statement();
|
||||
/// Destroys the Statement.
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// StatementCreator.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/StatementCreator.h#4 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/StatementCreator.h#5 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -54,6 +54,9 @@ class Data_API StatementCreator
|
||||
/// A StatementCreator creates Statements.
|
||||
{
|
||||
public:
|
||||
StatementCreator();
|
||||
/// Creates an unitialized StatementCreator.
|
||||
|
||||
StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl);
|
||||
/// Creates a StatementCreator.
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TypeHandler.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/TypeHandler.h#10 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/TypeHandler.h#11 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -54,7 +54,7 @@ namespace Data {
|
||||
|
||||
template <class T>
|
||||
class TypeHandler
|
||||
/// Converts Rows to a Type and the other way round. Provide template specializations to support your own complex types.
|
||||
/// Converts Rows to a Type and the other way around. Provide template specializations to support your own complex types.
|
||||
///
|
||||
/// Take as example the following (simplified) class:
|
||||
/// class Person
|
||||
@@ -72,6 +72,11 @@ class TypeHandler
|
||||
/// class TypeHandler<struct Person>
|
||||
/// {
|
||||
/// public:
|
||||
/// static std::size_t size()
|
||||
/// {
|
||||
/// return 3; // lastName + firstname + age occupy three columns
|
||||
/// }
|
||||
///
|
||||
/// static void bind(std::size_t pos, const Person& obj, AbstractBinder* pBinder)
|
||||
/// {
|
||||
/// // the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3))
|
||||
@@ -82,11 +87,6 @@ class TypeHandler
|
||||
/// TypeHandler<int>::bind(pos++, obj.getAge(), pBinder);
|
||||
/// }
|
||||
///
|
||||
/// static std::size_t size()
|
||||
/// {
|
||||
/// return 3; // lastName + firstname + age occupy three columns
|
||||
/// }
|
||||
///
|
||||
/// static void prepare(std::size_t pos, const Person& obj, AbstractPreparation* pPrepare)
|
||||
/// {
|
||||
/// // the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3))
|
||||
|
@@ -1,11 +1,11 @@
|
||||
//
|
||||
// SessionInstantiator.cpp
|
||||
// Connector.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/SessionInstantiator.cpp#2 $
|
||||
// $Id: //poco/Main/Data/src/Connector.cpp#2 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
// Module: SessionInstantiator
|
||||
// Module: Connector
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,19 +34,19 @@
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/SessionInstantiator.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
|
||||
|
||||
SessionInstantiator::SessionInstantiator()
|
||||
Connector::Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SessionInstantiator::~SessionInstantiator()
|
||||
Connector::~Connector()
|
||||
{
|
||||
}
|
||||
|
@@ -99,4 +99,44 @@ DynamicAny RecordSet::value(const std::string& name, std::size_t row) const
|
||||
}
|
||||
|
||||
|
||||
bool RecordSet::moveFirst()
|
||||
{
|
||||
if (rowCount() > 0)
|
||||
{
|
||||
_currentRow = 1;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
bool RecordSet::moveNext()
|
||||
{
|
||||
if (_currentRow >= rowCount()) return false;
|
||||
++_currentRow;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RecordSet::movePrevious()
|
||||
{
|
||||
if (0 == _currentRow) return false;
|
||||
--_currentRow;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RecordSet::moveLast()
|
||||
{
|
||||
if (rowCount() > 0)
|
||||
{
|
||||
_currentRow = rowCount();
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Session.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/Session.cpp#3 $
|
||||
// $Id: //poco/Main/Data/src/Session.cpp#5 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/SessionFactory.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -50,6 +51,13 @@ Session::Session(Poco::AutoPtr<SessionImpl> ptrImpl):
|
||||
}
|
||||
|
||||
|
||||
Session::Session(const std::string& connector, const std::string& connectionString)
|
||||
{
|
||||
Session newSession(SessionFactory::instance().create(connector, connectionString));
|
||||
swap(newSession);
|
||||
}
|
||||
|
||||
|
||||
Session::Session(const Session& other):
|
||||
_ptrImpl(other._ptrImpl),
|
||||
_statementCreator(other._ptrImpl)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SessionFactory.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/SessionFactory.cpp#4 $
|
||||
// $Id: //poco/Main/Data/src/SessionFactory.cpp#6 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -58,11 +58,11 @@ SessionFactory& SessionFactory::instance()
|
||||
}
|
||||
|
||||
|
||||
void SessionFactory::add(const std::string& key, SessionInstantiator* pIn)
|
||||
void SessionFactory::add(const std::string& key, Connector* pIn)
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
SessionInfo info(pIn);
|
||||
std::pair<Instantiators::iterator, bool> res = _instantiators.insert(std::make_pair(key, info));
|
||||
std::pair<Connectors::iterator, bool> res = _connectors.insert(std::make_pair(key, info));
|
||||
if (!res.second)
|
||||
{
|
||||
res.first->second.cnt++;
|
||||
@@ -73,26 +73,26 @@ void SessionFactory::add(const std::string& key, SessionInstantiator* pIn)
|
||||
void SessionFactory::remove(const std::string& key)
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
Instantiators::iterator it = _instantiators.find(key);
|
||||
poco_assert (_instantiators.end() != it);
|
||||
Connectors::iterator it = _connectors.find(key);
|
||||
poco_assert (_connectors.end() != it);
|
||||
|
||||
--(it->second.cnt);
|
||||
if (it->second.cnt == 0)
|
||||
_instantiators.erase(it);
|
||||
_connectors.erase(it);
|
||||
}
|
||||
|
||||
|
||||
Session SessionFactory::create(const std::string& key, const std::string& initString)
|
||||
Session SessionFactory::create(const std::string& key, const std::string& connectionString)
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
Instantiators::iterator it = _instantiators.find(key);
|
||||
poco_assert (_instantiators.end() != it);
|
||||
Connectors::iterator it = _connectors.find(key);
|
||||
poco_assert (_connectors.end() != it);
|
||||
|
||||
return Session(it->second.ptrSI->create(initString));
|
||||
return Session(it->second.ptrSI->createSession(connectionString));
|
||||
}
|
||||
|
||||
|
||||
SessionFactory::SessionInfo::SessionInfo(SessionInstantiator* pSI):
|
||||
SessionFactory::SessionInfo::SessionInfo(Connector* pSI):
|
||||
cnt(1),
|
||||
ptrSI(pSI)
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SessionPool.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/SessionPool.cpp#2 $
|
||||
// $Id: //poco/Main/Data/src/SessionPool.cpp#3 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: SessionPooling
|
||||
@@ -44,9 +44,9 @@ namespace Poco {
|
||||
namespace Data {
|
||||
|
||||
|
||||
SessionPool::SessionPool(const std::string& sessionKey, const std::string& initString, int minSessions, int maxSessions, int idleTime):
|
||||
SessionPool::SessionPool(const std::string& sessionKey, const std::string& connectionString, int minSessions, int maxSessions, int idleTime):
|
||||
_sessionKey(sessionKey),
|
||||
_initString(initString),
|
||||
_connectionString(connectionString),
|
||||
_minSessions(minSessions),
|
||||
_maxSessions(maxSessions),
|
||||
_idleTime(idleTime),
|
||||
@@ -74,12 +74,12 @@ Session SessionPool::get()
|
||||
{
|
||||
if (_nSessions < _maxSessions)
|
||||
{
|
||||
Session newSession(SessionFactory::instance().create(_sessionKey, _initString));
|
||||
Session newSession(SessionFactory::instance().create(_sessionKey, _connectionString));
|
||||
PooledSessionHolderPtr pHolder(new PooledSessionHolder(*this, newSession.impl()));
|
||||
_idleSessions.push_front(pHolder);
|
||||
++_nSessions;
|
||||
}
|
||||
else throw SessionPoolExhaustedException(_sessionKey, _initString);
|
||||
else throw SessionPoolExhaustedException(_sessionKey, _connectionString);
|
||||
}
|
||||
PooledSessionHolderPtr pHolder(_idleSessions.front());
|
||||
PooledSessionImplPtr pPSI(new PooledSessionImpl(pHolder));
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Statement.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/Statement.cpp#8 $
|
||||
// $Id: //poco/Main/Data/src/Statement.cpp#9 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/Extraction.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include <algorithm>
|
||||
@@ -54,6 +55,14 @@ Statement::Statement(StatementImpl* pImpl):
|
||||
}
|
||||
|
||||
|
||||
Statement::Statement(Session& session):
|
||||
_executed(false)
|
||||
{
|
||||
Statement stmt(session.createStatementImpl());
|
||||
swap(stmt);
|
||||
}
|
||||
|
||||
|
||||
Statement::Statement(const Statement& stmt):
|
||||
_executed(stmt._executed),
|
||||
_ptr(stmt._ptr)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// StatementCreator.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/StatementCreator.cpp#3 $
|
||||
// $Id: //poco/Main/Data/src/StatementCreator.cpp#4 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -42,6 +42,11 @@ namespace Poco {
|
||||
namespace Data {
|
||||
|
||||
|
||||
StatementCreator::StatementCreator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
StatementCreator::StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl):
|
||||
_ptrImpl(ptrImpl)
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/Main/Data/testsuite/Makefile#6 $
|
||||
# $Id: //poco/Main/Data/testsuite/Makefile#7 $
|
||||
#
|
||||
# Makefile for Poco Data testsuite
|
||||
#
|
||||
@@ -10,7 +10,7 @@ include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = DataTestSuite Driver \
|
||||
DataTest SessionPoolTest \
|
||||
Binder Extractor Preparation SessionImpl SessionInstantiator TestStatementImpl
|
||||
Binder Extractor Preparation SessionImpl Connector TestStatementImpl
|
||||
|
||||
target = testrunner
|
||||
target_version = 1
|
||||
|
@@ -201,7 +201,7 @@
|
||||
RelativePath=".\src\SessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.h">
|
||||
RelativePath=".\src\Connector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestStatementImpl.h">
|
||||
@@ -220,7 +220,7 @@
|
||||
RelativePath=".\src\SessionImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp">
|
||||
RelativePath=".\src\Connector.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestStatementImpl.cpp">
|
||||
|
@@ -255,6 +255,10 @@
|
||||
RelativePath=".\src\Binder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Extractor.h"
|
||||
>
|
||||
@@ -267,10 +271,6 @@
|
||||
RelativePath=".\src\SessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestStatementImpl.h"
|
||||
>
|
||||
@@ -283,6 +283,10 @@
|
||||
RelativePath=".\src\Binder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Extractor.cpp"
|
||||
>
|
||||
@@ -295,10 +299,6 @@
|
||||
RelativePath=".\src\SessionImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionInstantiator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestStatementImpl.cpp"
|
||||
>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SessionInstantiator.cpp
|
||||
// Connector.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/testsuite/src/SessionInstantiator.cpp#1 $
|
||||
// $Id: //poco/Main/Data/testsuite/src/Connector.cpp#2 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -30,7 +30,7 @@
|
||||
//
|
||||
|
||||
|
||||
#include "SessionInstantiator.h"
|
||||
#include "Connector.h"
|
||||
#include "SessionImpl.h"
|
||||
#include "Poco/Data/SessionFactory.h"
|
||||
|
||||
@@ -40,32 +40,32 @@ namespace Data {
|
||||
namespace Test {
|
||||
|
||||
|
||||
const std::string SessionInstantiator::KEY("test");
|
||||
const std::string Connector::KEY("test");
|
||||
|
||||
|
||||
SessionInstantiator::SessionInstantiator()
|
||||
Connector::Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SessionInstantiator::~SessionInstantiator()
|
||||
Connector::~Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> SessionInstantiator::create(const std::string& initString)
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> Connector::createSession(const std::string& connectionString)
|
||||
{
|
||||
return Poco::AutoPtr<Poco::Data::SessionImpl>(new SessionImpl(initString));
|
||||
return Poco::AutoPtr<Poco::Data::SessionImpl>(new SessionImpl(connectionString));
|
||||
}
|
||||
|
||||
|
||||
void SessionInstantiator::addToFactory()
|
||||
void Connector::addToFactory()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().add(KEY, new SessionInstantiator());
|
||||
Poco::Data::SessionFactory::instance().add(KEY, new Connector());
|
||||
}
|
||||
|
||||
|
||||
void SessionInstantiator::removeFromFactory()
|
||||
void Connector::removeFromFactory()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().remove(KEY);
|
||||
}
|
@@ -1,9 +1,9 @@
|
||||
//
|
||||
// SessionInstantiator.h
|
||||
// Connector.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/testsuite/src/SessionInstantiator.h#1 $
|
||||
// $Id: //poco/Main/Data/testsuite/src/Connector.h#2 $
|
||||
//
|
||||
// Definition of the SessionInstantiator class.
|
||||
// Definition of the Connector class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -32,11 +32,11 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef Data_Test_SessionInstantiator_INCLUDED
|
||||
#define Data_Test_SessionInstantiator_INCLUDED
|
||||
#ifndef Data_Test_Connector_INCLUDED
|
||||
#define Data_Test_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/SessionInstantiator.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -44,31 +44,31 @@ namespace Data {
|
||||
namespace Test {
|
||||
|
||||
|
||||
class SessionInstantiator: public Poco::Data::SessionInstantiator
|
||||
/// SessionInstantiator instantiates SessionImpl objects for testing.
|
||||
class Connector: public Poco::Data::Connector
|
||||
/// Connector instantiates SessionImpl objects for testing.
|
||||
{
|
||||
public:
|
||||
static const std::string KEY;
|
||||
/// Keyword for creating test sessions.
|
||||
|
||||
SessionInstantiator();
|
||||
/// Creates the SessionInstantiator.
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
~SessionInstantiator();
|
||||
/// Destroys the SessionInstantiator.
|
||||
~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> create(const std::string& initString);
|
||||
/// Creates a test SessionImpl object and initializes it with the given initString.
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||
/// Creates a test SessionImpl object and initializes it with the given connectionString.
|
||||
|
||||
static void addToFactory();
|
||||
/// Registers the SessionInstantiator under the Keyword SessionInstantiator::KEY at the Poco::Data::SessionFactory.
|
||||
/// Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory.
|
||||
|
||||
static void removeFromFactory();
|
||||
/// Unregisters the SessionInstantiator under the Keyword SessionInstantiator::KEY at the Poco::Data::SessionFactory.
|
||||
/// Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory.
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::Test
|
||||
|
||||
|
||||
#endif // Data_Test_SessionInstantiator_INCLUDED
|
||||
#endif // Data_Test_Connector_INCLUDED
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DataTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/testsuite/src/DataTest.cpp#8 $
|
||||
// $Id: //poco/Main/Data/testsuite/src/DataTest.cpp#9 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "Poco/Data/BLOBStream.h"
|
||||
#include "Poco/Data/MetaColumn.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "SessionInstantiator.h"
|
||||
#include "Connector.h"
|
||||
#include "Poco/BinaryReader.h"
|
||||
#include "Poco/BinaryWriter.h"
|
||||
#include "Poco/Types.h"
|
||||
@@ -57,13 +57,13 @@ using Poco::RangeException;
|
||||
|
||||
DataTest::DataTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
Poco::Data::Test::SessionInstantiator::addToFactory();
|
||||
Poco::Data::Test::Connector::addToFactory();
|
||||
}
|
||||
|
||||
|
||||
DataTest::~DataTest()
|
||||
{
|
||||
Poco::Data::Test::SessionInstantiator::removeFromFactory();
|
||||
Poco::Data::Test::Connector::removeFromFactory();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SessionPoolTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/testsuite/src/SessionPoolTest.cpp#2 $
|
||||
// $Id: //poco/Main/Data/testsuite/src/SessionPoolTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "Poco/Data/Common.h"
|
||||
#include "Poco/Data/SessionPool.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "SessionInstantiator.h"
|
||||
#include "Connector.h"
|
||||
|
||||
|
||||
using namespace Poco::Data;
|
||||
@@ -45,13 +45,13 @@ using Poco::Thread;
|
||||
|
||||
SessionPoolTest::SessionPoolTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
Poco::Data::Test::SessionInstantiator::addToFactory();
|
||||
Poco::Data::Test::Connector::addToFactory();
|
||||
}
|
||||
|
||||
|
||||
SessionPoolTest::~SessionPoolTest()
|
||||
{
|
||||
Poco::Data::Test::SessionInstantiator::removeFromFactory();
|
||||
Poco::Data::Test::Connector::removeFromFactory();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user