From 33efbefa7198a08d342a678b1673c4ea47438a35 Mon Sep 17 00:00:00 2001 From: Sergey Kholodilov Date: Wed, 25 Jun 2008 10:42:16 +0000 Subject: [PATCH] =MySQL connector --- Data/MySQL/Makefile | 23 + Data/MySQL/MySQL_VS80.sln | 36 + Data/MySQL/MySQL_VS80.vcproj | 279 +++ Data/MySQL/include/Poco/Data/MySQL/Binder.h | 263 +++ .../MySQL/include/Poco/Data/MySQL/Connector.h | 79 + .../MySQL/include/Poco/Data/MySQL/Extractor.h | 336 ++++ Data/MySQL/include/Poco/Data/MySQL/MySQL.h | 90 + .../include/Poco/Data/MySQL/MySQLException.h | 178 ++ .../Poco/Data/MySQL/MySQLStatementImpl.h | 125 ++ .../include/Poco/Data/MySQL/ResultMetadata.h | 89 + .../include/Poco/Data/MySQL/SessionHandle.h | 108 ++ .../include/Poco/Data/MySQL/SessionImpl.h | 135 ++ .../Poco/Data/MySQL/StatementExecutor.h | 118 ++ Data/MySQL/src/Binder.cpp | 623 +++++++ Data/MySQL/src/Connector.cpp | 92 + Data/MySQL/src/Extractor.cpp | 622 +++++++ Data/MySQL/src/MySQLException.cpp | 160 ++ Data/MySQL/src/MySQLStatementImpl.cpp | 200 +++ Data/MySQL/src/ResultMetadata.cpp | 243 +++ Data/MySQL/src/SessionHandle.cpp | 135 ++ Data/MySQL/src/SessionImpl.cpp | 226 +++ Data/MySQL/src/StatementExecutor.cpp | 197 +++ Data/MySQL/testsuite/Makefile | 21 + Data/MySQL/testsuite/TestSuite_VS80.vcproj | 259 +++ Data/MySQL/testsuite/src/Driver.cpp | 39 + Data/MySQL/testsuite/src/MySQLTest.cpp | 816 +++++++++ Data/MySQL/testsuite/src/MySQLTest.h | 141 ++ Data/MySQL/testsuite/src/MySQLTestSuite.cpp | 48 + Data/MySQL/testsuite/src/MySQLTestSuite.h | 51 + Data/MySQL/testsuite/src/SQLExecutor.cpp | 1520 +++++++++++++++++ Data/MySQL/testsuite/src/SQLExecutor.h | 118 ++ Data/MySQL/testsuite/src/WinDriver.cpp | 50 + 32 files changed, 7420 insertions(+) create mode 100644 Data/MySQL/Makefile create mode 100644 Data/MySQL/MySQL_VS80.sln create mode 100644 Data/MySQL/MySQL_VS80.vcproj create mode 100644 Data/MySQL/include/Poco/Data/MySQL/Binder.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/Connector.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/Extractor.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/MySQL.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/MySQLException.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/MySQLStatementImpl.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/SessionImpl.h create mode 100644 Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h create mode 100644 Data/MySQL/src/Binder.cpp create mode 100644 Data/MySQL/src/Connector.cpp create mode 100644 Data/MySQL/src/Extractor.cpp create mode 100644 Data/MySQL/src/MySQLException.cpp create mode 100644 Data/MySQL/src/MySQLStatementImpl.cpp create mode 100644 Data/MySQL/src/ResultMetadata.cpp create mode 100644 Data/MySQL/src/SessionHandle.cpp create mode 100644 Data/MySQL/src/SessionImpl.cpp create mode 100644 Data/MySQL/src/StatementExecutor.cpp create mode 100644 Data/MySQL/testsuite/Makefile create mode 100644 Data/MySQL/testsuite/TestSuite_VS80.vcproj create mode 100644 Data/MySQL/testsuite/src/Driver.cpp create mode 100644 Data/MySQL/testsuite/src/MySQLTest.cpp create mode 100644 Data/MySQL/testsuite/src/MySQLTest.h create mode 100644 Data/MySQL/testsuite/src/MySQLTestSuite.cpp create mode 100644 Data/MySQL/testsuite/src/MySQLTestSuite.h create mode 100644 Data/MySQL/testsuite/src/SQLExecutor.cpp create mode 100644 Data/MySQL/testsuite/src/SQLExecutor.h create mode 100644 Data/MySQL/testsuite/src/WinDriver.cpp diff --git a/Data/MySQL/Makefile b/Data/MySQL/Makefile new file mode 100644 index 000000000..d59ce4660 --- /dev/null +++ b/Data/MySQL/Makefile @@ -0,0 +1,23 @@ +# +# Makefile +# +# $Id: //poco/1.4/Data/MySQL/Makefile#1 $ +# +# Makefile for Poco MySQL +# + +include $(POCO_BASE)/build/rules/global + +SYSLIBS += -L/usr/local/lib/mysql +INCLUDE += -I/usr/local/include/mysql/ +SYSFLAGS += -DTHREADSAFE -DNO_TCL + +objects = Binder Extractor SessionImpl Connector \ + MySQLStatementImpl ResultMetadata MySQLException \ + SessionHandle StatementExecutor + +target = PocoMySQL +target_version = $(LIBVERSION) +target_libs = PocoData PocoFoundation + +include $(POCO_BASE)/build/rules/lib diff --git a/Data/MySQL/MySQL_VS80.sln b/Data/MySQL/MySQL_VS80.sln new file mode 100644 index 000000000..741140641 --- /dev/null +++ b/Data/MySQL/MySQL_VS80.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS80.vcproj", "{1B30A91B-375F-11DB-837B-00123FC423B5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MySQL", "MySQL_VS80.vcproj", "{D9C692A6-D089-4269-B444-C445ED192F0D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + debug_static|Win32 = debug_static|Win32 + release_shared|Win32 = release_shared|Win32 + release_static|Win32 = release_static|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1B30A91B-375F-11DB-837B-00123FC423B5}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {1B30A91B-375F-11DB-837B-00123FC423B5}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {1B30A91B-375F-11DB-837B-00123FC423B5}.debug_static|Win32.ActiveCfg = debug_shared|Win32 + {1B30A91B-375F-11DB-837B-00123FC423B5}.debug_static|Win32.Build.0 = debug_shared|Win32 + {1B30A91B-375F-11DB-837B-00123FC423B5}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {1B30A91B-375F-11DB-837B-00123FC423B5}.release_shared|Win32.Build.0 = release_shared|Win32 + {1B30A91B-375F-11DB-837B-00123FC423B5}.release_static|Win32.ActiveCfg = release_shared|Win32 + {1B30A91B-375F-11DB-837B-00123FC423B5}.release_static|Win32.Build.0 = release_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.debug_static|Win32.ActiveCfg = debug_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.debug_static|Win32.Build.0 = debug_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.release_shared|Win32.Build.0 = release_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.release_static|Win32.ActiveCfg = release_shared|Win32 + {D9C692A6-D089-4269-B444-C445ED192F0D}.release_static|Win32.Build.0 = release_shared|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Data/MySQL/MySQL_VS80.vcproj b/Data/MySQL/MySQL_VS80.vcproj new file mode 100644 index 000000000..78e24bba3 --- /dev/null +++ b/Data/MySQL/MySQL_VS80.vcproj @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Data/MySQL/include/Poco/Data/MySQL/Binder.h b/Data/MySQL/include/Poco/Data/MySQL/Binder.h new file mode 100644 index 000000000..2dc263388 --- /dev/null +++ b/Data/MySQL/include/Poco/Data/MySQL/Binder.h @@ -0,0 +1,263 @@ +// +// Binder.h +// +// $Id: //poco/1.4/Data/MySQL/include/Poco/Data/MySQL/Binder.h#1 $ +// +// Library: Data +// Package: MySQL +// Module: Binder +// +// Definition of the Binder 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_Binder_INCLUDED +#define Data_MySQL_Binder_INCLUDED + +#include "Poco/Data/MySQL/MySQL.h" +#include "Poco/Data/AbstractBinder.h" +#include "Poco/Data/BLOB.h" +#include "Poco/Data/MySQL/MySQLException.h" +#include + +namespace Poco { +namespace Data { +namespace MySQL { + + +class MySQL_API Binder: public Poco::Data::AbstractBinder + /// Binds placeholders in the sql query to the provided values. Performs data types mapping. +{ +public: + + Binder(); + /// Creates the Binder. + + virtual ~Binder(); + /// Destroys the Binder. + + virtual void bind(std::size_t pos, const Poco::Int8& val, Direction dir); + /// Binds an Int8. + + virtual void bind(std::size_t pos, const Poco::UInt8& val, Direction dir); + /// Binds an UInt8. + + virtual void bind(std::size_t pos, const Poco::Int16& val, Direction dir); + /// Binds an Int16. + + virtual void bind(std::size_t pos, const Poco::UInt16& val, Direction dir); + /// Binds an UInt16. + + virtual void bind(std::size_t pos, const Poco::Int32& val, Direction dir); + /// Binds an Int32. + + virtual void bind(std::size_t pos, const Poco::UInt32& val, Direction dir); + /// Binds an UInt32. + + virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir); + /// Binds an Int64. + + virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir); + /// Binds an UInt64. + +#ifndef POCO_LONG_IS_64_BIT + virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN); + /// Binds a long. +#endif + + virtual void bind(std::size_t pos, const bool& val, Direction dir); + /// Binds a boolean. + + virtual void bind(std::size_t pos, const float& val, Direction dir); + /// Binds a float. + + virtual void bind(std::size_t pos, const double& val, Direction dir); + /// Binds a double. + + virtual void bind(std::size_t pos, const char& val, Direction dir); + /// Binds a single character. + + virtual void bind(std::size_t pos, const std::string& val, Direction dir); + /// Binds a string. + + virtual void bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir); + /// Binds a BLOB. + + virtual void bind(std::size_t pos, const DateTime& val, Direction dir); + /// Binds a DateTime. + + virtual void bind(std::size_t pos, const Date& val, Direction dir); + /// Binds a Date. + + virtual void bind(std::size_t pos, const Time& val, Direction dir); + /// Binds a Time. + + virtual void bind(std::size_t pos, const NullData& val, Direction dir); + /// Binds a null. + + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::deque& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::list& val, Direction dir = PD_IN); + + virtual void bind(std::size_t pos, const std::vector