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">
|
RelativePath=".\include\Poco\Data\SessionImpl.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\SessionInstantiator.h">
|
RelativePath=".\include\Poco\Data\Connector.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\Statement.h">
|
RelativePath=".\include\Poco\Data\Statement.h">
|
||||||
@@ -288,7 +288,7 @@
|
|||||||
RelativePath=".\src\SessionImpl.cpp">
|
RelativePath=".\src\SessionImpl.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\SessionInstantiator.cpp">
|
RelativePath=".\src\Connector.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Statement.cpp">
|
RelativePath=".\src\Statement.cpp">
|
||||||
|
@@ -257,6 +257,10 @@
|
|||||||
RelativePath=".\include\Poco\Data\Common.h"
|
RelativePath=".\include\Poco\Data\Common.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\Data\Connector.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\Data.h"
|
RelativePath=".\include\Poco\Data\Data.h"
|
||||||
>
|
>
|
||||||
@@ -301,10 +305,6 @@
|
|||||||
RelativePath=".\include\Poco\Data\SessionImpl.h"
|
RelativePath=".\include\Poco\Data\SessionImpl.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\include\Poco\Data\SessionInstantiator.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\Statement.h"
|
RelativePath=".\include\Poco\Data\Statement.h"
|
||||||
>
|
>
|
||||||
@@ -357,6 +357,10 @@
|
|||||||
RelativePath=".\src\BLOBStream.cpp"
|
RelativePath=".\src\BLOBStream.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Connector.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\DataException.cpp"
|
RelativePath=".\src\DataException.cpp"
|
||||||
>
|
>
|
||||||
@@ -389,10 +393,6 @@
|
|||||||
RelativePath=".\src\SessionImpl.cpp"
|
RelativePath=".\src\SessionImpl.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\SessionInstantiator.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Statement.cpp"
|
RelativePath=".\src\Statement.cpp"
|
||||||
>
|
>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile
|
# Makefile
|
||||||
#
|
#
|
||||||
# $Id: //poco/Main/Data/Makefile#10 $
|
# $Id: //poco/Main/Data/Makefile#11 $
|
||||||
#
|
#
|
||||||
# Makefile for Poco Data
|
# Makefile for Poco Data
|
||||||
#
|
#
|
||||||
@@ -13,7 +13,7 @@ objects = AbstractBinder AbstractBinding AbstractExtraction \
|
|||||||
BLOB BLOBStream DataException Limit MetaColumn \
|
BLOB BLOBStream DataException Limit MetaColumn \
|
||||||
PooledSessionHolder PooledSessionImpl \
|
PooledSessionHolder PooledSessionImpl \
|
||||||
Range RecordSet Session SessionFactory SessionImpl \
|
Range RecordSet Session SessionFactory SessionImpl \
|
||||||
SessionInstantiator SessionPool Statement StatementCreator StatementImpl
|
Connector SessionPool Statement StatementCreator StatementImpl
|
||||||
|
|
||||||
target = PocoData
|
target = PocoData
|
||||||
target_version = $(LIBVERSION)
|
target_version = $(LIBVERSION)
|
||||||
|
@@ -16,7 +16,7 @@ endif
|
|||||||
|
|
||||||
objects = Binder ConnectionHandle DataTypes EnvironmentHandle \
|
objects = Binder ConnectionHandle DataTypes EnvironmentHandle \
|
||||||
Extractor ODBCColumn ODBCException ODBCStatementImpl Parameter Preparation \
|
Extractor ODBCColumn ODBCException ODBCStatementImpl Parameter Preparation \
|
||||||
SessionImpl SessionInstantiator Utility
|
SessionImpl Connector Utility
|
||||||
|
|
||||||
target = PocoODBC
|
target = PocoODBC
|
||||||
target_version = $(LIBVERSION)
|
target_version = $(LIBVERSION)
|
||||||
|
@@ -154,6 +154,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\Odbc\ConnectionHandle.h">
|
RelativePath=".\include\Poco\Data\Odbc\ConnectionHandle.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\Data\Odbc\Connector.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\Odbc\DataTypes.h">
|
RelativePath=".\include\Poco\Data\Odbc\DataTypes.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -193,9 +196,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\Odbc\SessionImpl.h">
|
RelativePath=".\include\Poco\Data\Odbc\SessionImpl.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\include\Poco\Data\Odbc\SessionInstantiator.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\Odbc\Utility.h">
|
RelativePath=".\include\Poco\Data\Odbc\Utility.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -209,6 +209,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\ConnectionHandle.cpp">
|
RelativePath=".\src\ConnectionHandle.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Connector.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\DataTypes.cpp">
|
RelativePath=".\src\DataTypes.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -236,9 +239,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\SessionImpl.cpp">
|
RelativePath=".\src\SessionImpl.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\SessionInstantiator.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Utility.cpp">
|
RelativePath=".\src\Utility.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -217,6 +217,10 @@
|
|||||||
RelativePath=".\include\Poco\Data\ODBC\ConnectionHandle.h"
|
RelativePath=".\include\Poco\Data\ODBC\ConnectionHandle.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\Data\ODBC\Connector.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\ODBC\DataTypes.h"
|
RelativePath=".\include\Poco\Data\ODBC\DataTypes.h"
|
||||||
>
|
>
|
||||||
@@ -269,10 +273,6 @@
|
|||||||
RelativePath=".\include\Poco\Data\ODBC\SessionImpl.h"
|
RelativePath=".\include\Poco\Data\ODBC\SessionImpl.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\include\Poco\Data\ODBC\SessionInstantiator.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\ODBC\Utility.h"
|
RelativePath=".\include\Poco\Data\ODBC\Utility.h"
|
||||||
>
|
>
|
||||||
@@ -289,6 +289,10 @@
|
|||||||
RelativePath=".\src\ConnectionHandle.cpp"
|
RelativePath=".\src\ConnectionHandle.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Connector.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\DataTypes.cpp"
|
RelativePath=".\src\DataTypes.cpp"
|
||||||
>
|
>
|
||||||
@@ -325,10 +329,6 @@
|
|||||||
RelativePath=".\src\SessionImpl.cpp"
|
RelativePath=".\src\SessionImpl.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\SessionInstantiator.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Utility.cpp"
|
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
|
// Library: ODBC
|
||||||
// Package: 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -36,12 +36,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef DataConnectors_ODBC_SessionInstantiator_INCLUDED
|
#ifndef DataConnectors_ODBC_Connector_INCLUDED
|
||||||
#define DataConnectors_ODBC_SessionInstantiator_INCLUDED
|
#define DataConnectors_ODBC_Connector_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/ODBC/ODBC.h"
|
#include "Poco/Data/ODBC/ODBC.h"
|
||||||
#include "Poco/Data/SessionInstantiator.h"
|
#include "Poco/Data/Connector.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@@ -49,31 +49,31 @@ namespace Data {
|
|||||||
namespace ODBC {
|
namespace ODBC {
|
||||||
|
|
||||||
|
|
||||||
class ODBC_API SessionInstantiator: public Poco::Data::SessionInstantiator
|
class ODBC_API Connector: public Poco::Data::Connector
|
||||||
/// SessionInstantiator instantiates SqLite SessionImpl objects.
|
/// Connector instantiates SqLite SessionImpl objects.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const std::string KEY;
|
static const std::string KEY;
|
||||||
/// Keyword for creating ODBC sessions
|
/// Keyword for creating ODBC sessions
|
||||||
|
|
||||||
SessionInstantiator();
|
Connector();
|
||||||
/// Creates the SessionInstantiator.
|
/// Creates the Connector.
|
||||||
|
|
||||||
~SessionInstantiator();
|
~Connector();
|
||||||
/// Destroys the SessionInstantiator.
|
/// Destroys the Connector.
|
||||||
|
|
||||||
Poco::AutoPtr<Poco::Data::SessionImpl> create(const std::string& initString);
|
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||||
/// Creates a ODBC SessionImpl object and initializes it with the given initString.
|
/// Creates a ODBC SessionImpl object and initializes it with the given connectionString.
|
||||||
|
|
||||||
static void addToFactory();
|
static void registerConnector();
|
||||||
/// 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();
|
static void unregisterConnector();
|
||||||
/// 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::ODBC
|
} } } // 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
|
// Library: ODBC
|
||||||
// Package: ODBC
|
// Package: ODBC
|
||||||
// Module: SessionInstantiator
|
// Module: Connector
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// 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/ODBC/SessionImpl.h"
|
||||||
#include "Poco/Data/SessionFactory.h"
|
#include "Poco/Data/SessionFactory.h"
|
||||||
|
|
||||||
@@ -44,32 +44,32 @@ namespace Data {
|
|||||||
namespace ODBC {
|
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);
|
Poco::Data::SessionFactory::instance().remove(KEY);
|
||||||
}
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ODBCAccessTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
@@ -69,7 +69,7 @@ ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::SessionInstantiator::addToFactory();
|
ODBC::Connector::registerConnector();
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
@@ -80,7 +80,7 @@ ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
}catch (ConnectionException& ex)
|
}catch (ConnectionException& ex)
|
||||||
{
|
{
|
||||||
std::cout << "!!! WARNING: Connection failed. Access tests will fail !!!" << std::endl;
|
std::cout << "!!! WARNING: Connection failed. Access tests will fail !!!" << std::endl;
|
||||||
@@ -100,7 +100,7 @@ ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCAccessTest::~ODBCAccessTest()
|
ODBCAccessTest::~ODBCAccessTest()
|
||||||
{
|
{
|
||||||
ODBC::SessionInstantiator::removeFromFactory();
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ODBCDB2Test.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
@@ -71,7 +71,7 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::SessionInstantiator::addToFactory();
|
ODBC::Connector::registerConnector();
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
@@ -82,7 +82,7 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
}catch (ConnectionException& ex)
|
}catch (ConnectionException& ex)
|
||||||
{
|
{
|
||||||
std::cout << "!!! WARNING: Connection failed. DB2 tests will fail !!!" << std::endl;
|
std::cout << "!!! WARNING: Connection failed. DB2 tests will fail !!!" << std::endl;
|
||||||
@@ -103,7 +103,7 @@ ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
|||||||
|
|
||||||
ODBCDB2Test::~ODBCDB2Test()
|
ODBCDB2Test::~ODBCDB2Test()
|
||||||
{
|
{
|
||||||
ODBC::SessionInstantiator::removeFromFactory();
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ODBCMySQLTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
@@ -71,7 +71,7 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::SessionInstantiator::addToFactory();
|
ODBC::Connector::registerConnector();
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
@@ -82,7 +82,7 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
}catch (ConnectionException& ex)
|
}catch (ConnectionException& ex)
|
||||||
{
|
{
|
||||||
std::cout << "!!! WARNING: Connection failed. MySQL tests will fail !!!" << std::endl;
|
std::cout << "!!! WARNING: Connection failed. MySQL tests will fail !!!" << std::endl;
|
||||||
@@ -103,7 +103,7 @@ ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCMySQLTest::~ODBCMySQLTest()
|
ODBCMySQLTest::~ODBCMySQLTest()
|
||||||
{
|
{
|
||||||
ODBC::SessionInstantiator::removeFromFactory();
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ODBCOracleTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
@@ -71,7 +71,7 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::SessionInstantiator::addToFactory();
|
ODBC::Connector::registerConnector();
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
@@ -82,7 +82,7 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
}catch (ConnectionException& ex)
|
}catch (ConnectionException& ex)
|
||||||
{
|
{
|
||||||
std::cout << "!!! WARNING: Connection failed. Oracle tests will fail !!!" << std::endl;
|
std::cout << "!!! WARNING: Connection failed. Oracle tests will fail !!!" << std::endl;
|
||||||
@@ -103,7 +103,7 @@ ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCOracleTest::~ODBCOracleTest()
|
ODBCOracleTest::~ODBCOracleTest()
|
||||||
{
|
{
|
||||||
ODBC::SessionInstantiator::removeFromFactory();
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ODBCPostgreSQLTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
@@ -71,7 +71,7 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::SessionInstantiator::addToFactory();
|
ODBC::Connector::registerConnector();
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
@@ -82,7 +82,7 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
}catch (ConnectionException& ex)
|
}catch (ConnectionException& ex)
|
||||||
{
|
{
|
||||||
std::cout << "!!! WARNING: Connection failed. PostgreSQL tests will fail !!!" << std::endl;
|
std::cout << "!!! WARNING: Connection failed. PostgreSQL tests will fail !!!" << std::endl;
|
||||||
@@ -103,7 +103,7 @@ ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCPostgreSQLTest::~ODBCPostgreSQLTest()
|
ODBCPostgreSQLTest::~ODBCPostgreSQLTest()
|
||||||
{
|
{
|
||||||
ODBC::SessionInstantiator::removeFromFactory();
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ODBCSQLServerTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
@@ -71,7 +71,7 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::SessionInstantiator::addToFactory();
|
ODBC::Connector::registerConnector();
|
||||||
if (_drivers.empty() || _dataSources.empty())
|
if (_drivers.empty() || _dataSources.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
@@ -82,7 +82,7 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
}catch (ConnectionException& ex)
|
}catch (ConnectionException& ex)
|
||||||
{
|
{
|
||||||
std::cout << "!!! WARNING: Connection failed. SQL Server tests will fail !!!" << std::endl;
|
std::cout << "!!! WARNING: Connection failed. SQL Server tests will fail !!!" << std::endl;
|
||||||
@@ -103,7 +103,7 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCSQLServerTest::~ODBCSQLServerTest()
|
ODBCSQLServerTest::~ODBCSQLServerTest()
|
||||||
{
|
{
|
||||||
ODBC::SessionInstantiator::removeFromFactory();
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ODBCSQLiteTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
@@ -69,7 +69,7 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
static bool beenHere = false;
|
static bool beenHere = false;
|
||||||
|
|
||||||
ODBC::SessionInstantiator::addToFactory();
|
ODBC::Connector::registerConnector();
|
||||||
if (_drivers.empty())
|
if (_drivers.empty())
|
||||||
{
|
{
|
||||||
Utility::drivers(_drivers);
|
Utility::drivers(_drivers);
|
||||||
@@ -79,7 +79,7 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pSession = new Session(SessionFactory::instance().create(ODBC::SessionInstantiator::KEY, _dbConnString));
|
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
|
||||||
}catch (ConnectionException& ex)
|
}catch (ConnectionException& ex)
|
||||||
{
|
{
|
||||||
std::cout << "!!! WARNING: Connection failed. SQLite tests will fail !!!" << std::endl;
|
std::cout << "!!! WARNING: Connection failed. SQLite tests will fail !!!" << std::endl;
|
||||||
@@ -100,7 +100,7 @@ ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
|||||||
|
|
||||||
ODBCSQLiteTest::~ODBCSQLiteTest()
|
ODBCSQLiteTest::~ODBCSQLiteTest()
|
||||||
{
|
{
|
||||||
ODBC::SessionInstantiator::removeFromFactory();
|
ODBC::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/StatementImpl.h"
|
#include "Poco/Data/StatementImpl.h"
|
||||||
#include "Poco/Data/RecordSet.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/Utility.h"
|
||||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||||
#include "Poco/Data/ODBC/Preparation.h"
|
#include "Poco/Data/ODBC/Preparation.h"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile
|
# Makefile
|
||||||
#
|
#
|
||||||
# $Id: //poco/Main/Data/SQLite/Makefile#2 $
|
# $Id: //poco/Main/Data/SQLite/Makefile#3 $
|
||||||
#
|
#
|
||||||
# Makefile for Poco SQLite
|
# Makefile for Poco SQLite
|
||||||
#
|
#
|
||||||
@@ -10,7 +10,7 @@ include $(POCO_BASE)/build/rules/global
|
|||||||
|
|
||||||
SYSFLAGS += -DTHREADSAFE -DNO_TCL
|
SYSFLAGS += -DTHREADSAFE -DNO_TCL
|
||||||
|
|
||||||
objects = Binder Extractor SessionImpl SessionInstantiator \
|
objects = Binder Extractor SessionImpl Connector \
|
||||||
SQLiteException SQLiteStatementImpl Utility \
|
SQLiteException SQLiteStatementImpl Utility \
|
||||||
sqlite3
|
sqlite3
|
||||||
|
|
||||||
|
@@ -158,7 +158,7 @@
|
|||||||
RelativePath=".\include\Poco\Data\SQLite\SessionImpl.h">
|
RelativePath=".\include\Poco\Data\SQLite\SessionImpl.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\SQLite\SessionInstantiator.h">
|
RelativePath=".\include\Poco\Data\SQLite\Connector.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\SQLite\SQLite.h">
|
RelativePath=".\include\Poco\Data\SQLite\SQLite.h">
|
||||||
@@ -186,7 +186,7 @@
|
|||||||
RelativePath=".\src\SessionImpl.cpp">
|
RelativePath=".\src\SessionImpl.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\SessionInstantiator.cpp">
|
RelativePath=".\src\Connector.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\SQLiteException.cpp">
|
RelativePath=".\src\SQLiteException.cpp">
|
||||||
|
@@ -213,6 +213,10 @@
|
|||||||
RelativePath=".\include\Poco\Data\SQLite\Binder.h"
|
RelativePath=".\include\Poco\Data\SQLite\Binder.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\Data\SQLite\Connector.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\SQLite\Extractor.h"
|
RelativePath=".\include\Poco\Data\SQLite\Extractor.h"
|
||||||
>
|
>
|
||||||
@@ -221,10 +225,6 @@
|
|||||||
RelativePath=".\include\Poco\Data\SQLite\SessionImpl.h"
|
RelativePath=".\include\Poco\Data\SQLite\SessionImpl.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\include\Poco\Data\SQLite\SessionInstantiator.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Data\SQLite\SQLite.h"
|
RelativePath=".\include\Poco\Data\SQLite\SQLite.h"
|
||||||
>
|
>
|
||||||
@@ -249,6 +249,10 @@
|
|||||||
RelativePath=".\src\Binder.cpp"
|
RelativePath=".\src\Binder.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Connector.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Extractor.cpp"
|
RelativePath=".\src\Extractor.cpp"
|
||||||
>
|
>
|
||||||
@@ -257,10 +261,6 @@
|
|||||||
RelativePath=".\src\SessionImpl.cpp"
|
RelativePath=".\src\SessionImpl.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\SessionInstantiator.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\SQLiteException.cpp"
|
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
|
// Library: SQLite
|
||||||
// Package: 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -36,12 +36,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef DataConnectors_SQLite_SessionInstantiator_INCLUDED
|
#ifndef DataConnectors_SQLite_Connector_INCLUDED
|
||||||
#define DataConnectors_SQLite_SessionInstantiator_INCLUDED
|
#define DataConnectors_SQLite_Connector_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/SQLite/SQLite.h"
|
#include "Poco/Data/SQLite/SQLite.h"
|
||||||
#include "Poco/Data/SessionInstantiator.h"
|
#include "Poco/Data/Connector.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@@ -49,31 +49,31 @@ namespace Data {
|
|||||||
namespace SQLite {
|
namespace SQLite {
|
||||||
|
|
||||||
|
|
||||||
class SQLite_API SessionInstantiator: public Poco::Data::SessionInstantiator
|
class SQLite_API Connector: public Poco::Data::Connector
|
||||||
/// SessionInstantiator instantiates SqLite SessionImpl objects.
|
/// Connector instantiates SqLite SessionImpl objects.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const std::string KEY;
|
static const std::string KEY;
|
||||||
/// Keyword for creating SQLite sessions.
|
/// Keyword for creating SQLite sessions ("SQLite").
|
||||||
|
|
||||||
SessionInstantiator();
|
Connector();
|
||||||
/// Creates the SessionInstantiator.
|
/// Creates the Connector.
|
||||||
|
|
||||||
~SessionInstantiator();
|
~Connector();
|
||||||
/// Destroys the SessionInstantiator.
|
/// Destroys the Connector.
|
||||||
|
|
||||||
Poco::AutoPtr<Poco::Data::SessionImpl> create(const std::string& initString);
|
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||||
/// Creates a SQLite SessionImpl object and initializes it with the given initString.
|
/// Creates a SQLite SessionImpl object and initializes it with the given connectionString.
|
||||||
|
|
||||||
static void addToFactory();
|
static void registerConnector();
|
||||||
/// 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();
|
static void unregisterConnector();
|
||||||
/// 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::SQLite
|
} } } // 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
|
// Library: SQLite
|
||||||
// Package: SQLite
|
// Package: SQLite
|
||||||
// Module: SessionInstantiator
|
// Module: Connector
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// 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/SQLite/SessionImpl.h"
|
||||||
#include "Poco/Data/SessionFactory.h"
|
#include "Poco/Data/SessionFactory.h"
|
||||||
|
|
||||||
@@ -44,32 +44,32 @@ namespace Data {
|
|||||||
namespace SQLite {
|
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);
|
Poco::Data::SessionFactory::instance().remove(KEY);
|
||||||
}
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SQLiteTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "Poco/Data/BLOB.h"
|
#include "Poco/Data/BLOB.h"
|
||||||
#include "Poco/Data/Statement.h"
|
#include "Poco/Data/Statement.h"
|
||||||
#include "Poco/Data/RecordSet.h"
|
#include "Poco/Data/RecordSet.h"
|
||||||
#include "Poco/Data/SQLite/SessionInstantiator.h"
|
#include "Poco/Data/SQLite/Connector.h"
|
||||||
#include "Poco/Tuple.h"
|
#include "Poco/Tuple.h"
|
||||||
#include "Poco/Any.h"
|
#include "Poco/Any.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
@@ -153,13 +153,13 @@ private:
|
|||||||
|
|
||||||
SQLiteTest::SQLiteTest(const std::string& name): CppUnit::TestCase(name)
|
SQLiteTest::SQLiteTest(const std::string& name): CppUnit::TestCase(name)
|
||||||
{
|
{
|
||||||
SQLite::SessionInstantiator::addToFactory();
|
SQLite::Connector::registerConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SQLiteTest::~SQLiteTest()
|
SQLiteTest::~SQLiteTest()
|
||||||
{
|
{
|
||||||
SQLite::SessionInstantiator::removeFromFactory();
|
SQLite::Connector::unregisterConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ void SQLiteTest::testTAC()
|
|||||||
if (aFile.exists())
|
if (aFile.exists())
|
||||||
aFile.remove();
|
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 << "CREATE TABLE LogTest (Id INTEGER PRIMARY KEY, Time INTEGER, Value INTEGER)", now;
|
||||||
//ses << "PRAGMA synchronous = OFF", now;
|
//ses << "PRAGMA synchronous = OFF", now;
|
||||||
@@ -193,7 +193,7 @@ void SQLiteTest::testTAC()
|
|||||||
|
|
||||||
void SQLiteTest::testSimpleAccess()
|
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());
|
assert (tmp.isConnected());
|
||||||
std::string tableName("Person");
|
std::string tableName("Person");
|
||||||
std::string lastName("lastname");
|
std::string lastName("lastname");
|
||||||
@@ -221,7 +221,7 @@ void SQLiteTest::testSimpleAccess()
|
|||||||
|
|
||||||
void SQLiteTest::testInsertCharPointer()
|
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 tableName("Person");
|
||||||
std::string lastName("lastname");
|
std::string lastName("lastname");
|
||||||
std::string firstName("firstname");
|
std::string firstName("firstname");
|
||||||
@@ -245,7 +245,7 @@ void SQLiteTest::testInsertCharPointer()
|
|||||||
|
|
||||||
void SQLiteTest::testInsertCharPointer2()
|
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 tableName("Person");
|
||||||
std::string lastName("lastname");
|
std::string lastName("lastname");
|
||||||
std::string firstName("firstname");
|
std::string firstName("firstname");
|
||||||
@@ -271,7 +271,7 @@ void SQLiteTest::testInsertCharPointer2()
|
|||||||
|
|
||||||
void SQLiteTest::testComplexType()
|
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 p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
tmp << "DROP TABLE IF EXISTS Person", now;
|
tmp << "DROP TABLE IF EXISTS Person", now;
|
||||||
@@ -292,7 +292,7 @@ void SQLiteTest::testComplexType()
|
|||||||
|
|
||||||
void SQLiteTest::testSimpleAccessVector()
|
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> lastNames;
|
||||||
std::vector<std::string> firstNames;
|
std::vector<std::string> firstNames;
|
||||||
std::vector<std::string> addresses;
|
std::vector<std::string> addresses;
|
||||||
@@ -329,7 +329,7 @@ void SQLiteTest::testSimpleAccessVector()
|
|||||||
|
|
||||||
void SQLiteTest::testComplexTypeVector()
|
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;
|
std::vector<Person> people;
|
||||||
people.push_back(Person("LN1", "FN1", "ADDR1", 1));
|
people.push_back(Person("LN1", "FN1", "ADDR1", 1));
|
||||||
people.push_back(Person("LN2", "FN2", "ADDR2", 2));
|
people.push_back(Person("LN2", "FN2", "ADDR2", 2));
|
||||||
@@ -348,7 +348,7 @@ void SQLiteTest::testComplexTypeVector()
|
|||||||
|
|
||||||
void SQLiteTest::testInsertVector()
|
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;
|
std::vector<std::string> str;
|
||||||
str.push_back("s1");
|
str.push_back("s1");
|
||||||
str.push_back("s2");
|
str.push_back("s2");
|
||||||
@@ -373,7 +373,7 @@ void SQLiteTest::testInsertVector()
|
|||||||
|
|
||||||
void SQLiteTest::testInsertEmptyVector()
|
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;
|
std::vector<std::string> str;
|
||||||
|
|
||||||
int count = 100;
|
int count = 100;
|
||||||
@@ -392,7 +392,7 @@ void SQLiteTest::testInsertEmptyVector()
|
|||||||
|
|
||||||
void SQLiteTest::testInsertSingleBulk()
|
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 << "DROP TABLE IF EXISTS Strings", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
@@ -413,7 +413,7 @@ void SQLiteTest::testInsertSingleBulk()
|
|||||||
|
|
||||||
void SQLiteTest::testInsertSingleBulkVec()
|
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 << "DROP TABLE IF EXISTS Strings", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||||
std::vector<int> data;
|
std::vector<int> data;
|
||||||
@@ -438,7 +438,7 @@ void SQLiteTest::testInsertSingleBulkVec()
|
|||||||
|
|
||||||
void SQLiteTest::testLimit()
|
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 << "DROP TABLE IF EXISTS Strings", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||||
std::vector<int> data;
|
std::vector<int> data;
|
||||||
@@ -461,7 +461,7 @@ void SQLiteTest::testLimit()
|
|||||||
|
|
||||||
void SQLiteTest::testLimitZero()
|
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 << "DROP TABLE IF EXISTS Strings", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||||
std::vector<int> data;
|
std::vector<int> data;
|
||||||
@@ -480,7 +480,7 @@ void SQLiteTest::testLimitZero()
|
|||||||
|
|
||||||
void SQLiteTest::testLimitOnce()
|
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 << "DROP TABLE IF EXISTS Strings", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||||
std::vector<int> data;
|
std::vector<int> data;
|
||||||
@@ -511,7 +511,7 @@ void SQLiteTest::testLimitOnce()
|
|||||||
|
|
||||||
void SQLiteTest::testLimitPrepare()
|
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 << "DROP TABLE IF EXISTS Strings", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||||
std::vector<int> data;
|
std::vector<int> data;
|
||||||
@@ -545,7 +545,7 @@ void SQLiteTest::testLimitPrepare()
|
|||||||
|
|
||||||
void SQLiteTest::testPrepare()
|
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 << "DROP TABLE IF EXISTS Strings", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Strings (str INTEGER(10))", now;
|
||||||
std::vector<int> data;
|
std::vector<int> data;
|
||||||
@@ -566,7 +566,7 @@ void SQLiteTest::testPrepare()
|
|||||||
|
|
||||||
void SQLiteTest::testSetSimple()
|
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> lastNames;
|
||||||
std::set<std::string> firstNames;
|
std::set<std::string> firstNames;
|
||||||
std::set<std::string> addresses;
|
std::set<std::string> addresses;
|
||||||
@@ -603,7 +603,7 @@ void SQLiteTest::testSetSimple()
|
|||||||
|
|
||||||
void SQLiteTest::testSetComplex()
|
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;
|
std::set<Person> people;
|
||||||
people.insert(Person("LN1", "FN1", "ADDR1", 1));
|
people.insert(Person("LN1", "FN1", "ADDR1", 1));
|
||||||
people.insert(Person("LN2", "FN2", "ADDR2", 2));
|
people.insert(Person("LN2", "FN2", "ADDR2", 2));
|
||||||
@@ -622,7 +622,7 @@ void SQLiteTest::testSetComplex()
|
|||||||
|
|
||||||
void SQLiteTest::testSetComplexUnique()
|
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;
|
std::vector<Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
people.push_back(p1);
|
people.push_back(p1);
|
||||||
@@ -648,7 +648,7 @@ void SQLiteTest::testSetComplexUnique()
|
|||||||
|
|
||||||
void SQLiteTest::testMultiSetSimple()
|
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> lastNames;
|
||||||
std::multiset<std::string> firstNames;
|
std::multiset<std::string> firstNames;
|
||||||
std::multiset<std::string> addresses;
|
std::multiset<std::string> addresses;
|
||||||
@@ -685,7 +685,7 @@ void SQLiteTest::testMultiSetSimple()
|
|||||||
|
|
||||||
void SQLiteTest::testMultiSetComplex()
|
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;
|
std::multiset<Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
people.insert(p1);
|
people.insert(p1);
|
||||||
@@ -710,7 +710,7 @@ void SQLiteTest::testMultiSetComplex()
|
|||||||
|
|
||||||
void SQLiteTest::testMapComplex()
|
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;
|
std::map<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -731,7 +731,7 @@ void SQLiteTest::testMapComplex()
|
|||||||
|
|
||||||
void SQLiteTest::testMapComplexUnique()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -755,7 +755,7 @@ void SQLiteTest::testMapComplexUnique()
|
|||||||
|
|
||||||
void SQLiteTest::testMultiMapComplex()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -779,7 +779,7 @@ void SQLiteTest::testMultiMapComplex()
|
|||||||
|
|
||||||
void SQLiteTest::testSelectIntoSingle()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -799,7 +799,7 @@ void SQLiteTest::testSelectIntoSingle()
|
|||||||
|
|
||||||
void SQLiteTest::testSelectIntoSingleStep()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -824,7 +824,7 @@ void SQLiteTest::testSelectIntoSingleStep()
|
|||||||
|
|
||||||
void SQLiteTest::testSelectIntoSingleFail()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -850,7 +850,7 @@ void SQLiteTest::testSelectIntoSingleFail()
|
|||||||
|
|
||||||
void SQLiteTest::testLowerLimitOk()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -876,7 +876,7 @@ void SQLiteTest::testLowerLimitOk()
|
|||||||
|
|
||||||
void SQLiteTest::testSingleSelect()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -901,7 +901,7 @@ void SQLiteTest::testSingleSelect()
|
|||||||
|
|
||||||
void SQLiteTest::testLowerLimitFail()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -927,7 +927,7 @@ void SQLiteTest::testLowerLimitFail()
|
|||||||
|
|
||||||
void SQLiteTest::testCombinedLimits()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -950,7 +950,7 @@ void SQLiteTest::testCombinedLimits()
|
|||||||
|
|
||||||
void SQLiteTest::testRange()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -972,7 +972,7 @@ void SQLiteTest::testRange()
|
|||||||
|
|
||||||
void SQLiteTest::testCombinedIllegalLimits()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -999,7 +999,7 @@ void SQLiteTest::testCombinedIllegalLimits()
|
|||||||
|
|
||||||
void SQLiteTest::testIllegalRange()
|
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;
|
std::multimap<std::string, Person> people;
|
||||||
Person p1("LN1", "FN1", "ADDR1", 1);
|
Person p1("LN1", "FN1", "ADDR1", 1);
|
||||||
Person p2("LN2", "FN2", "ADDR2", 2);
|
Person p2("LN2", "FN2", "ADDR2", 2);
|
||||||
@@ -1025,7 +1025,7 @@ void SQLiteTest::testIllegalRange()
|
|||||||
|
|
||||||
void SQLiteTest::testEmptyDB()
|
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 << "DROP TABLE IF EXISTS Person", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", 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 lastName("lastname");
|
||||||
std::string firstName("firstname");
|
std::string firstName("firstname");
|
||||||
std::string address("Address");
|
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 << "DROP TABLE IF EXISTS Person", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Image BLOB)", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Image BLOB)", now;
|
||||||
BLOB img("0123456789", 10);
|
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
|
// 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 << "DROP TABLE IF EXISTS Person", now;
|
||||||
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Image BLOB)", now;
|
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Image BLOB)", now;
|
||||||
BLOB img("0123456789", 10);
|
BLOB img("0123456789", 10);
|
||||||
@@ -1084,7 +1084,7 @@ void SQLiteTest::testBLOBStmt()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple10()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||||
@@ -1103,7 +1103,7 @@ void SQLiteTest::testTuple10()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector10()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||||
@@ -1132,7 +1132,7 @@ void SQLiteTest::testTupleVector10()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple9()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||||
@@ -1151,7 +1151,7 @@ void SQLiteTest::testTuple9()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector9()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||||
@@ -1180,7 +1180,7 @@ void SQLiteTest::testTupleVector9()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple8()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||||
@@ -1199,7 +1199,7 @@ void SQLiteTest::testTuple8()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector8()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER, "
|
||||||
@@ -1228,7 +1228,7 @@ void SQLiteTest::testTupleVector8()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple7()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER)", now;
|
"(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()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER, int6 INTEGER)", now;
|
"(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()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER)", now;
|
||||||
@@ -1292,7 +1292,7 @@ void SQLiteTest::testTuple6()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector6()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER, int5 INTEGER)", now;
|
||||||
@@ -1320,7 +1320,7 @@ void SQLiteTest::testTupleVector6()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple5()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER)", now;
|
||||||
@@ -1338,7 +1338,7 @@ void SQLiteTest::testTuple5()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector5()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER, int4 INTEGER)", now;
|
||||||
@@ -1366,7 +1366,7 @@ void SQLiteTest::testTupleVector5()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple4()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER)", now;
|
||||||
@@ -1384,7 +1384,7 @@ void SQLiteTest::testTuple4()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector4()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER, int3 INTEGER)", now;
|
||||||
@@ -1412,7 +1412,7 @@ void SQLiteTest::testTupleVector4()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple3()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER)", now;
|
||||||
@@ -1430,7 +1430,7 @@ void SQLiteTest::testTuple3()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector3()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples "
|
tmp << "CREATE TABLE Tuples "
|
||||||
"(int0 INTEGER, int1 INTEGER, int2 INTEGER)", now;
|
"(int0 INTEGER, int1 INTEGER, int2 INTEGER)", now;
|
||||||
@@ -1458,7 +1458,7 @@ void SQLiteTest::testTupleVector3()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple2()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples (int0 INTEGER, int1 INTEGER)", now;
|
tmp << "CREATE TABLE Tuples (int0 INTEGER, int1 INTEGER)", now;
|
||||||
|
|
||||||
@@ -1475,7 +1475,7 @@ void SQLiteTest::testTuple2()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector2()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples (int0 INTEGER, int1 INTEGER)", now;
|
tmp << "CREATE TABLE Tuples (int0 INTEGER, int1 INTEGER)", now;
|
||||||
|
|
||||||
@@ -1502,7 +1502,7 @@ void SQLiteTest::testTupleVector2()
|
|||||||
|
|
||||||
void SQLiteTest::testTuple1()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples (int0 INTEGER)", now;
|
tmp << "CREATE TABLE Tuples (int0 INTEGER)", now;
|
||||||
|
|
||||||
@@ -1519,7 +1519,7 @@ void SQLiteTest::testTuple1()
|
|||||||
|
|
||||||
void SQLiteTest::testTupleVector1()
|
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 << "DROP TABLE IF EXISTS Tuples", now;
|
||||||
tmp << "CREATE TABLE Tuples (int0 INTEGER)", now;
|
tmp << "CREATE TABLE Tuples (int0 INTEGER)", now;
|
||||||
|
|
||||||
@@ -1546,7 +1546,7 @@ void SQLiteTest::testTupleVector1()
|
|||||||
|
|
||||||
void SQLiteTest::testInternalExtraction()
|
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 << "DROP TABLE IF EXISTS Vectors", now;
|
||||||
tmp << "CREATE TABLE Vectors (int0 INTEGER, flt0 REAL, str0 VARCHAR)", 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
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
// Module: SessionInstantiator
|
// Module: Connector
|
||||||
//
|
//
|
||||||
// Definition of the SessionInstantiator class.
|
// Definition of the Connector class.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef Data_SessionInstantiator_INCLUDED
|
#ifndef Data_Connector_INCLUDED
|
||||||
#define Data_SessionInstantiator_INCLUDED
|
#define Data_Connector_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/Data.h"
|
#include "Poco/Data/Data.h"
|
||||||
@@ -49,22 +49,26 @@ namespace Poco {
|
|||||||
namespace Data {
|
namespace Data {
|
||||||
|
|
||||||
|
|
||||||
class Data_API SessionInstantiator
|
class Data_API Connector
|
||||||
/// A SessionInstantiator creates SessionImpl objects.
|
/// 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:
|
public:
|
||||||
SessionInstantiator();
|
Connector();
|
||||||
/// Creates the SessionInstantiator.
|
/// Creates the Connector.
|
||||||
|
|
||||||
virtual ~SessionInstantiator();
|
virtual ~Connector();
|
||||||
/// Destroys the SessionInstantiator.
|
/// Destroys the Connector.
|
||||||
|
|
||||||
virtual Poco::AutoPtr<SessionImpl> create(const std::string& initString) = 0;
|
virtual Poco::AutoPtr<SessionImpl> createSession(const std::string& connectionString) = 0;
|
||||||
/// Create a SessionImpl object and initialize it with the initString.
|
/// Create a SessionImpl object and initialize it with the given connectionString.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Data
|
} } // namespace Poco::Data
|
||||||
|
|
||||||
|
|
||||||
#endif // Data_SessionInstantiator_INCLUDED
|
#endif // Data_Connector_INCLUDED
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// RecordSet.h
|
// RecordSet.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/include/Poco/Data/RecordSet.h#4 $
|
// $Id: //poco/Main/Data/include/Poco/Data/RecordSet.h#5 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
if (pos > rExtractions.size())
|
if (pos > rExtractions.size())
|
||||||
throw RangeException(format("Invalid column number: %z", pos));
|
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)
|
if (pExtraction)
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ public:
|
|||||||
DynamicAny value(const std::string& name, std::size_t row) const;
|
DynamicAny value(const std::string& name, std::size_t row) const;
|
||||||
/// Returns the reference to data value at named column, row location.
|
/// Returns the reference to data value at named column, row location.
|
||||||
|
|
||||||
void moveFirst();
|
bool moveFirst();
|
||||||
/// Moves the row cursor to the first row.
|
/// Moves the row cursor to the first row.
|
||||||
|
|
||||||
bool moveNext();
|
bool moveNext();
|
||||||
@@ -136,15 +136,21 @@ public:
|
|||||||
bool movePrevious();
|
bool movePrevious();
|
||||||
/// Moves the row cursor to the previous row.
|
/// Moves the row cursor to the previous row.
|
||||||
|
|
||||||
void moveLast();
|
bool moveLast();
|
||||||
/// Moves the row cursor to the last row.
|
/// Moves the row cursor to the last row.
|
||||||
|
|
||||||
DynamicAny value(const std::string& name);
|
DynamicAny value(const std::string& name);
|
||||||
/// Returns the value in the named column of the current row.
|
/// 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);
|
DynamicAny operator [] (const std::string& name);
|
||||||
/// Returns the value in the named column of the current row.
|
/// 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:
|
private:
|
||||||
RecordSet();
|
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)
|
inline DynamicAny RecordSet::value(const std::string& name)
|
||||||
{
|
{
|
||||||
return value(name, _currentRow);
|
return value(name, _currentRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline DynamicAny RecordSet::value(std::size_t index)
|
||||||
|
{
|
||||||
|
return value(index, _currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DynamicAny RecordSet::operator [] (const std::string& name)
|
inline DynamicAny RecordSet::operator [] (const std::string& name)
|
||||||
{
|
{
|
||||||
return value(name, _currentRow);
|
return value(name, _currentRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline DynamicAny RecordSet::operator [] (std::size_t index)
|
||||||
|
{
|
||||||
|
return value(index, _currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Data
|
} } // namespace Poco::Data
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Session.h
|
// Session.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/include/Poco/Data/Session.h#6 $
|
// $Id: //poco/Main/Data/include/Poco/Data/Session.h#9 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "Poco/Data/SessionImpl.h"
|
#include "Poco/Data/SessionImpl.h"
|
||||||
#include "Poco/Data/Statement.h"
|
#include "Poco/Data/Statement.h"
|
||||||
#include "Poco/Data/StatementCreator.h"
|
#include "Poco/Data/StatementCreator.h"
|
||||||
|
#include "Poco/Data/Binding.h"
|
||||||
#include "Poco/AutoPtr.h"
|
#include "Poco/AutoPtr.h"
|
||||||
#include "Poco/Any.h"
|
#include "Poco/Any.h"
|
||||||
|
|
||||||
@@ -60,20 +61,24 @@ class Data_API Session
|
|||||||
///
|
///
|
||||||
/// Sessions are always created via the SessionFactory:
|
/// 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")
|
/// 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.
|
/// 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
|
/// 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
|
/// 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.
|
/// second, statements that should be executed multiple times, using a separate execute() call.
|
||||||
/// The simple one is immediate execution:
|
/// 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
|
/// The now at the end of the statement is required, otherwise the statement
|
||||||
/// would not be executed.
|
/// 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)
|
/// 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:
|
/// one uses an explicit Statement object and its execute() method:
|
||||||
///
|
///
|
||||||
/// int i = 0;
|
/// int i = 0;
|
||||||
/// Statement stmt = (ses << "INSERT INTO Dummy VALUES(:data)", use(i));
|
/// Statement stmt = (ses << "INSERT INTO Dummy VALUES(:data)", use(i));
|
||||||
///
|
///
|
||||||
/// for (i = 0; i < 100; ++i)
|
/// for (i = 0; i < 100; ++i)
|
||||||
/// {
|
/// {
|
||||||
/// stmt.execute();
|
/// stmt.execute();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// The above example assigns the variable i to the ":data" placeholder in the SQL query. The query is parsed and compiled exactly
|
/// 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".
|
/// 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
|
/// 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):
|
/// and use the vector as parameter to the use clause (you could also use set or multiset instead):
|
||||||
///
|
///
|
||||||
/// std::vector<int> data;
|
/// std::vector<int> data;
|
||||||
/// for (int i = 0; i < 100; ++i)
|
/// for (int i = 0; i < 100; ++i)
|
||||||
/// {
|
/// {
|
||||||
/// data.push_back(i);
|
/// data.push_back(i);
|
||||||
/// }
|
/// }
|
||||||
/// ses << "INSERT INTO Dummy VALUES(:data)", use(data);
|
/// 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:
|
/// 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
|
/// 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:
|
/// the maximum number of rows retrieved from the database:
|
||||||
/// std::set<int> retData;
|
///
|
||||||
/// Statement stmt = (ses << "SELECT * FROM Dummy", into(retData), limit(50));
|
/// std::set<int> retData;
|
||||||
/// while (!stmt.done())
|
/// Statement stmt = (ses << "SELECT * FROM Dummy", into(retData), limit(50));
|
||||||
/// {
|
/// while (!stmt.done())
|
||||||
/// stmt.execute();
|
/// {
|
||||||
/// }
|
/// stmt.execute();
|
||||||
|
/// }
|
||||||
|
///
|
||||||
/// The "into" keyword is used to inform the statement where output results should be placed. The limit value ensures
|
/// 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.
|
/// 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.
|
/// 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
|
/// A prepared Statement will behave exactly the same but a further call to execute() will simply reset the Statement,
|
||||||
/// append more data to the result set.
|
/// 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
|
/// 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:
|
/// Take the following example:
|
||||||
/// ses << "CREATE TABLE Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3))";
|
///
|
||||||
/// std::vector<std::string> nameVec; // [...] add some elements
|
/// ses << "CREATE TABLE Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3))";
|
||||||
/// std::vector<int> ageVec; // [...] add some elements
|
/// std::vector<std::string> nameVec; // [...] add some elements
|
||||||
/// ses << "INSERT INTO Person (LastName, Age) VALUES(:ln, :age)", use(nameVec), use(ageVec);
|
/// 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 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:
|
/// 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.
|
/// 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).
|
/// 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,
|
/// For now, we simply assume we have written one TypeHandler for Person objects. Instead of having n different vectors,
|
||||||
/// we have now one collection:
|
/// we have one collection:
|
||||||
/// std::vector<Person> people; // [...] add some elements
|
///
|
||||||
/// ses << "INSERT INTO Person (LastName, FirstName, Age) VALUES(:ln, :fn, :age)", use(people);
|
/// 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,
|
/// 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:
|
/// 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:
|
public:
|
||||||
Session(Poco::AutoPtr<SessionImpl> ptrImpl);
|
Session(Poco::AutoPtr<SessionImpl> ptrImpl);
|
||||||
/// Creates the Session.
|
/// 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&);
|
Session(const Session&);
|
||||||
/// Creates a session by copying another one.
|
/// Creates a session by copying another one.
|
||||||
|
|
||||||
@@ -170,6 +188,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
StatementImpl* createStatementImpl();
|
StatementImpl* createStatementImpl();
|
||||||
|
/// Creates a StatementImpl.
|
||||||
|
|
||||||
void begin();
|
void begin();
|
||||||
/// Starts a transaction.
|
/// Starts a transaction.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SessionFactory.h
|
// SessionFactory.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/include/Poco/Data/SessionFactory.h#3 $
|
// $Id: //poco/Main/Data/include/Poco/Data/SessionFactory.h#5 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/Data.h"
|
#include "Poco/Data/Data.h"
|
||||||
#include "Poco/Data/SessionInstantiator.h"
|
#include "Poco/Data/Connector.h"
|
||||||
#include "Poco/Data/Session.h"
|
#include "Poco/Data/Session.h"
|
||||||
#include "Poco/Mutex.h"
|
#include "Poco/Mutex.h"
|
||||||
#include "Poco/SharedPtr.h"
|
#include "Poco/SharedPtr.h"
|
||||||
@@ -53,33 +53,38 @@ namespace Data {
|
|||||||
|
|
||||||
|
|
||||||
class Data_API SessionFactory
|
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:
|
/// 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")
|
/// 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.
|
/// 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
|
/// 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:
|
public:
|
||||||
static SessionFactory& instance();
|
static SessionFactory& instance();
|
||||||
/// returns the static instance of the singleton.
|
/// returns the static instance of the singleton.
|
||||||
|
|
||||||
void add(const std::string& key, SessionInstantiator* pIn);
|
void add(const std::string& key, Connector* pIn);
|
||||||
/// Registers a SessionInstantiator under the given key at the factory. If a registration for that
|
/// 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.
|
/// key is already active, the first registration will be kept, only its reference count will be increased.
|
||||||
/// Always takes ownership of parameter pIn.
|
/// Always takes ownership of parameter pIn.
|
||||||
|
|
||||||
void remove(const std::string& key);
|
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.
|
/// the object is removed.
|
||||||
|
|
||||||
Session create(const std::string& key, const std::string& initString);
|
Session create(const std::string& key, const std::string& connectionString);
|
||||||
/// Creates a Session for the given key with the initString. Throws an Poco:Data::UnknownDataBaseException
|
/// Creates a Session for the given key with the connectionString. Throws an Poco:Data::UnknownDataBaseException
|
||||||
/// if no instantiator is registered for that key.
|
/// if no instantiator is registered for that key.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -91,12 +96,12 @@ private:
|
|||||||
struct SessionInfo
|
struct SessionInfo
|
||||||
{
|
{
|
||||||
int cnt;
|
int cnt;
|
||||||
Poco::SharedPtr<SessionInstantiator> ptrSI;
|
Poco::SharedPtr<Connector> ptrSI;
|
||||||
SessionInfo(SessionInstantiator* pSI);
|
SessionInfo(Connector* pSI);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<std::string, SessionInfo> Instantiators;
|
typedef std::map<std::string, SessionInfo> Connectors;
|
||||||
Instantiators _instantiators;
|
Connectors _connectors;
|
||||||
Poco::FastMutex _mutex;
|
Poco::FastMutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SessionPool.h
|
// SessionPool.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/include/Poco/Data/SessionPool.h#2 $
|
// $Id: //poco/Main/Data/include/Poco/Data/SessionPool.h#4 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: SessionPooling
|
// Package: SessionPooling
|
||||||
@@ -73,16 +73,23 @@ class Data_API SessionPool
|
|||||||
/// Sessions found not to be connected to the database are purged
|
/// Sessions found not to be connected to the database are purged
|
||||||
/// from the pool whenever one of the following events occurs:
|
/// from the pool whenever one of the following events occurs:
|
||||||
///
|
///
|
||||||
/// - JanitorTimer event
|
/// - JanitorTimer event
|
||||||
/// - get() request
|
/// - get() request
|
||||||
/// - putBack() request
|
/// - putBack() request
|
||||||
///
|
///
|
||||||
/// Not connected idle sessions can not exist.
|
/// Not connected idle sessions can not exist.
|
||||||
|
///
|
||||||
|
/// Usage example:
|
||||||
|
///
|
||||||
|
/// SessionPool pool("ODBC", "...");
|
||||||
|
/// ...
|
||||||
|
/// Session sess(pool.get());
|
||||||
|
/// ...
|
||||||
{
|
{
|
||||||
public:
|
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
|
/// Creates the SessionPool for sessions with the given sessionKey
|
||||||
/// and initString.
|
/// and connectionString.
|
||||||
///
|
///
|
||||||
/// The pool allows for at most maxSessions sessions to be created.
|
/// 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
|
/// If a session has been idle for more than idleTime seconds, and more than
|
||||||
@@ -135,7 +142,7 @@ private:
|
|||||||
SessionPool& operator = (const SessionPool&);
|
SessionPool& operator = (const SessionPool&);
|
||||||
|
|
||||||
std::string _sessionKey;
|
std::string _sessionKey;
|
||||||
std::string _initString;
|
std::string _connectionString;
|
||||||
int _minSessions;
|
int _minSessions;
|
||||||
int _maxSessions;
|
int _maxSessions;
|
||||||
int _idleTime;
|
int _idleTime;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Statement.h
|
// Statement.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/include/Poco/Data/Statement.h#14 $
|
// $Id: //poco/Main/Data/include/Poco/Data/Statement.h#16 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -67,6 +67,20 @@ public:
|
|||||||
Statement(StatementImpl* pImpl);
|
Statement(StatementImpl* pImpl);
|
||||||
/// Creates the Statement.
|
/// 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();
|
~Statement();
|
||||||
/// Destroys the Statement.
|
/// Destroys the Statement.
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// StatementCreator.h
|
// StatementCreator.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/include/Poco/Data/StatementCreator.h#4 $
|
// $Id: //poco/Main/Data/include/Poco/Data/StatementCreator.h#5 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -54,6 +54,9 @@ class Data_API StatementCreator
|
|||||||
/// A StatementCreator creates Statements.
|
/// A StatementCreator creates Statements.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
StatementCreator();
|
||||||
|
/// Creates an unitialized StatementCreator.
|
||||||
|
|
||||||
StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl);
|
StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl);
|
||||||
/// Creates a StatementCreator.
|
/// Creates a StatementCreator.
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// TypeHandler.h
|
// TypeHandler.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/include/Poco/Data/TypeHandler.h#10 $
|
// $Id: //poco/Main/Data/include/Poco/Data/TypeHandler.h#11 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -54,7 +54,7 @@ namespace Data {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class TypeHandler
|
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:
|
/// Take as example the following (simplified) class:
|
||||||
/// class Person
|
/// class Person
|
||||||
@@ -72,6 +72,11 @@ class TypeHandler
|
|||||||
/// class TypeHandler<struct Person>
|
/// class TypeHandler<struct Person>
|
||||||
/// {
|
/// {
|
||||||
/// public:
|
/// 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)
|
/// 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))
|
/// // 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);
|
/// 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)
|
/// 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))
|
/// // 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
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
// Module: SessionInstantiator
|
// Module: Connector
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -34,19 +34,19 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/SessionInstantiator.h"
|
#include "Poco/Data/Connector.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
namespace Data {
|
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
|
} } // namespace Poco::Data
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Session.cpp
|
// Session.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/src/Session.cpp#3 $
|
// $Id: //poco/Main/Data/src/Session.cpp#5 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/Session.h"
|
#include "Poco/Data/Session.h"
|
||||||
|
#include "Poco/Data/SessionFactory.h"
|
||||||
#include <algorithm>
|
#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):
|
Session::Session(const Session& other):
|
||||||
_ptrImpl(other._ptrImpl),
|
_ptrImpl(other._ptrImpl),
|
||||||
_statementCreator(other._ptrImpl)
|
_statementCreator(other._ptrImpl)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SessionFactory.cpp
|
// SessionFactory.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/src/SessionFactory.cpp#4 $
|
// $Id: //poco/Main/Data/src/SessionFactory.cpp#6 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// 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);
|
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||||
SessionInfo info(pIn);
|
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)
|
if (!res.second)
|
||||||
{
|
{
|
||||||
res.first->second.cnt++;
|
res.first->second.cnt++;
|
||||||
@@ -73,26 +73,26 @@ void SessionFactory::add(const std::string& key, SessionInstantiator* pIn)
|
|||||||
void SessionFactory::remove(const std::string& key)
|
void SessionFactory::remove(const std::string& key)
|
||||||
{
|
{
|
||||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||||
Instantiators::iterator it = _instantiators.find(key);
|
Connectors::iterator it = _connectors.find(key);
|
||||||
poco_assert (_instantiators.end() != it);
|
poco_assert (_connectors.end() != it);
|
||||||
|
|
||||||
--(it->second.cnt);
|
--(it->second.cnt);
|
||||||
if (it->second.cnt == 0)
|
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);
|
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||||
Instantiators::iterator it = _instantiators.find(key);
|
Connectors::iterator it = _connectors.find(key);
|
||||||
poco_assert (_instantiators.end() != it);
|
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),
|
cnt(1),
|
||||||
ptrSI(pSI)
|
ptrSI(pSI)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SessionPool.cpp
|
// SessionPool.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/src/SessionPool.cpp#2 $
|
// $Id: //poco/Main/Data/src/SessionPool.cpp#3 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: SessionPooling
|
// Package: SessionPooling
|
||||||
@@ -44,9 +44,9 @@ namespace Poco {
|
|||||||
namespace Data {
|
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),
|
_sessionKey(sessionKey),
|
||||||
_initString(initString),
|
_connectionString(connectionString),
|
||||||
_minSessions(minSessions),
|
_minSessions(minSessions),
|
||||||
_maxSessions(maxSessions),
|
_maxSessions(maxSessions),
|
||||||
_idleTime(idleTime),
|
_idleTime(idleTime),
|
||||||
@@ -74,12 +74,12 @@ Session SessionPool::get()
|
|||||||
{
|
{
|
||||||
if (_nSessions < _maxSessions)
|
if (_nSessions < _maxSessions)
|
||||||
{
|
{
|
||||||
Session newSession(SessionFactory::instance().create(_sessionKey, _initString));
|
Session newSession(SessionFactory::instance().create(_sessionKey, _connectionString));
|
||||||
PooledSessionHolderPtr pHolder(new PooledSessionHolder(*this, newSession.impl()));
|
PooledSessionHolderPtr pHolder(new PooledSessionHolder(*this, newSession.impl()));
|
||||||
_idleSessions.push_front(pHolder);
|
_idleSessions.push_front(pHolder);
|
||||||
++_nSessions;
|
++_nSessions;
|
||||||
}
|
}
|
||||||
else throw SessionPoolExhaustedException(_sessionKey, _initString);
|
else throw SessionPoolExhaustedException(_sessionKey, _connectionString);
|
||||||
}
|
}
|
||||||
PooledSessionHolderPtr pHolder(_idleSessions.front());
|
PooledSessionHolderPtr pHolder(_idleSessions.front());
|
||||||
PooledSessionImplPtr pPSI(new PooledSessionImpl(pHolder));
|
PooledSessionImplPtr pPSI(new PooledSessionImpl(pHolder));
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Statement.cpp
|
// Statement.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/src/Statement.cpp#8 $
|
// $Id: //poco/Main/Data/src/Statement.cpp#9 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "Poco/Data/Statement.h"
|
#include "Poco/Data/Statement.h"
|
||||||
#include "Poco/Data/DataException.h"
|
#include "Poco/Data/DataException.h"
|
||||||
#include "Poco/Data/Extraction.h"
|
#include "Poco/Data/Extraction.h"
|
||||||
|
#include "Poco/Data/Session.h"
|
||||||
#include "Poco/Any.h"
|
#include "Poco/Any.h"
|
||||||
#include "Poco/Tuple.h"
|
#include "Poco/Tuple.h"
|
||||||
#include <algorithm>
|
#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):
|
Statement::Statement(const Statement& stmt):
|
||||||
_executed(stmt._executed),
|
_executed(stmt._executed),
|
||||||
_ptr(stmt._ptr)
|
_ptr(stmt._ptr)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// StatementCreator.cpp
|
// StatementCreator.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/Main/Data/src/StatementCreator.cpp#3 $
|
// $Id: //poco/Main/Data/src/StatementCreator.cpp#4 $
|
||||||
//
|
//
|
||||||
// Library: Data
|
// Library: Data
|
||||||
// Package: DataCore
|
// Package: DataCore
|
||||||
@@ -42,6 +42,11 @@ namespace Poco {
|
|||||||
namespace Data {
|
namespace Data {
|
||||||
|
|
||||||
|
|
||||||
|
StatementCreator::StatementCreator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
StatementCreator::StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl):
|
StatementCreator::StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl):
|
||||||
_ptrImpl(ptrImpl)
|
_ptrImpl(ptrImpl)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile
|
# Makefile
|
||||||
#
|
#
|
||||||
# $Id: //poco/Main/Data/testsuite/Makefile#6 $
|
# $Id: //poco/Main/Data/testsuite/Makefile#7 $
|
||||||
#
|
#
|
||||||
# Makefile for Poco Data testsuite
|
# Makefile for Poco Data testsuite
|
||||||
#
|
#
|
||||||
@@ -10,7 +10,7 @@ include $(POCO_BASE)/build/rules/global
|
|||||||
|
|
||||||
objects = DataTestSuite Driver \
|
objects = DataTestSuite Driver \
|
||||||
DataTest SessionPoolTest \
|
DataTest SessionPoolTest \
|
||||||
Binder Extractor Preparation SessionImpl SessionInstantiator TestStatementImpl
|
Binder Extractor Preparation SessionImpl Connector TestStatementImpl
|
||||||
|
|
||||||
target = testrunner
|
target = testrunner
|
||||||
target_version = 1
|
target_version = 1
|
||||||
|
@@ -201,7 +201,7 @@
|
|||||||
RelativePath=".\src\SessionImpl.h">
|
RelativePath=".\src\SessionImpl.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\SessionInstantiator.h">
|
RelativePath=".\src\Connector.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\TestStatementImpl.h">
|
RelativePath=".\src\TestStatementImpl.h">
|
||||||
@@ -220,7 +220,7 @@
|
|||||||
RelativePath=".\src\SessionImpl.cpp">
|
RelativePath=".\src\SessionImpl.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\SessionInstantiator.cpp">
|
RelativePath=".\src\Connector.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\TestStatementImpl.cpp">
|
RelativePath=".\src\TestStatementImpl.cpp">
|
||||||
|
@@ -255,6 +255,10 @@
|
|||||||
RelativePath=".\src\Binder.h"
|
RelativePath=".\src\Binder.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Connector.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Extractor.h"
|
RelativePath=".\src\Extractor.h"
|
||||||
>
|
>
|
||||||
@@ -267,10 +271,6 @@
|
|||||||
RelativePath=".\src\SessionImpl.h"
|
RelativePath=".\src\SessionImpl.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\SessionInstantiator.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\TestStatementImpl.h"
|
RelativePath=".\src\TestStatementImpl.h"
|
||||||
>
|
>
|
||||||
@@ -283,6 +283,10 @@
|
|||||||
RelativePath=".\src\Binder.cpp"
|
RelativePath=".\src\Binder.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Connector.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Extractor.cpp"
|
RelativePath=".\src\Extractor.cpp"
|
||||||
>
|
>
|
||||||
@@ -295,10 +299,6 @@
|
|||||||
RelativePath=".\src\SessionImpl.cpp"
|
RelativePath=".\src\SessionImpl.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\SessionInstantiator.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\TestStatementImpl.cpp"
|
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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include "SessionInstantiator.h"
|
#include "Connector.h"
|
||||||
#include "SessionImpl.h"
|
#include "SessionImpl.h"
|
||||||
#include "Poco/Data/SessionFactory.h"
|
#include "Poco/Data/SessionFactory.h"
|
||||||
|
|
||||||
@@ -40,32 +40,32 @@ namespace Data {
|
|||||||
namespace Test {
|
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);
|
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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef Data_Test_SessionInstantiator_INCLUDED
|
#ifndef Data_Test_Connector_INCLUDED
|
||||||
#define Data_Test_SessionInstantiator_INCLUDED
|
#define Data_Test_Connector_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/SessionInstantiator.h"
|
#include "Poco/Data/Connector.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@@ -44,31 +44,31 @@ namespace Data {
|
|||||||
namespace Test {
|
namespace Test {
|
||||||
|
|
||||||
|
|
||||||
class SessionInstantiator: public Poco::Data::SessionInstantiator
|
class Connector: public Poco::Data::Connector
|
||||||
/// SessionInstantiator instantiates SessionImpl objects for testing.
|
/// Connector instantiates SessionImpl objects for testing.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const std::string KEY;
|
static const std::string KEY;
|
||||||
/// Keyword for creating test sessions.
|
/// Keyword for creating test sessions.
|
||||||
|
|
||||||
SessionInstantiator();
|
Connector();
|
||||||
/// Creates the SessionInstantiator.
|
/// Creates the Connector.
|
||||||
|
|
||||||
~SessionInstantiator();
|
~Connector();
|
||||||
/// Destroys the SessionInstantiator.
|
/// Destroys the Connector.
|
||||||
|
|
||||||
Poco::AutoPtr<Poco::Data::SessionImpl> create(const std::string& initString);
|
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||||
/// Creates a test SessionImpl object and initializes it with the given initString.
|
/// Creates a test SessionImpl object and initializes it with the given connectionString.
|
||||||
|
|
||||||
static void addToFactory();
|
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();
|
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
|
} } } // namespace Poco::Data::Test
|
||||||
|
|
||||||
|
|
||||||
#endif // Data_Test_SessionInstantiator_INCLUDED
|
#endif // Data_Test_Connector_INCLUDED
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// DataTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
#include "Poco/Data/BLOBStream.h"
|
#include "Poco/Data/BLOBStream.h"
|
||||||
#include "Poco/Data/MetaColumn.h"
|
#include "Poco/Data/MetaColumn.h"
|
||||||
#include "Poco/Data/Column.h"
|
#include "Poco/Data/Column.h"
|
||||||
#include "SessionInstantiator.h"
|
#include "Connector.h"
|
||||||
#include "Poco/BinaryReader.h"
|
#include "Poco/BinaryReader.h"
|
||||||
#include "Poco/BinaryWriter.h"
|
#include "Poco/BinaryWriter.h"
|
||||||
#include "Poco/Types.h"
|
#include "Poco/Types.h"
|
||||||
@@ -57,13 +57,13 @@ using Poco::RangeException;
|
|||||||
|
|
||||||
DataTest::DataTest(const std::string& name): CppUnit::TestCase(name)
|
DataTest::DataTest(const std::string& name): CppUnit::TestCase(name)
|
||||||
{
|
{
|
||||||
Poco::Data::Test::SessionInstantiator::addToFactory();
|
Poco::Data::Test::Connector::addToFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DataTest::~DataTest()
|
DataTest::~DataTest()
|
||||||
{
|
{
|
||||||
Poco::Data::Test::SessionInstantiator::removeFromFactory();
|
Poco::Data::Test::Connector::removeFromFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SessionPoolTest.cpp
|
// 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.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "Poco/Data/Common.h"
|
#include "Poco/Data/Common.h"
|
||||||
#include "Poco/Data/SessionPool.h"
|
#include "Poco/Data/SessionPool.h"
|
||||||
#include "Poco/Thread.h"
|
#include "Poco/Thread.h"
|
||||||
#include "SessionInstantiator.h"
|
#include "Connector.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace Poco::Data;
|
using namespace Poco::Data;
|
||||||
@@ -45,13 +45,13 @@ using Poco::Thread;
|
|||||||
|
|
||||||
SessionPoolTest::SessionPoolTest(const std::string& name): CppUnit::TestCase(name)
|
SessionPoolTest::SessionPoolTest(const std::string& name): CppUnit::TestCase(name)
|
||||||
{
|
{
|
||||||
Poco::Data::Test::SessionInstantiator::addToFactory();
|
Poco::Data::Test::Connector::addToFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SessionPoolTest::~SessionPoolTest()
|
SessionPoolTest::~SessionPoolTest()
|
||||||
{
|
{
|
||||||
Poco::Data::Test::SessionInstantiator::removeFromFactory();
|
Poco::Data::Test::Connector::removeFromFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user