mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
ODBC fixes and tests (Oracle, SQL Server, MySQL on Windows)
MySQL back-end compile fixes on Windows Nullable/NullType
This commit is contained in:
@@ -1,80 +1,80 @@
|
||||
//
|
||||
// Connector.h
|
||||
//
|
||||
// $Id: //poco/1.4/Data/MySQL/include/Poco/Data/MySQL/Connector.h#1 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: MySQL
|
||||
// Module: Connector
|
||||
//
|
||||
// Definition of the Connector class.
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef Data_MySQL_Connector_INCLUDED
|
||||
#define Data_MySQL_Connector_INCLUDED
|
||||
|
||||
#include "MySQL.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace MySQL {
|
||||
|
||||
class MySQL_API Connector: public Poco::Data::Connector
|
||||
/// Connector instantiates MySQL SessionImpl objects.
|
||||
{
|
||||
public:
|
||||
|
||||
static std::string KEY;
|
||||
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
virtual ~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
virtual const std::string& name() const;
|
||||
/// Returns the name associated with this connector.
|
||||
|
||||
//
|
||||
// Connector.h
|
||||
//
|
||||
// $Id: //poco/1.4/Data/MySQL/include/Poco/Data/MySQL/Connector.h#1 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: MySQL
|
||||
// Module: Connector
|
||||
//
|
||||
// Definition of the Connector class.
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef Data_MySQL_Connector_INCLUDED
|
||||
#define Data_MySQL_Connector_INCLUDED
|
||||
|
||||
#include "MySQL.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace MySQL {
|
||||
|
||||
class MySQL_API Connector: public Poco::Data::Connector
|
||||
/// Connector instantiates MySQL SessionImpl objects.
|
||||
{
|
||||
public:
|
||||
|
||||
static std::string KEY;
|
||||
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
virtual ~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
virtual const std::string& name() const;
|
||||
/// Returns the name associated with this connector.
|
||||
|
||||
virtual Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString,
|
||||
std::size_t timeout = Poco::Data::SessionImpl::LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates a MySQL SessionImpl object and initializes it with the given connectionString.
|
||||
|
||||
static void registerConnector();
|
||||
/// Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
|
||||
static void unregisterConnector();
|
||||
/// Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::MySQL
|
||||
|
||||
|
||||
#endif // Data_MySQL_Connector_INCLUDED
|
||||
std::size_t timeout = Poco::Data::SessionImpl::LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates a MySQL SessionImpl object and initializes it with the given connectionString.
|
||||
|
||||
static void registerConnector();
|
||||
/// Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
|
||||
static void unregisterConnector();
|
||||
/// Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::MySQL
|
||||
|
||||
|
||||
#endif // Data_MySQL_Connector_INCLUDED
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
// defined with this macro as being exported.
|
||||
//
|
||||
#if defined(_WIN32) && defined(POCO_DLL)
|
||||
#if defined(MYSQL_EXPORTS)
|
||||
#if defined(MySQL_EXPORTS)
|
||||
#define MySQL_API __declspec(dllexport)
|
||||
#else
|
||||
#define MySQL_API __declspec(dllimport)
|
||||
@@ -69,7 +69,7 @@
|
||||
// Automatically link Data library.
|
||||
//
|
||||
#if defined(_MSC_VER)
|
||||
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(MYSQL_EXPORTS)
|
||||
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(MySQL_EXPORTS)
|
||||
#if defined(POCO_DLL)
|
||||
#if defined(_DEBUG)
|
||||
#pragma comment(lib, "PocoDataMySQLd.lib")
|
||||
|
||||
@@ -81,7 +81,7 @@ protected:
|
||||
virtual bool hasNext();
|
||||
/// Returns true if a call to next() will return data.
|
||||
|
||||
virtual std::size_t next();
|
||||
virtual std::size_t next();
|
||||
/// Retrieves the next row from the resultset.
|
||||
/// Will throw, if the resultset is empty.
|
||||
|
||||
|
||||
@@ -54,37 +54,37 @@ class SessionHandle
|
||||
public:
|
||||
|
||||
explicit SessionHandle(MYSQL* mysql);
|
||||
/// Creates session handle
|
||||
/// Creates session handle
|
||||
|
||||
~SessionHandle();
|
||||
/// Destroy handle, close connection
|
||||
/// Destroy handle, close connection
|
||||
|
||||
void init(MYSQL* mysql = 0);
|
||||
/// Initializes the handle iff not initialized.
|
||||
|
||||
void options(mysql_option opt);
|
||||
/// Set connection options
|
||||
/// Set connection options
|
||||
|
||||
void options(mysql_option opt, bool b);
|
||||
/// Set connection options
|
||||
/// Set connection options
|
||||
|
||||
void options(mysql_option opt, unsigned int i);
|
||||
/// Set connection options
|
||||
/// Set connection options
|
||||
|
||||
void connect(const char* host, const char* user, const char* password, const char* db, unsigned int port);
|
||||
/// Connect to server
|
||||
/// Connect to server
|
||||
|
||||
void close();
|
||||
/// Close connection
|
||||
/// Close connection
|
||||
|
||||
void startTransaction();
|
||||
/// Start transaction
|
||||
/// Start transaction
|
||||
|
||||
void commit();
|
||||
/// Commit transaction
|
||||
/// Commit transaction
|
||||
|
||||
void rollback();
|
||||
/// Rollback trabsaction
|
||||
/// Rollback trabsaction
|
||||
|
||||
operator MYSQL* ();
|
||||
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
SessionHandle& operator=(const SessionHandle&);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
MYSQL* _pHandle;
|
||||
};
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ public:
|
||||
Poco::Any getInsertId(const std::string&);
|
||||
/// Get insert id
|
||||
|
||||
SessionHandle& handle();
|
||||
// Get handle
|
||||
SessionHandle& handle();
|
||||
// Get handle
|
||||
|
||||
const std::string& connectorName();
|
||||
/// Returns the name of the connector.
|
||||
@@ -204,7 +204,7 @@ inline Poco::Any SessionImpl::getInsertId(const std::string&)
|
||||
|
||||
inline SessionHandle& SessionImpl::handle()
|
||||
{
|
||||
return _handle;
|
||||
return _handle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user