diff options
| author | savander <savander.pl@gmail.com> | 2014-09-28 16:30:17 +0200 |
|---|---|---|
| committer | savander <savander.pl@gmail.com> | 2014-09-28 16:30:17 +0200 |
| commit | 5fa7b8197ec9ac0c328268deea25c530118fd189 (patch) | |
| tree | 827eb6a5992dc14cbbab24c4d1ca4118467fe7d1 | |
| parent | 4636e3be470777330643ac554cca4e6ba960a18c (diff) | |
| download | zcatch-5fa7b8197ec9ac0c328268deea25c530118fd189.tar.gz zcatch-5fa7b8197ec9ac0c328268deea25c530118fd189.zip | |
add mysql lisb
27 files changed, 2189 insertions, 0 deletions
diff --git a/other/mysql/include/cppconn/build_config.h b/other/mysql/include/cppconn/build_config.h new file mode 100644 index 00000000..c2807ef3 --- /dev/null +++ b/other/mysql/include/cppconn/build_config.h @@ -0,0 +1,51 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_BUILD_CONFIG_H_ +#define _SQL_BUILD_CONFIG_H_ + +#ifndef CPPCONN_PUBLIC_FUNC + +#if defined(_WIN32) + // mysqlcppconn_EXPORTS is added by cmake and defined for dynamic lib build only + #ifdef mysqlcppconn_EXPORTS + #define CPPCONN_PUBLIC_FUNC __declspec(dllexport) + #else + // this is for static build + #ifdef CPPCONN_LIB_BUILD + #define CPPCONN_PUBLIC_FUNC + #else + // this is for clients using dynamic lib + #define CPPCONN_PUBLIC_FUNC __declspec(dllimport) + #endif + #endif +#else + #define CPPCONN_PUBLIC_FUNC +#endif + +#endif //#ifndef CPPCONN_PUBLIC_FUNC + +#endif //#ifndef _SQL_BUILD_CONFIG_H_ diff --git a/other/mysql/include/cppconn/config.h b/other/mysql/include/cppconn/config.h new file mode 100644 index 00000000..0bf9727d --- /dev/null +++ b/other/mysql/include/cppconn/config.h @@ -0,0 +1,110 @@ +/* + Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + + The MySQL Connector/C++ is licensed under the terms of the GPLv2 + <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most + MySQL Connectors. There are special exceptions to the terms and + conditions of the GPL as it is applied to this software, see the + FLOSS License Exception + <http://www.mysql.com/about/legal/licensing/foss-exception.html>. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +// libmysql defines HAVE_STRTOUL (on win), so we have to follow different pattern in definitions names +// to avoid annoying warnings. + +#define HAVE_FUNCTION_STRTOLD 1 +#define HAVE_FUNCTION_STRTOLL 1 +#define HAVE_FUNCTION_STRTOL 1 +#define HAVE_FUNCTION_STRTOULL 1 + +#define HAVE_FUNCTION_STRTOUL 1 + +#define HAVE_FUNCTION_STRTOIMAX 1 +#define HAVE_FUNCTION_STRTOUMAX 1 + +#define HAVE_STDINT_H 1 +#define HAVE_INTTYPES_H 1 + +#define HAVE_INT8_T 1 +#define HAVE_UINT8_T 1 +#define HAVE_INT16_T 1 +#define HAVE_UINT16_T 1 +#define HAVE_INT32_T 1 +#define HAVE_UINT32_T 1 +#define HAVE_INT32_T 1 +#define HAVE_UINT32_T 1 +#define HAVE_INT64_T 1 +#define HAVE_UINT64_T 1 +/* #undef HAVE_MS_INT8 */ +/* #undef HAVE_MS_UINT8 */ +/* #undef HAVE_MS_INT16 */ +/* #undef HAVE_MS_UINT16 */ +/* #undef HAVE_MS_INT32 */ +/* #undef HAVE_MS_UINT32 */ +/* #undef HAVE_MS_INT64 */ +/* #undef HAVE_MS_UINT64 */ + + +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#if defined(_WIN32) +#ifndef CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES + +#if _MSC_VER >= 1600 + +#include <stdint.h> + +#else + +#if !defined(HAVE_INT8_T) && defined(HAVE_MS_INT8) +typedef __int8 int8_t; +#endif + +#ifdef HAVE_MS_UINT8 +typedef unsigned __int8 uint8_t; +#endif +#ifdef HAVE_MS_INT16 +typedef __int16 int16_t; +#endif + +#ifdef HAVE_MS_UINT16 +typedef unsigned __int16 uint16_t; +#endif + +#ifdef HAVE_MS_INT32 +typedef __int32 int32_t; +#endif + +#ifdef HAVE_MS_UINT32 +typedef unsigned __int32 uint32_t; +#endif + +#ifdef HAVE_MS_INT64 +typedef __int64 int64_t; +#endif +#ifdef HAVE_MS_UINT64 +typedef unsigned __int64 uint64_t; +#endif + +#endif // _MSC_VER >= 1600 +#endif // CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES +#endif // _WIN32 diff --git a/other/mysql/include/cppconn/connection.h b/other/mysql/include/cppconn/connection.h new file mode 100644 index 00000000..426ebe39 --- /dev/null +++ b/other/mysql/include/cppconn/connection.h @@ -0,0 +1,157 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_CONNECTION_H_ +#define _SQL_CONNECTION_H_ + +#include <map> +#include <boost/variant.hpp> + +#include "build_config.h" +#include "warning.h" +#include "sqlstring.h" + +namespace sql +{ + + +typedef boost::variant<int, double, bool, sql::SQLString > ConnectPropertyVal; + +typedef std::map< sql::SQLString, ConnectPropertyVal > ConnectOptionsMap; + +class DatabaseMetaData; +class PreparedStatement; +class Statement; +class Driver; + +typedef enum transaction_isolation +{ + TRANSACTION_NONE= 0, + TRANSACTION_READ_COMMITTED, + TRANSACTION_READ_UNCOMMITTED, + TRANSACTION_REPEATABLE_READ, + TRANSACTION_SERIALIZABLE +} enum_transaction_isolation; + +class Savepoint +{ + /* Prevent use of these */ + Savepoint(const Savepoint &); + void operator=(Savepoint &); +public: + Savepoint() {}; + virtual ~Savepoint() {}; + virtual int getSavepointId() = 0; + + virtual sql::SQLString getSavepointName() = 0; +}; + + +class CPPCONN_PUBLIC_FUNC Connection +{ + /* Prevent use of these */ + Connection(const Connection &); + void operator=(Connection &); +public: + + Connection() {}; + + virtual ~Connection() {}; + + virtual void clearWarnings() = 0; + + virtual Statement *createStatement() = 0; + + virtual void close() = 0; + + virtual void commit() = 0; + + virtual bool getAutoCommit() = 0; + + virtual sql::SQLString getCatalog() = 0; + + virtual Driver *getDriver() = 0; + + virtual sql::SQLString getSchema() = 0; + + virtual sql::SQLString getClientInfo() = 0; + + virtual void getClientOption(const sql::SQLString & optionName, void * optionValue) = 0; + + virtual DatabaseMetaData * getMetaData() = 0; + + virtual enum_transaction_isolation getTransactionIsolation() = 0; + + virtual const SQLWarning * getWarnings() = 0; + + virtual bool isClosed() = 0; + + virtual bool isReadOnly() = 0; + + virtual sql::SQLString nativeSQL(const sql::SQLString& sql) = 0; + + virtual PreparedStatement * prepareStatement(const sql::SQLString& sql) = 0; + + virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys) = 0; + + virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int* columnIndexes) = 0; + + virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency) = 0; + + virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) = 0; + + virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]) = 0; + + virtual void releaseSavepoint(Savepoint * savepoint) = 0; + + virtual void rollback() = 0; + + virtual void rollback(Savepoint * savepoint) = 0; + + virtual void setAutoCommit(bool autoCommit) = 0; + + virtual void setCatalog(const sql::SQLString& catalog) = 0; + + virtual void setSchema(const sql::SQLString& catalog) = 0; + + virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue) = 0; + + virtual void setHoldability(int holdability) = 0; + + virtual void setReadOnly(bool readOnly) = 0; + + virtual Savepoint * setSavepoint() = 0; + + virtual Savepoint * setSavepoint(const sql::SQLString& name) = 0; + + virtual void setTransactionIsolation(enum_transaction_isolation level) = 0; + + /* virtual void setTypeMap(Map map) = 0; */ +}; + +} /* namespace sql */ + +#endif // _SQL_CONNECTION_H_ diff --git a/other/mysql/include/cppconn/datatype.h b/other/mysql/include/cppconn/datatype.h new file mode 100644 index 00000000..7ada3bcc --- /dev/null +++ b/other/mysql/include/cppconn/datatype.h @@ -0,0 +1,68 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_DATATYPE_H_ +#define _SQL_DATATYPE_H_ + +namespace sql +{ + +class DataType +{ + DataType(); +public: + enum { + UNKNOWN = 0, + BIT, + TINYINT, + SMALLINT, + MEDIUMINT, + INTEGER, + BIGINT, + REAL, + DOUBLE, + DECIMAL, + NUMERIC, + CHAR, + BINARY, + VARCHAR, + VARBINARY, + LONGVARCHAR, + LONGVARBINARY, + TIMESTAMP, + DATE, + TIME, + YEAR, + GEOMETRY, + ENUM, + SET, + SQLNULL + }; +}; + +} /* namespace */ + +#endif /* _SQL_DATATYPE_H_ */ diff --git a/other/mysql/include/cppconn/driver.h b/other/mysql/include/cppconn/driver.h new file mode 100644 index 00000000..9ce84691 --- /dev/null +++ b/other/mysql/include/cppconn/driver.h @@ -0,0 +1,70 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_DRIVER_H_ +#define _SQL_DRIVER_H_ + +#include "connection.h" +#include "build_config.h" + +namespace sql +{ + +class CPPCONN_PUBLIC_FUNC Driver +{ +protected: + virtual ~Driver() {} +public: + // Attempts to make a database connection to the given URL. + + virtual Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0; + + virtual Connection * connect(ConnectOptionsMap & options) = 0; + + virtual int getMajorVersion() = 0; + + virtual int getMinorVersion() = 0; + + virtual int getPatchVersion() = 0; + + virtual const sql::SQLString & getName() = 0; + + virtual void threadInit() = 0; + + virtual void threadEnd() = 0; +}; + +} /* namespace sql */ + +extern "C" +{ + CPPCONN_PUBLIC_FUNC sql::Driver * get_driver_instance(); + + /* If dynamic loading is disabled in a driver then this function works just like get_driver_instance() */ + CPPCONN_PUBLIC_FUNC sql::Driver * get_driver_instance_by_name(const char * const clientlib); +} + +#endif /* _SQL_DRIVER_H_ */ diff --git a/other/mysql/include/cppconn/exception.h b/other/mysql/include/cppconn/exception.h new file mode 100644 index 00000000..67cce8ae --- /dev/null +++ b/other/mysql/include/cppconn/exception.h @@ -0,0 +1,128 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_EXCEPTION_H_ +#define _SQL_EXCEPTION_H_ + +#include "build_config.h" +#include <stdexcept> +#include <string> +#include <memory> + +namespace sql +{ + +#define MEMORY_ALLOC_OPERATORS(Class) \ + void* operator new(size_t size) throw (std::bad_alloc) { return ::operator new(size); } \ + void* operator new(size_t, void*) throw(); \ + void* operator new(size_t, const std::nothrow_t&) throw(); \ + void* operator new[](size_t) throw (std::bad_alloc); \ + void* operator new[](size_t, void*) throw(); \ + void* operator new[](size_t, const std::nothrow_t&) throw(); \ + void* operator new(size_t N, std::allocator<Class>&); + +#ifdef _WIN32 +#pragma warning (disable : 4290) +//warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) + + +#pragma warning(push) +#pragma warning(disable: 4275) +#endif +class CPPCONN_PUBLIC_FUNC SQLException : public std::runtime_error +{ +#ifdef _WIN32 +#pragma warning(pop) +#endif +protected: + const std::string sql_state; + const int errNo; + +public: + SQLException(const SQLException& e) : std::runtime_error(e.what()), sql_state(e.sql_state), errNo(e.errNo) {} + + SQLException(const std::string& reason, const std::string& SQLState, int vendorCode) : + std::runtime_error (reason ), + sql_state (SQLState ), + errNo (vendorCode) + {} + + SQLException(const std::string& reason, const std::string& SQLState) : std::runtime_error(reason), sql_state(SQLState), errNo(0) {} + + SQLException(const std::string& reason) : std::runtime_error(reason), sql_state("HY000"), errNo(0) {} + + SQLException() : std::runtime_error(""), sql_state("HY000"), errNo(0) {} + + const std::string & getSQLState() const + { + return sql_state; + } + + const char * getSQLStateCStr() const + { + return sql_state.c_str(); + } + + + int getErrorCode() const + { + return errNo; + } + + virtual ~SQLException() throw () {}; + +protected: + MEMORY_ALLOC_OPERATORS(SQLException) +}; + +struct CPPCONN_PUBLIC_FUNC MethodNotImplementedException : public SQLException +{ + MethodNotImplementedException(const MethodNotImplementedException& e) : SQLException(e.what(), e.sql_state, e.errNo) { } + MethodNotImplementedException(const std::string& reason) : SQLException(reason, "", 0) {} +}; + +struct CPPCONN_PUBLIC_FUNC InvalidArgumentException : public SQLException +{ + InvalidArgumentException(const InvalidArgumentException& e) : SQLException(e.what(), e.sql_state, e.errNo) { } + InvalidArgumentException(const std::string& reason) : SQLException(reason, "", 0) {} +}; + +struct CPPCONN_PUBLIC_FUNC InvalidInstanceException : public SQLException +{ + InvalidInstanceException(const InvalidInstanceException& e) : SQLException(e.what(), e.sql_state, e.errNo) { } + InvalidInstanceException(const std::string& reason) : SQLException(reason, "", 0) {} +}; + + +struct CPPCONN_PUBLIC_FUNC NonScrollableException : public SQLException +{ + NonScrollableException(const NonScrollableException& e) : SQLException(e.what(), e.sql_state, e.errNo) { } + NonScrollableException(const std::string& reason) : SQLException(reason, "", 0) {} +}; + +} /* namespace sql */ + +#endif /* _SQL_EXCEPTION_H_ */ diff --git a/other/mysql/include/cppconn/metadata.h b/other/mysql/include/cppconn/metadata.h new file mode 100644 index 00000000..7f65768c --- /dev/null +++ b/other/mysql/include/cppconn/metadata.h @@ -0,0 +1,479 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_METADATA_H_ +#define _SQL_METADATA_H_ + +#include <string> +#include <list> +#include "datatype.h" +#include "sqlstring.h" + +namespace sql +{ +class ResultSet; + +class DatabaseMetaData +{ +protected: + virtual ~DatabaseMetaData() {} + +public: + enum + { + attributeNoNulls = 0, + attributeNullable, + attributeNullableUnknown + }; + enum + { + bestRowTemporary = 0, + bestRowTransaction, + bestRowSession + }; + enum + { + bestRowUnknown = 0, + bestRowNotPseudo, + bestRowPseudo + }; + enum + { + columnNoNulls = 0, + columnNullable, + columnNullableUnknown + }; + enum + { + importedKeyCascade = 0, + importedKeyInitiallyDeferred, + importedKeyInitiallyImmediate, + importedKeyNoAction, + importedKeyNotDeferrable, + importedKeyRestrict, + importedKeySetDefault, + importedKeySetNull + }; + enum + { + procedureColumnIn = 0, + procedureColumnInOut, + procedureColumnOut, + procedureColumnResult, + procedureColumnReturn, + procedureColumnUnknown, + procedureNoNulls, + procedureNoResult, + procedureNullable, + procedureNullableUnknown, + procedureResultUnknown, + procedureReturnsResult + }; + enum + { + sqlStateSQL99 = 0, + sqlStateXOpen + }; + enum + { + tableIndexClustered = 0, + tableIndexHashed, + tableIndexOther, + tableIndexStatistic + }; + enum + { + versionColumnUnknown = 0, + versionColumnNotPseudo = 1, + versionColumnPseudo = 2 + }; + enum + { + typeNoNulls = 0, + typeNullable = 1, + typeNullableUnknown = 2 + }; + enum + { + typePredNone = 0, + typePredChar = 1, + typePredBasic= 2, + typeSearchable = 3 + }; + + + virtual bool allProceduresAreCallable() = 0; + + virtual bool allTablesAreSelectable() = 0; + + virtual bool dataDefinitionCausesTransactionCommit() = 0; + + virtual bool dataDefinitionIgnoredInTransactions() = 0; + + virtual bool deletesAreDetected(int type) = 0; + + virtual bool doesMaxRowSizeIncludeBlobs() = 0; + + virtual ResultSet * getAttributes(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, const sql::SQLString& attributeNamePattern) = 0; + + virtual ResultSet * getBestRowIdentifier(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, int scope, bool nullable) = 0; + + virtual ResultSet * getCatalogs() = 0; + + virtual const sql::SQLString& getCatalogSeparator() = 0; + + virtual const sql::SQLString& getCatalogTerm() = 0; + + virtual ResultSet * getColumnPrivileges(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, const sql::SQLString& columnNamePattern) = 0; + + virtual ResultSet * getColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, const sql::SQLString& columnNamePattern) = 0; + + virtual Connection * getConnection() = 0; + + virtual ResultSet * getCrossReference(const sql::SQLString& primaryCatalog, const sql::SQLString& primarySchema, const sql::SQLString& primaryTable, const sql::SQLString& foreignCatalog, const sql::SQLString& foreignSchema, const sql::SQLString& foreignTable) = 0; + + virtual unsigned int getDatabaseMajorVersion() = 0; + + virtual unsigned int getDatabaseMinorVersion() = 0; + + virtual unsigned int getDatabasePatchVersion() = 0; + + virtual const sql::SQLString& getDatabaseProductName() = 0; + + virtual SQLString getDatabaseProductVersion() = 0; + + virtual int getDefaultTransactionIsolation() = 0; + + virtual unsigned int getDriverMajorVersion() = 0; + + virtual unsigned int getDriverMinorVersion() = 0; + + virtual unsigned int getDriverPatchVersion() = 0; + + virtual const sql::SQLString& getDriverName() = 0; + + virtual const sql::SQLString& getDriverVersion() = 0; + + virtual ResultSet * getExportedKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0; + + virtual const sql::SQLString& getExtraNameCharacters() = 0; + + virtual const sql::SQLString& getIdentifierQuoteString() = 0; + + virtual ResultSet * getImportedKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0; + + virtual ResultSet * getIndexInfo(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, bool unique, bool approximate) = 0; + + virtual unsigned int getCDBCMajorVersion() = 0; + + virtual unsigned int getCDBCMinorVersion() = 0; + + virtual unsigned int getMaxBinaryLiteralLength() = 0; + + virtual unsigned int getMaxCatalogNameLength() = 0; + + virtual unsigned int getMaxCharLiteralLength() = 0; + + virtual unsigned int getMaxColumnNameLength() = 0; + + virtual unsigned int getMaxColumnsInGroupBy() = 0; + + virtual unsigned int getMaxColumnsInIndex() = 0; + + virtual unsigned int getMaxColumnsInOrderBy() = 0; + + virtual unsigned int getMaxColumnsInSelect() = 0; + + virtual unsigned int getMaxColumnsInTable() = 0; + + virtual unsigned int getMaxConnections() = 0; + + virtual unsigned int getMaxCursorNameLength() = 0; + + virtual unsigned int getMaxIndexLength() = 0; + + virtual unsigned int getMaxProcedureNameLength() = 0; + + virtual unsigned int getMaxRowSize() = 0; + + virtual unsigned int getMaxSchemaNameLength() = 0; + + virtual unsigned int getMaxStatementLength() = 0; + + virtual unsigned int getMaxStatements() = 0; + + virtual unsigned int getMaxTableNameLength() = 0; + + virtual unsigned int getMaxTablesInSelect() = 0; + + virtual unsigned int getMaxUserNameLength() = 0; + + virtual const sql::SQLString& getNumericFunctions() = 0; + + virtual ResultSet * getPrimaryKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0; + + virtual ResultSet * getProcedureColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& procedureNamePattern, const sql::SQLString& columnNamePattern) = 0; + + virtual ResultSet * getProcedures(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& procedureNamePattern) = 0; + + virtual const sql::SQLString& getProcedureTerm() = 0; + + virtual int getResultSetHoldability() = 0; + + virtual ResultSet * getSchemas() = 0; + + virtual const sql::SQLString& getSchemaTerm() = 0; + + virtual const sql::SQLString& getSearchStringEscape() = 0; + + virtual const sql::SQLString& getSQLKeywords() = 0; + + virtual int getSQLStateType() = 0; + + virtual const sql::SQLString& getStringFunctions() = 0; + + virtual ResultSet * getSuperTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0; + + virtual ResultSet * getSuperTypes(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern) = 0; + + virtual const sql::SQLString& getSystemFunctions() = 0; + + virtual ResultSet * getTablePrivileges(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0; + + virtual ResultSet * getTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, std::list<sql::SQLString> &types) = 0; + + virtual ResultSet * getTableTypes() = 0; + + virtual const sql::SQLString& getTimeDateFunctions() = 0; + + virtual ResultSet * getTypeInfo() = 0; + + virtual ResultSet * getUDTs(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, std::list<int> &types) = 0; + + virtual SQLString getURL() = 0; + + virtual SQLString getUserName() = 0; + + virtual ResultSet * getVersionColumns(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0; + + virtual bool insertsAreDetected(int type) = 0; + + virtual bool isCatalogAtStart() = 0; + + virtual bool isReadOnly() = 0; + + virtual bool locatorsUpdateCopy() = 0; + + virtual bool nullPlusNonNullIsNull() = 0; + + virtual bool nullsAreSortedAtEnd() = 0; + + virtual bool nullsAreSortedAtStart() = 0; + + virtual bool nullsAreSortedHigh() = 0; + + virtual bool nullsAreSortedLow() = 0; + + virtual bool othersDeletesAreVisible(int type) = 0; + + virtual bool othersInsertsAreVisible(int type) = 0; + + virtual bool othersUpdatesAreVisible(int type) = 0; + + virtual bool ownDeletesAreVisible(int type) = 0; + + virtual bool ownInsertsAreVisible(int type) = 0; + + virtual bool ownUpdatesAreVisible(int type) = 0; + + virtual bool storesLowerCaseIdentifiers() = 0; + + virtual bool storesLowerCaseQuotedIdentifiers() = 0; + + virtual bool storesMixedCaseIdentifiers() = 0; + + virtual bool storesMixedCaseQuotedIdentifiers() = 0; + + virtual bool storesUpperCaseIdentifiers() = 0; + + virtual bool storesUpperCaseQuotedIdentifiers() = 0; + + virtual bool supportsAlterTableWithAddColumn() = 0; + + virtual bool supportsAlterTableWithDropColumn() = 0; + + virtual bool supportsANSI92EntryLevelSQL() = 0; + + virtual bool supportsANSI92FullSQL() = 0; + + virtual bool supportsANSI92IntermediateSQL() = 0; + + virtual bool supportsBatchUpdates() = 0; + + virtual bool supportsCatalogsInDataManipulation() = 0; + + virtual bool supportsCatalogsInIndexDefinitions() = 0; + + virtual bool supportsCatalogsInPrivilegeDefinitions() = 0; + + virtual bool supportsCatalogsInProcedureCalls() = 0; + + virtual bool supportsCatalogsInTableDefinitions() = 0; + + virtual bool supportsColumnAliasing() = 0; + + virtual bool supportsConvert() = 0; + + virtual bool supportsConvert(int fromType, int toType) = 0; + + virtual bool supportsCoreSQLGrammar() = 0; + + virtual bool supportsCorrelatedSubqueries() = 0; + + virtual bool supportsDataDefinitionAndDataManipulationTransactions() = 0; + + virtual bool supportsDataManipulationTransactionsOnly() = 0; + + virtual bool supportsDifferentTableCorrelationNames() = 0; + + virtual bool supportsExpressionsInOrderBy() = 0; + + virtual bool supportsExtendedSQLGrammar() = 0; + + virtual bool supportsFullOuterJoins() = 0; + + virtual bool supportsGetGeneratedKeys() = 0; + + virtual bool supportsGroupBy() = 0; + + virtual bool supportsGroupByBeyondSelect() = 0; + + virtual bool supportsGroupByUnrelated() = 0; + + virtual bool supportsIntegrityEnhancementFacility() = 0; + + virtual bool supportsLikeEscapeClause() = 0; + + virtual bool supportsLimitedOuterJoins() = 0; + + virtual bool supportsMinimumSQLGrammar() = 0; + + virtual bool supportsMixedCaseIdentifiers() = 0; + + virtual bool supportsMixedCaseQuotedIdentifiers() = 0; + + virtual bool supportsMultipleOpenResults() = 0; + + virtual bool supportsMultipleResultSets() = 0; + + virtual bool supportsMultipleTransactions() = 0; + + virtual bool supportsNamedParameters() = 0; + + virtual bool supportsNonNullableColumns() = 0; + + virtual bool supportsOpenCursorsAcrossCommit() = 0; + + virtual bool supportsOpenCursorsAcrossRollback() = 0; + + virtual bool supportsOpenStatementsAcrossCommit() = 0; + + virtual bool supportsOpenStatementsAcrossRollback() = 0; + + virtual bool supportsOrderByUnrelated() = 0; + + virtual bool supportsOuterJoins() = 0; + + virtual bool supportsPositionedDelete() = 0; + + virtual bool supportsPositionedUpdate() = 0; + + virtual bool supportsResultSetConcurrency(int type, int concurrency) = 0; + + virtual bool supportsResultSetHoldability(int holdability) = 0; + + virtual bool supportsResultSetType(int type) = 0; + + virtual bool supportsSavepoints() = 0; + + virtual bool supportsSchemasInDataManipulation() = 0; + + virtual bool supportsSchemasInIndexDefinitions() = 0; + + virtual bool supportsSchemasInPrivilegeDefinitions() = 0; + + virtual bool supportsSchemasInProcedureCalls() = 0; + + virtual bool supportsSchemasInTableDefinitions() = 0; + + virtual bool supportsSelectForUpdate() = 0; + + virtual bool supportsStatementPooling() = 0; + + virtual bool supportsStoredProcedures() = 0; + + virtual bool supportsSubqueriesInComparisons() = 0; + + virtual bool supportsSubqueriesInExists() = 0; + + virtual bool supportsSubqueriesInIns() = 0; + + virtual bool supportsSubqueriesInQuantifieds() = 0; + + virtual bool supportsTableCorrelationNames() = 0; + + virtual bool supportsTransactionIsolationLevel(int level) = 0; + + virtual bool supportsTransactions() = 0; + + virtual bool supportsTypeConversion() = 0; /* SDBC */ + + virtual bool supportsUnion() = 0; + + virtual bool supportsUnionAll() = 0; + + virtual bool updatesAreDetected(int type) = 0; + + virtual bool usesLocalFilePerTable() = 0; + + virtual bool usesLocalFiles() = 0; + + virtual ResultSet *getSchemata(const sql::SQLString& catalogName = "") = 0; + + virtual ResultSet *getSchemaObjects(const sql::SQLString& catalogName = "", + const sql::SQLString& schemaName = "", + const sql::SQLString& objectType = "", + bool includingDdl = true, + const sql::SQLString& objectName = "", + const sql::SQLString& contextTableName = "") = 0; + + virtual ResultSet *getSchemaObjectTypes() = 0; +}; + + +} /* namespace sql */ + +#endif /* _SQL_METADATA_H_ */ diff --git a/other/mysql/include/cppconn/parameter_metadata.h b/other/mysql/include/cppconn/parameter_metadata.h new file mode 100644 index 00000000..06639ed5 --- /dev/null +++ b/other/mysql/include/cppconn/parameter_metadata.h @@ -0,0 +1,78 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_PARAMETER_METADATA_H_ +#define _SQL_PARAMETER_METADATA_H_ + +#include <cppconn/sqlstring.h> + + +namespace sql +{ + +class ParameterMetaData +{ +public: + enum + { + parameterModeIn, + parameterModeInOut, + parameterModeOut, + parameterModeUnknown + }; + enum + { + parameterNoNulls, + parameterNullable, + parameterNullableUnknown + }; + + virtual sql::SQLString getParameterClassName(unsigned int param) = 0; + + virtual int getParameterCount() = 0; + + virtual int getParameterMode(unsigned int param) = 0; + + virtual int getParameterType(unsigned int param) = 0; + + virtual sql::SQLString getParameterTypeName(unsigned int param) = 0; + + virtual int getPrecision(unsigned int param) = 0; + + virtual int getScale(unsigned int param) = 0; + + virtual int isNullable(unsigned int param) = 0; + + virtual bool isSigned(unsigned int param) = 0; + +protected: + virtual ~ParameterMetaData() {} +}; + + +} /* namespace sql */ + +#endif /* _SQL_PARAMETER_METADATA_H_ */ diff --git a/other/mysql/include/cppconn/prepared_statement.h b/other/mysql/include/cppconn/prepared_statement.h new file mode 100644 index 00000000..a2945e44 --- /dev/null +++ b/other/mysql/include/cppconn/prepared_statement.h @@ -0,0 +1,91 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + + +#ifndef _SQL_PREPARED_STATEMENT_H_ +#define _SQL_PREPARED_STATEMENT_H_ + +#include <iostream> +#include "statement.h" + + +namespace sql +{ + +class Connection; +class ResultSet; +class ResultSetMetaData; +class ParameterMetaData; + +class PreparedStatement : public Statement +{ +public: + virtual ~PreparedStatement() {} + + virtual void clearParameters() = 0; + + virtual bool execute(const sql::SQLString& sql) = 0; + virtual bool execute() = 0; + + virtual ResultSet *executeQuery(const sql::SQLString& sql) = 0; + virtual ResultSet *executeQuery() = 0; + + virtual int executeUpdate(const sql::SQLString& sql) = 0; + virtual int executeUpdate() = 0; + + virtual ResultSetMetaData * getMetaData() = 0; + + virtual ParameterMetaData * getParameterMetaData() = 0; + + virtual void setBigInt(unsigned int parameterIndex, const sql::SQLString& value) = 0; + + virtual void setBlob(unsigned int parameterIndex, std::istream * blob) = 0; + + virtual void setBoolean(unsigned int parameterIndex, bool value) = 0; + + virtual void setDateTime(unsigned int parameterIndex, const sql::SQLString& value) = 0; + + virtual void setDouble(unsigned int parameterIndex, double value) = 0; + + virtual void setInt(unsigned int parameterIndex, int32_t value) = 0; + + virtual void setUInt(unsigned int parameterIndex, uint32_t value) = 0; + + virtual void setInt64(unsigned int parameterIndex, int64_t value) = 0; + + virtual void setUInt64(unsigned int parameterIndex, uint64_t value) = 0; + + virtual void setNull(unsigned int parameterIndex, int sqlType) = 0; + + virtual void setString(unsigned int parameterIndex, const sql::SQLString& value) = 0; + + virtual PreparedStatement * setResultSetType(sql::ResultSet::enum_type type) = 0; +}; + + +} /* namespace sql */ + +#endif /* _SQL_PREPARED_STATEMENT_H_ */ diff --git a/other/mysql/include/cppconn/resultset.h b/other/mysql/include/cppconn/resultset.h new file mode 100644 index 00000000..bd45dfb0 --- /dev/null +++ b/other/mysql/include/cppconn/resultset.h @@ -0,0 +1,182 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_RESULTSET_H_ +#define _SQL_RESULTSET_H_ + +#include "config.h" + +#include <list> +#include <map> +#include <iostream> +#include "sqlstring.h" +#include "resultset_metadata.h" + + +namespace sql +{ + +class Statement; + +class RowID +{ +public: + virtual ~RowID() {} +}; + +class ResultSet +{ +public: + enum + { + CLOSE_CURSORS_AT_COMMIT, + HOLD_CURSORS_OVER_COMMIT + }; + enum + { + CONCUR_READ_ONLY, + CONCUR_UPDATABLE + }; + enum + { + FETCH_FORWARD, + FETCH_REVERSE, + FETCH_UNKNOWN + }; + typedef enum + { + TYPE_FORWARD_ONLY, + TYPE_SCROLL_INSENSITIVE, + TYPE_SCROLL_SENSITIVE + } enum_type; + + virtual ~ResultSet() {} + + virtual bool absolute(int row) = 0; + + virtual void afterLast() = 0; + + virtual void beforeFirst() = 0; + + virtual void cancelRowUpdates() = 0; + + virtual void clearWarnings() = 0; + + virtual void close() = 0; + + virtual uint32_t findColumn(const sql::SQLString& columnLabel) const = 0; + + virtual bool first() = 0; + + virtual std::istream * getBlob(uint32_t columnIndex) const = 0; + virtual std::istream * getBlob(const sql::SQLString& columnLabel) const = 0; + + virtual bool getBoolean(uint32_t columnIndex) const = 0; + virtual bool getBoolean(const sql::SQLString& columnLabel) const = 0; + + virtual int getConcurrency() = 0; + virtual SQLString getCursorName() = 0; + + virtual long double getDouble(uint32_t columnIndex) const = 0; + virtual long double getDouble(const sql::SQLString& columnLabel) const = 0; + + virtual int getFetchDirection() = 0; + virtual size_t getFetchSize() = 0; + virtual int getHoldability() = 0; + + virtual int32_t getInt(uint32_t columnIndex) const = 0; + virtual int32_t getInt(const sql::SQLString& columnLabel) const = 0; + + virtual uint32_t getUInt(uint32_t columnIndex) const = 0; + virtual uint32_t getUInt(const sql::SQLString& columnLabel) const = 0; + + virtual int64_t getInt64(uint32_t columnIndex) const = 0; + virtual int64_t getInt64(const sql::SQLString& columnLabel) const = 0; + + virtual uint64_t getUInt64(uint32_t columnIndex) const = 0; + virtual uint64_t getUInt64(const sql::SQLString& columnLabel) const = 0; + + virtual ResultSetMetaData * getMetaData() const = 0; + + virtual size_t getRow() const = 0; + + virtual RowID * getRowId(uint32_t columnIndex) = 0; + virtual RowID * getRowId(const sql::SQLString & columnLabel) = 0; + + virtual const Statement * getStatement() const = 0; + + virtual SQLString getString(uint32_t columnIndex) const = 0; + virtual SQLString getString(const sql::SQLString& columnLabel) const = 0; + + virtual enum_type getType() const = 0; + + virtual void getWarnings() = 0; + + virtual void insertRow() = 0; + + virtual bool isAfterLast() const = 0; + + virtual bool isBeforeFirst() const = 0; + + virtual bool isClosed() const = 0; + + virtual bool isFirst() const = 0; + + virtual bool isLast() const = 0; + + virtual bool isNull(uint32_t columnIndex) const = 0; + virtual bool isNull(const sql::SQLString& columnLabel) const = 0; + + virtual bool last() = 0; + + virtual bool next() = 0; + + virtual void moveToCurrentRow() = 0; + + virtual void moveToInsertRow() = 0; + + virtual bool previous() = 0; + + virtual void refreshRow() = 0; + + virtual bool relative(int rows) = 0; + + virtual bool rowDeleted() = 0; + + virtual bool rowInserted() = 0; + + virtual bool rowUpdated() = 0; + + virtual void setFetchSize(size_t rows) = 0; + + virtual size_t rowsCount() const = 0; + + virtual bool wasNull() const = 0; +}; + +} /* namespace sql */ + +#endif /* _SQL_RESULTSET_H_ */ diff --git a/other/mysql/include/cppconn/resultset_metadata.h b/other/mysql/include/cppconn/resultset_metadata.h new file mode 100644 index 00000000..fb0efce0 --- /dev/null +++ b/other/mysql/include/cppconn/resultset_metadata.h @@ -0,0 +1,97 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_RESULTSET_METADATA_H_ +#define _SQL_RESULTSET_METADATA_H_ + +#include "sqlstring.h" +#include "datatype.h" + +namespace sql +{ + +class ResultSetMetaData +{ +public: + enum + { + columnNoNulls, + columnNullable, + columnNullableUnknown + }; + + virtual SQLString getCatalogName(unsigned int column) = 0; + + virtual unsigned int getColumnCount() = 0; + + virtual unsigned int getColumnDisplaySize(unsigned int column) = 0; + + virtual SQLString getColumnLabel(unsigned int column) = 0; + + virtual SQLString getColumnName(unsigned int column) = 0; + + virtual int getColumnType(unsigned int column) = 0; + + virtual SQLString getColumnTypeName(unsigned int column) = 0; + + virtual unsigned int getPrecision(unsigned int column) = 0; + + virtual unsigned int getScale(unsigned int column) = 0; + + virtual SQLString getSchemaName(unsigned int column) = 0; + + virtual SQLString getTableName(unsigned int column) = 0; + + virtual bool isAutoIncrement(unsigned int column) = 0; + + virtual bool isCaseSensitive(unsigned int column) = 0; + + virtual bool isCurrency(unsigned int column) = 0; + + virtual bool isDefinitelyWritable(unsigned int column) = 0; + + virtual int isNullable(unsigned int column) = 0; + + virtual bool isNumeric(unsigned int column) = 0; + + virtual bool isReadOnly(unsigned int column) = 0; + + virtual bool isSearchable(unsigned int column) = 0; + + virtual bool isSigned(unsigned int column) = 0; + + virtual bool isWritable(unsigned int column) = 0; + + virtual bool isZerofill(unsigned int column) = 0; + +protected: + virtual ~ResultSetMetaData() {} +}; + + +} /* namespace sql */ + +#endif /* _SQL_RESULTSET_METADATA_H_ */ diff --git a/other/mysql/include/cppconn/sqlstring.h b/other/mysql/include/cppconn/sqlstring.h new file mode 100644 index 00000000..d20080d1 --- /dev/null +++ b/other/mysql/include/cppconn/sqlstring.h @@ -0,0 +1,213 @@ +/* +Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_STRING_H_ +#define _SQL_STRING_H_ + +#include <string> +#include "build_config.h" +#include <iostream> + +namespace sql +{ + class CPPCONN_PUBLIC_FUNC SQLString + { + std::string realStr; + + public: +#ifdef _WIN32 + //TODO something less dirty-hackish. + static const size_t npos = static_cast<std::string::size_type>(-1); +#else + static const size_t npos = std::string::npos; +#endif + + ~SQLString() {} + + SQLString() {} + + SQLString(const SQLString & other) : realStr(other.realStr) {} + + SQLString(const std::string & other) : realStr(other) {} + + SQLString(const char other[]) : realStr(other) {} + + SQLString(const char * s, size_t n) : realStr(s, n) {} + + // Needed for stuff like SQLString str= "char * string constant" + const SQLString & operator=(const char * s) + { + realStr = s; + return *this; + } + + const SQLString & operator=(const std::string & rhs) + { + realStr = rhs; + return *this; + } + + const SQLString & operator=(const SQLString & rhs) + { + realStr = rhs.realStr; + return *this; + } + + // Conversion to st::string. Comes in play for stuff like std::string str= SQLString_var; + operator const std::string &() const + { + return realStr; + } + + /** For access std::string methods. Not sure we need it. Makes it look like some smart ptr. + possibly operator* - will look even more like smart ptr */ + std::string * operator ->() + { + return & realStr; + } + + int compare(const SQLString& str) const + { + return realStr.compare(str.realStr); + } + + int compare(const char * s) const + { + return realStr.compare(s); + } + + int compare(size_t pos1, size_t n1, const char * s) const + { + return realStr.compare(pos1, n1, s); + } + + const std::string & asStdString() const + { + return realStr; + } + + const char * c_str() const + { + return realStr.c_str(); + } + + size_t length() const + { + return realStr.length(); + } + + SQLString & append(const std::string & str) + { + realStr.append(str); + return *this; + } + + SQLString & append(const char * s) + { + realStr.append(s); + return *this; + } + + const char& operator[](size_t pos) const + { + return realStr[pos]; + } + + size_t find(char c, size_t pos = 0) const + { + return realStr.find(c, pos); + } + + size_t find(const SQLString & s, size_t pos = 0) const + { + return realStr.find(s.realStr, pos); + } + + SQLString substr(size_t pos = 0, size_t n = npos) const + { + return realStr.substr(pos, n); + } + + const SQLString& replace(size_t pos1, size_t n1, const SQLString & s) + { + realStr.replace(pos1, n1, s.realStr); + return *this; + } + + size_t find_first_of(char c, size_t pos = 0) const + { + return realStr.find_first_of(c, pos); + } + + size_t find_last_of(char c, size_t pos = npos) const + { + return realStr.find_last_of(c, pos); + } + + const SQLString & operator+=(const SQLString & op2) + { + realStr += op2.realStr; + return *this; + } +}; + + +/* + Operators that can and have to be not a member. +*/ +inline const SQLString operator+(const SQLString & op1, const SQLString & op2) +{ + return sql::SQLString(op1.asStdString() + op2.asStdString()); +} + +inline bool operator ==(const SQLString & op1, const SQLString & op2) +{ + return (op1.asStdString() == op2.asStdString()); +} + +inline bool operator !=(const SQLString & op1, const SQLString & op2) +{ + return (op1.asStdString() != op2.asStdString()); +} + +inline bool operator <(const SQLString & op1, const SQLString & op2) +{ + return op1.asStdString() < op2.asStdString(); +} + + +}// namespace sql + + +namespace std +{ + // operator << for SQLString output + inline ostream & operator << (ostream & os, const sql::SQLString & str ) + { + return os << str.asStdString(); + } +} +#endif diff --git a/other/mysql/include/cppconn/statement.h b/other/mysql/include/cppconn/statement.h new file mode 100644 index 00000000..ecb4db7d --- /dev/null +++ b/other/mysql/include/cppconn/statement.h @@ -0,0 +1,97 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_STATEMENT_H_ +#define _SQL_STATEMENT_H_ + +#include "config.h" +#include "resultset.h" + +#include <string> + +namespace sql +{ + +class ResultSet; +class Connection; +class SQLWarning; + + +class Statement +{ +public: + virtual ~Statement() {}; + + virtual Connection * getConnection() = 0; + + virtual void cancel() = 0; + + virtual void clearWarnings() = 0; + + virtual void close() = 0; + + virtual bool execute(const sql::SQLString& sql) = 0; + + virtual ResultSet * executeQuery(const sql::SQLString& sql) = 0; + + virtual int executeUpdate(const sql::SQLString& sql) = 0; + + virtual size_t getFetchSize() = 0; + + virtual unsigned int getMaxFieldSize() = 0; + + virtual uint64_t getMaxRows() = 0; + + virtual bool getMoreResults() = 0; + + virtual unsigned int getQueryTimeout() = 0; + + virtual ResultSet * getResultSet() = 0; + + virtual sql::ResultSet::enum_type getResultSetType() = 0; + + virtual uint64_t getUpdateCount() = 0; + + virtual const SQLWarning * getWarnings() = 0; + + virtual void setCursorName(const sql::SQLString & name) = 0; + + virtual void setEscapeProcessing(bool enable) = 0; + + virtual void setFetchSize(size_t rows) = 0; + + virtual void setMaxFieldSize(unsigned int max) = 0; + + virtual void setMaxRows(unsigned int max) = 0; + + virtual void setQueryTimeout(unsigned int seconds) = 0; + + virtual Statement * setResultSetType(sql::ResultSet::enum_type type) = 0; +}; + +} /* namespace sql */ + +#endif /* _SQL_STATEMENT_H_ */ diff --git a/other/mysql/include/cppconn/warning.h b/other/mysql/include/cppconn/warning.h new file mode 100644 index 00000000..3c4653a8 --- /dev/null +++ b/other/mysql/include/cppconn/warning.h @@ -0,0 +1,74 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _SQL_WARNING_H_ +#define _SQL_WARNING_H_ + + +#include <stdexcept> +#include <string> +#include <memory> +#include "sqlstring.h" + +namespace sql +{ + +#ifdef _WIN32 +#pragma warning (disable : 4290) +//warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) +#endif + +class SQLWarning +{ +public: + + SQLWarning(){} + + virtual const sql::SQLString & getMessage() const = 0; + + virtual const sql::SQLString & getSQLState() const = 0; + + virtual int getErrorCode() const = 0; + + virtual const SQLWarning * getNextWarning() const = 0; + + virtual void setNextWarning(const SQLWarning * _next) = 0; + +protected: + + virtual ~SQLWarning(){}; + + SQLWarning(const SQLWarning& e){}; + +private: + const SQLWarning & operator = (const SQLWarning & rhs); + +}; + + +} /* namespace sql */ + +#endif /* _SQL_WARNING_H_ */ diff --git a/other/mysql/include/mysql_connection.h b/other/mysql/include/mysql_connection.h new file mode 100644 index 00000000..8c81e813 --- /dev/null +++ b/other/mysql/include/mysql_connection.h @@ -0,0 +1,190 @@ +/* +Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _MYSQL_CONNECTION_H_ +#define _MYSQL_CONNECTION_H_ + +#include <cppconn/connection.h> +#include <boost/shared_ptr.hpp> +#include <boost/scoped_ptr.hpp> + +namespace sql +{ +namespace mysql +{ + +class MySQL_Savepoint : public sql::Savepoint +{ + sql::SQLString name; + +public: + MySQL_Savepoint(const sql::SQLString &savepoint); + virtual ~MySQL_Savepoint() {} + + int getSavepointId(); + + sql::SQLString getSavepointName(); + +private: + /* Prevent use of these */ + MySQL_Savepoint(const MySQL_Savepoint &); + void operator=(MySQL_Savepoint &); +}; + + +class MySQL_DebugLogger; +struct MySQL_ConnectionData; /* PIMPL */ +class MySQL_Statement; + +namespace NativeAPI +{ +class NativeConnectionWrapper; +} + +class CPPCONN_PUBLIC_FUNC MySQL_Connection : public sql::Connection +{ + MySQL_Statement * createServiceStmt(); + +public: + MySQL_Connection(Driver * _driver, + ::sql::mysql::NativeAPI::NativeConnectionWrapper & _proxy, + const sql::SQLString& hostName, + const sql::SQLString& userName, + const sql::SQLString& password); + + MySQL_Connection(Driver * _driver, ::sql::mysql::NativeAPI::NativeConnectionWrapper & _proxy, + std::map< sql::SQLString, sql::ConnectPropertyVal > & options); + + virtual ~MySQL_Connection(); + + void clearWarnings(); + + void close(); + + void commit(); + + sql::Statement * createStatement(); + + sql::SQLString escapeString(const sql::SQLString &); + + bool getAutoCommit(); + + sql::SQLString getCatalog(); + + Driver *getDriver(); + + sql::SQLString getSchema(); + + sql::SQLString getClientInfo(); + + void getClientOption(const sql::SQLString & optionName, void * optionValue); + + sql::DatabaseMetaData * getMetaData(); + + enum_transaction_isolation getTransactionIsolation(); + + const SQLWarning * getWarnings(); + + bool isClosed(); + + bool isReadOnly(); + + sql::SQLString nativeSQL(const sql::SQLString& sql); + + sql::PreparedStatement * prepareStatement(const sql::SQLString& sql); + + sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys); + + sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int columnIndexes[]); + + sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency); + + sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability); + + sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]); + + void releaseSavepoint(Savepoint * savepoint) ; + + void rollback(); + + void rollback(Savepoint * savepoint); + + void setAutoCommit(bool autoCommit); + + void setCatalog(const sql::SQLString& catalog); + + void setSchema(const sql::SQLString& catalog); + + sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue); + + void setHoldability(int holdability); + + void setReadOnly(bool readOnly); + + sql::Savepoint * setSavepoint(); + + sql::Savepoint * setSavepoint(const sql::SQLString& name); + + void setTransactionIsolation(enum_transaction_isolation level); + + virtual sql::SQLString getSessionVariable(const sql::SQLString & varname); + + virtual void setSessionVariable(const sql::SQLString & varname, const sql::SQLString & value); + + virtual sql::SQLString getLastStatementInfo(); + +private: + /* We do not really think this class has to be subclassed*/ + void checkClosed(); + void init(std::map< sql::SQLString, sql::ConnectPropertyVal > & properties); + + Driver * driver; + boost::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy; + + /* statement handle to execute queries initiated by driver. Perhaps it is + a good idea to move it to a separate helper class */ + boost::scoped_ptr< ::sql::mysql::MySQL_Statement > service; + + MySQL_ConnectionData * intern; /* pimpl */ + + /* Prevent use of these */ + MySQL_Connection(const MySQL_Connection &); + void operator=(MySQL_Connection &); +}; + +} /* namespace mysql */ +} /* namespace sql */ + +#endif // _MYSQL_CONNECTION_H_ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/other/mysql/include/mysql_driver.h b/other/mysql/include/mysql_driver.h new file mode 100644 index 00000000..ccd8cbc4 --- /dev/null +++ b/other/mysql/include/mysql_driver.h @@ -0,0 +1,104 @@ +/* +Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + +The MySQL Connector/C++ is licensed under the terms of the GPLv2 +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most +MySQL Connectors. There are special exceptions to the terms and +conditions of the GPLv2 as it is applied to this software, see the +FLOSS License Exception +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#ifndef _MYSQL_DRIVER_H_ +#define _MYSQL_DRIVER_H_ + +#include <boost/scoped_ptr.hpp> + +#include <cppconn/driver.h> + +extern "C" +{ +CPPCONN_PUBLIC_FUNC void * sql_mysql_get_driver_instance(); +} + +namespace sql +{ +namespace mysql +{ +namespace NativeAPI +{ + class NativeDriverWrapper; +} + +//class sql::mysql::NativeAPI::NativeDriverWrapper; + +class CPPCONN_PUBLIC_FUNC MySQL_Driver : public sql::Driver +{ + boost::scoped_ptr< ::sql::mysql::NativeAPI::NativeDriverWrapper > proxy; + +public: + MySQL_Driver(); + MySQL_Driver(const ::sql::SQLString & clientLib); + + virtual ~MySQL_Driver(); + + sql::Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password); + + sql::Connection * connect(sql::ConnectOptionsMap & options); + + int getMajorVersion(); + + int getMinorVersion(); + + int getPatchVersion(); + + const sql::SQLString & getName(); + + void threadInit(); + + void threadEnd(); + +private: + /* Prevent use of these */ + MySQL_Driver(const MySQL_Driver &); + void operator=(MySQL_Driver &); +}; + +/** We do not hide the function if MYSQLCLIENT_STATIC_BINDING(or anything else) not defined + because the counterpart C function is declared in the cppconn and is always visible. + If dynamic loading is not enabled then its result is just like of get_driver_instance() +*/ +CPPCONN_PUBLIC_FUNC MySQL_Driver * get_driver_instance_by_name(const char * const clientlib); + +CPPCONN_PUBLIC_FUNC MySQL_Driver * get_driver_instance(); +static inline MySQL_Driver * get_mysql_driver_instance() { return get_driver_instance(); } + + +} /* namespace mysql */ +} /* namespace sql */ + +#endif // _MYSQL_DRIVER_H_ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/other/mysql/linux/lib32/libmysqlclient.a b/other/mysql/linux/lib32/libmysqlclient.a new file mode 100644 index 00000000..879e1d4c --- /dev/null +++ b/other/mysql/linux/lib32/libmysqlclient.a Binary files differdiff --git a/other/mysql/linux/lib32/libmysqlcppconn-static.a b/other/mysql/linux/lib32/libmysqlcppconn-static.a new file mode 100644 index 00000000..41955789 --- /dev/null +++ b/other/mysql/linux/lib32/libmysqlcppconn-static.a Binary files differdiff --git a/other/mysql/linux/lib64/libmysqlclient.a b/other/mysql/linux/lib64/libmysqlclient.a new file mode 100644 index 00000000..ed51258d --- /dev/null +++ b/other/mysql/linux/lib64/libmysqlclient.a Binary files differdiff --git a/other/mysql/linux/lib64/libmysqlcppconn-static.a b/other/mysql/linux/lib64/libmysqlcppconn-static.a new file mode 100644 index 00000000..fecde50d --- /dev/null +++ b/other/mysql/linux/lib64/libmysqlcppconn-static.a Binary files differdiff --git a/other/mysql/mac/lib32/libmysqlclient.a b/other/mysql/mac/lib32/libmysqlclient.a new file mode 100644 index 00000000..b12a60a1 --- /dev/null +++ b/other/mysql/mac/lib32/libmysqlclient.a Binary files differdiff --git a/other/mysql/mac/lib32/libmysqlcppconn-static.a b/other/mysql/mac/lib32/libmysqlcppconn-static.a new file mode 100644 index 00000000..2b97e6e4 --- /dev/null +++ b/other/mysql/mac/lib32/libmysqlcppconn-static.a Binary files differdiff --git a/other/mysql/mac/lib64/libmysqlclient.a b/other/mysql/mac/lib64/libmysqlclient.a new file mode 100644 index 00000000..3959646e --- /dev/null +++ b/other/mysql/mac/lib64/libmysqlclient.a Binary files differdiff --git a/other/mysql/mac/lib64/libmysqlcppconn-static.a b/other/mysql/mac/lib64/libmysqlcppconn-static.a new file mode 100644 index 00000000..4c3eaa72 --- /dev/null +++ b/other/mysql/mac/lib64/libmysqlcppconn-static.a Binary files differdiff --git a/other/mysql/vc2005libs/libmysql.dll b/other/mysql/vc2005libs/libmysql.dll new file mode 100644 index 00000000..bac05727 --- /dev/null +++ b/other/mysql/vc2005libs/libmysql.dll Binary files differdiff --git a/other/mysql/vc2005libs/mysqlcppconn.dll b/other/mysql/vc2005libs/mysqlcppconn.dll new file mode 100644 index 00000000..13267bf7 --- /dev/null +++ b/other/mysql/vc2005libs/mysqlcppconn.dll Binary files differdiff --git a/other/mysql/vc2005libs/mysqlcppconn.lib b/other/mysql/vc2005libs/mysqlcppconn.lib new file mode 100644 index 00000000..866944d3 --- /dev/null +++ b/other/mysql/vc2005libs/mysqlcppconn.lib Binary files differ |