sss
parent
46a6e1dce5
commit
f2764c656c
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
|
|
@ -1,13 +1,32 @@
|
|||
/*
|
||||
Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The MySQL Connector/C++ is licensed under the terms of the GPL
|
||||
<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>.
|
||||
*/
|
||||
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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.
|
||||
|
@ -35,27 +54,34 @@
|
|||
#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 */
|
||||
#define HAVE_MS_INT8 1
|
||||
#define HAVE_MS_UINT8 1
|
||||
#define HAVE_MS_INT16 1
|
||||
#define HAVE_MS_UINT16 1
|
||||
#define HAVE_MS_INT32 1
|
||||
#define HAVE_MS_UINT32 1
|
||||
#define HAVE_MS_INT64 1
|
||||
#define HAVE_MS_UINT64 1
|
||||
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
|
||||
#if defined(HAVE_INTTYPES_H) && !defined(_WIN32)
|
||||
#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
|
||||
|
@ -86,5 +112,6 @@ typedef __int64 int64_t;
|
|||
typedef unsigned __int64 uint64_t;
|
||||
#endif
|
||||
|
||||
#endif // _MSC_VER >= 1600
|
||||
#endif // CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES
|
||||
#endif // _WIN32
|
||||
|
|
|
@ -1,42 +1,49 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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"
|
||||
#include "variant.h"
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
||||
|
||||
typedef boost::variant<int, double, bool, sql::SQLString > ConnectPropertyVal;
|
||||
typedef sql::Variant ConnectPropertyVal;
|
||||
|
||||
typedef std::map< sql::SQLString, ConnectPropertyVal > ConnectOptionsMap;
|
||||
|
||||
|
@ -47,107 +54,121 @@ class Driver;
|
|||
|
||||
typedef enum transaction_isolation
|
||||
{
|
||||
TRANSACTION_NONE= 0,
|
||||
TRANSACTION_READ_COMMITTED,
|
||||
TRANSACTION_READ_UNCOMMITTED,
|
||||
TRANSACTION_REPEATABLE_READ,
|
||||
TRANSACTION_SERIALIZABLE
|
||||
TRANSACTION_NONE= 0,
|
||||
TRANSACTION_READ_COMMITTED,
|
||||
TRANSACTION_READ_UNCOMMITTED,
|
||||
TRANSACTION_REPEATABLE_READ,
|
||||
TRANSACTION_SERIALIZABLE
|
||||
} enum_transaction_isolation;
|
||||
|
||||
enum ssl_mode
|
||||
{
|
||||
SSL_MODE_DISABLED= 1, SSL_MODE_PREFERRED, SSL_MODE_REQUIRED,
|
||||
SSL_MODE_VERIFY_CA, SSL_MODE_VERIFY_IDENTITY
|
||||
};
|
||||
|
||||
class Savepoint
|
||||
{
|
||||
/* Prevent use of these */
|
||||
Savepoint(const Savepoint &);
|
||||
void operator=(Savepoint &);
|
||||
/* Prevent use of these */
|
||||
Savepoint(const Savepoint &);
|
||||
void operator=(Savepoint &);
|
||||
public:
|
||||
Savepoint() {};
|
||||
virtual ~Savepoint() {};
|
||||
virtual int getSavepointId() = 0;
|
||||
Savepoint() {};
|
||||
virtual ~Savepoint() {};
|
||||
virtual int getSavepointId() = 0;
|
||||
|
||||
virtual sql::SQLString getSavepointName() = 0;
|
||||
virtual sql::SQLString getSavepointName() = 0;
|
||||
};
|
||||
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC Connection
|
||||
{
|
||||
/* Prevent use of these */
|
||||
Connection(const Connection &);
|
||||
void operator=(Connection &);
|
||||
/* Prevent use of these */
|
||||
Connection(const Connection &);
|
||||
void operator=(Connection &);
|
||||
public:
|
||||
|
||||
Connection() {};
|
||||
Connection() {};
|
||||
|
||||
virtual ~Connection() {};
|
||||
virtual ~Connection() {};
|
||||
|
||||
virtual void clearWarnings() = 0;
|
||||
virtual void clearWarnings() = 0;
|
||||
|
||||
virtual Statement *createStatement() = 0;
|
||||
virtual Statement *createStatement() = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual void commit() = 0;
|
||||
virtual void commit() = 0;
|
||||
|
||||
virtual bool getAutoCommit() = 0;
|
||||
virtual bool getAutoCommit() = 0;
|
||||
|
||||
virtual sql::SQLString getCatalog() = 0;
|
||||
virtual sql::SQLString getCatalog() = 0;
|
||||
|
||||
virtual Driver *getDriver() = 0;
|
||||
virtual Driver *getDriver() = 0;
|
||||
|
||||
virtual sql::SQLString getSchema() = 0;
|
||||
virtual sql::SQLString getSchema() = 0;
|
||||
|
||||
virtual sql::SQLString getClientInfo() = 0;
|
||||
virtual sql::SQLString getClientInfo() = 0;
|
||||
|
||||
virtual void getClientOption(const sql::SQLString & optionName, void * optionValue) = 0;
|
||||
virtual void getClientOption(const sql::SQLString & optionName, void * optionValue) = 0;
|
||||
|
||||
virtual DatabaseMetaData * getMetaData() = 0;
|
||||
virtual sql::SQLString getClientOption(const sql::SQLString & optionName) = 0;
|
||||
|
||||
virtual enum_transaction_isolation getTransactionIsolation() = 0;
|
||||
virtual DatabaseMetaData * getMetaData() = 0;
|
||||
|
||||
virtual const SQLWarning * getWarnings() = 0;
|
||||
virtual enum_transaction_isolation getTransactionIsolation() = 0;
|
||||
|
||||
virtual bool isClosed() = 0;
|
||||
virtual const SQLWarning * getWarnings() = 0;
|
||||
|
||||
virtual bool isReadOnly() = 0;
|
||||
virtual bool isClosed() = 0;
|
||||
|
||||
virtual sql::SQLString nativeSQL(const sql::SQLString& sql) = 0;
|
||||
virtual bool isReadOnly() = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql) = 0;
|
||||
virtual bool isValid() = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys) = 0;
|
||||
virtual bool reconnect() = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int* columnIndexes) = 0;
|
||||
virtual sql::SQLString nativeSQL(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency) = 0;
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) = 0;
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys) = 0;
|
||||
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]) = 0;
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int* columnIndexes) = 0;
|
||||
|
||||
virtual void releaseSavepoint(Savepoint * savepoint) = 0;
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency) = 0;
|
||||
|
||||
virtual void rollback() = 0;
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) = 0;
|
||||
|
||||
virtual void rollback(Savepoint * savepoint) = 0;
|
||||
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]) = 0;
|
||||
|
||||
virtual void setAutoCommit(bool autoCommit) = 0;
|
||||
virtual void releaseSavepoint(Savepoint * savepoint) = 0;
|
||||
|
||||
virtual void setCatalog(const sql::SQLString& catalog) = 0;
|
||||
virtual void rollback() = 0;
|
||||
|
||||
virtual void setSchema(const sql::SQLString& catalog) = 0;
|
||||
virtual void rollback(Savepoint * savepoint) = 0;
|
||||
|
||||
virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue) = 0;
|
||||
virtual void setAutoCommit(bool autoCommit) = 0;
|
||||
|
||||
virtual void setHoldability(int holdability) = 0;
|
||||
virtual void setCatalog(const sql::SQLString& catalog) = 0;
|
||||
|
||||
virtual void setReadOnly(bool readOnly) = 0;
|
||||
virtual void setSchema(const sql::SQLString& catalog) = 0;
|
||||
|
||||
virtual Savepoint * setSavepoint() = 0;
|
||||
virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue) = 0;
|
||||
|
||||
virtual Savepoint * setSavepoint(const sql::SQLString& name) = 0;
|
||||
virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const sql::SQLString & optionValue) = 0;
|
||||
|
||||
virtual void setTransactionIsolation(enum_transaction_isolation level) = 0;
|
||||
virtual void setHoldability(int holdability) = 0;
|
||||
|
||||
/* virtual void setTypeMap(Map map) = 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 */
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -30,35 +38,36 @@ namespace sql
|
|||
|
||||
class DataType
|
||||
{
|
||||
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
|
||||
};
|
||||
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,
|
||||
JSON
|
||||
};
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -34,35 +42,35 @@ namespace sql
|
|||
class CPPCONN_PUBLIC_FUNC Driver
|
||||
{
|
||||
protected:
|
||||
virtual ~Driver() {}
|
||||
virtual ~Driver() {}
|
||||
public:
|
||||
// Attempts to make a database connection to the given URL.
|
||||
// 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(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0;
|
||||
|
||||
virtual Connection * connect(ConnectOptionsMap & options) = 0;
|
||||
virtual Connection * connect(ConnectOptionsMap & options) = 0;
|
||||
|
||||
virtual int getMajorVersion() = 0;
|
||||
virtual int getMajorVersion() = 0;
|
||||
|
||||
virtual int getMinorVersion() = 0;
|
||||
virtual int getMinorVersion() = 0;
|
||||
|
||||
virtual int getPatchVersion() = 0;
|
||||
virtual int getPatchVersion() = 0;
|
||||
|
||||
virtual const sql::SQLString & getName() = 0;
|
||||
virtual const sql::SQLString & getName() = 0;
|
||||
|
||||
virtual void threadInit() = 0;
|
||||
virtual void threadInit() = 0;
|
||||
|
||||
virtual void threadEnd() = 0;
|
||||
virtual void threadEnd() = 0;
|
||||
};
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
extern "C"
|
||||
{
|
||||
CPPCONN_PUBLIC_FUNC sql::Driver * get_driver_instance();
|
||||
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);
|
||||
CPPCONN_PUBLIC_FUNC sql::Driver * get_driver_instance_by_name(const char * const clientlib);
|
||||
}
|
||||
|
||||
#endif /* _SQL_DRIVER_H_ */
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -33,15 +41,26 @@
|
|||
namespace sql
|
||||
{
|
||||
|
||||
#if (__cplusplus < 201103L)
|
||||
#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>&);
|
||||
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>&);
|
||||
#else
|
||||
#define MEMORY_ALLOC_OPERATORS(Class) \
|
||||
void* operator new(size_t size){ return ::operator new(size); } \
|
||||
void* operator new(size_t, void*) noexcept; \
|
||||
void* operator new(size_t, const std::nothrow_t&) noexcept; \
|
||||
void* operator new[](size_t); \
|
||||
void* operator new[](size_t, void*) noexcept; \
|
||||
void* operator new[](size_t, const std::nothrow_t&) noexcept; \
|
||||
void* operator new(size_t N, std::allocator<Class>&);
|
||||
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#pragma warning (disable : 4290)
|
||||
//warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
|
@ -56,71 +75,94 @@ class CPPCONN_PUBLIC_FUNC SQLException : public std::runtime_error
|
|||
#pragma warning(pop)
|
||||
#endif
|
||||
protected:
|
||||
const std::string sql_state;
|
||||
const int errNo;
|
||||
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 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, 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, 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(const std::string& reason) : std::runtime_error(reason), sql_state("HY000"), errNo(0) {}
|
||||
|
||||
SQLException() : std::runtime_error(""), sql_state("HY000"), errNo(0) {}
|
||||
SQLException() : std::runtime_error(""), sql_state("HY000"), errNo(0) {}
|
||||
|
||||
const std::string & getSQLState() const
|
||||
{
|
||||
return sql_state;
|
||||
}
|
||||
const std::string & getSQLState() const
|
||||
{
|
||||
return sql_state;
|
||||
}
|
||||
|
||||
const char * getSQLStateCStr() const
|
||||
{
|
||||
return sql_state.c_str();
|
||||
}
|
||||
const char * getSQLStateCStr() const
|
||||
{
|
||||
return sql_state.c_str();
|
||||
}
|
||||
|
||||
|
||||
int getErrorCode() const
|
||||
{
|
||||
return errNo;
|
||||
}
|
||||
int getErrorCode() const
|
||||
{
|
||||
return errNo;
|
||||
}
|
||||
|
||||
virtual ~SQLException() throw () {};
|
||||
virtual ~SQLException() throw () {};
|
||||
|
||||
protected:
|
||||
MEMORY_ALLOC_OPERATORS(SQLException)
|
||||
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) {}
|
||||
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) {}
|
||||
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) {}
|
||||
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) {}
|
||||
NonScrollableException(const NonScrollableException& e) : SQLException(e.what(), e.sql_state, e.errNo) { }
|
||||
NonScrollableException(const std::string& reason) : SQLException(reason, "", 0) {}
|
||||
};
|
||||
|
||||
struct CPPCONN_PUBLIC_FUNC SQLUnsupportedOptionException : public SQLException
|
||||
{
|
||||
SQLUnsupportedOptionException(const SQLUnsupportedOptionException& e, const std::string conn_option) :
|
||||
SQLException(e.what(), e.sql_state, e.errNo),
|
||||
option(conn_option )
|
||||
{}
|
||||
|
||||
SQLUnsupportedOptionException(const std::string& reason, const std::string conn_option) :
|
||||
SQLException(reason, "", 0),
|
||||
option(conn_option )
|
||||
{}
|
||||
|
||||
const char *getConnectionOption() const
|
||||
{
|
||||
return option.c_str();
|
||||
}
|
||||
|
||||
~SQLUnsupportedOptionException() throw () {};
|
||||
protected:
|
||||
const std::string option;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace sql */
|
||||
|
||||
#endif /* _SQL_EXCEPTION_H_ */
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -37,438 +45,446 @@ class ResultSet;
|
|||
class DatabaseMetaData
|
||||
{
|
||||
protected:
|
||||
virtual ~DatabaseMetaData() {}
|
||||
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
|
||||
};
|
||||
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 allProceduresAreCallable() = 0;
|
||||
|
||||
virtual bool allTablesAreSelectable() = 0;
|
||||
virtual bool allTablesAreSelectable() = 0;
|
||||
|
||||
virtual bool dataDefinitionCausesTransactionCommit() = 0;
|
||||
virtual bool dataDefinitionCausesTransactionCommit() = 0;
|
||||
|
||||
virtual bool dataDefinitionIgnoredInTransactions() = 0;
|
||||
virtual bool dataDefinitionIgnoredInTransactions() = 0;
|
||||
|
||||
virtual bool deletesAreDetected(int type) = 0;
|
||||
virtual bool deletesAreDetected(int type) = 0;
|
||||
|
||||
virtual bool doesMaxRowSizeIncludeBlobs() = 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 * 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 * getBestRowIdentifier(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, int scope, bool nullable) = 0;
|
||||
|
||||
virtual ResultSet * getCatalogs() = 0;
|
||||
virtual ResultSet * getCatalogs() = 0;
|
||||
|
||||
virtual const sql::SQLString& getCatalogSeparator() = 0;
|
||||
virtual const sql::SQLString& getCatalogSeparator() = 0;
|
||||
|
||||
virtual const sql::SQLString& getCatalogTerm() = 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 * 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 ResultSet * getColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, const sql::SQLString& columnNamePattern) = 0;
|
||||
|
||||
virtual Connection * getConnection() = 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 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 getDatabaseMajorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDatabaseMinorVersion() = 0;
|
||||
virtual unsigned int getDatabaseMinorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDatabasePatchVersion() = 0;
|
||||
virtual unsigned int getDatabasePatchVersion() = 0;
|
||||
|
||||
virtual const sql::SQLString& getDatabaseProductName() = 0;
|
||||
virtual const sql::SQLString& getDatabaseProductName() = 0;
|
||||
|
||||
virtual SQLString getDatabaseProductVersion() = 0;
|
||||
virtual SQLString getDatabaseProductVersion() = 0;
|
||||
|
||||
virtual int getDefaultTransactionIsolation() = 0;
|
||||
virtual int getDefaultTransactionIsolation() = 0;
|
||||
|
||||
virtual unsigned int getDriverMajorVersion() = 0;
|
||||
virtual unsigned int getDriverMajorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDriverMinorVersion() = 0;
|
||||
virtual unsigned int getDriverMinorVersion() = 0;
|
||||
|
||||
virtual unsigned int getDriverPatchVersion() = 0;
|
||||
virtual unsigned int getDriverPatchVersion() = 0;
|
||||
|
||||
virtual const sql::SQLString& getDriverName() = 0;
|
||||
virtual const sql::SQLString& getDriverName() = 0;
|
||||
|
||||
virtual const sql::SQLString& getDriverVersion() = 0;
|
||||
virtual const sql::SQLString& getDriverVersion() = 0;
|
||||
|
||||
virtual ResultSet * getExportedKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 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& getExtraNameCharacters() = 0;
|
||||
|
||||
virtual const sql::SQLString& getIdentifierQuoteString() = 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 * 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 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 getCDBCMajorVersion() = 0;
|
||||
|
||||
virtual unsigned int getCDBCMinorVersion() = 0;
|
||||
virtual unsigned int getCDBCMinorVersion() = 0;
|
||||
|
||||
virtual unsigned int getMaxBinaryLiteralLength() = 0;
|
||||
virtual unsigned int getMaxBinaryLiteralLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxCatalogNameLength() = 0;
|
||||
virtual unsigned int getMaxCatalogNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxCharLiteralLength() = 0;
|
||||
virtual unsigned int getMaxCharLiteralLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnNameLength() = 0;
|
||||
virtual unsigned int getMaxColumnNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInGroupBy() = 0;
|
||||
virtual unsigned int getMaxColumnsInGroupBy() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInIndex() = 0;
|
||||
virtual unsigned int getMaxColumnsInIndex() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInOrderBy() = 0;
|
||||
virtual unsigned int getMaxColumnsInOrderBy() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInSelect() = 0;
|
||||
virtual unsigned int getMaxColumnsInSelect() = 0;
|
||||
|
||||
virtual unsigned int getMaxColumnsInTable() = 0;
|
||||
virtual unsigned int getMaxColumnsInTable() = 0;
|
||||
|
||||
virtual unsigned int getMaxConnections() = 0;
|
||||
virtual unsigned int getMaxConnections() = 0;
|
||||
|
||||
virtual unsigned int getMaxCursorNameLength() = 0;
|
||||
virtual unsigned int getMaxCursorNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxIndexLength() = 0;
|
||||
virtual unsigned int getMaxIndexLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxProcedureNameLength() = 0;
|
||||
virtual unsigned int getMaxProcedureNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxRowSize() = 0;
|
||||
virtual unsigned int getMaxRowSize() = 0;
|
||||
|
||||
virtual unsigned int getMaxSchemaNameLength() = 0;
|
||||
virtual unsigned int getMaxSchemaNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxStatementLength() = 0;
|
||||
virtual unsigned int getMaxStatementLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxStatements() = 0;
|
||||
virtual unsigned int getMaxStatements() = 0;
|
||||
|
||||
virtual unsigned int getMaxTableNameLength() = 0;
|
||||
virtual unsigned int getMaxTableNameLength() = 0;
|
||||
|
||||
virtual unsigned int getMaxTablesInSelect() = 0;
|
||||
virtual unsigned int getMaxTablesInSelect() = 0;
|
||||
|
||||
virtual unsigned int getMaxUserNameLength() = 0;
|
||||
virtual unsigned int getMaxUserNameLength() = 0;
|
||||
|
||||
virtual const sql::SQLString& getNumericFunctions() = 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 * 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 * 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 ResultSet * getProcedures(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& procedureNamePattern) = 0;
|
||||
|
||||
virtual const sql::SQLString& getProcedureTerm() = 0;
|
||||
virtual const sql::SQLString& getProcedureTerm() = 0;
|
||||
|
||||
virtual int getResultSetHoldability() = 0;
|
||||
virtual int getResultSetHoldability() = 0;
|
||||
|
||||
virtual ResultSet * getSchemas() = 0;
|
||||
virtual ResultSet * getSchemas() = 0;
|
||||
|
||||
virtual const sql::SQLString& getSchemaTerm() = 0;
|
||||
virtual const sql::SQLString& getSchemaTerm() = 0;
|
||||
|
||||
virtual const sql::SQLString& getSearchStringEscape() = 0;
|
||||
virtual ResultSet * getSchemaCollation(const sql::SQLString& catalog, const sql::SQLString& schemaPattern) = 0;
|
||||
|
||||
virtual const sql::SQLString& getSQLKeywords() = 0;
|
||||
virtual ResultSet * getSchemaCharset(const sql::SQLString& catalog, const sql::SQLString& schemaPattern) = 0;
|
||||
|
||||
virtual int getSQLStateType() = 0;
|
||||
virtual const sql::SQLString& getSearchStringEscape() = 0;
|
||||
|
||||
virtual const sql::SQLString& getStringFunctions() = 0;
|
||||
virtual const sql::SQLString& getSQLKeywords() = 0;
|
||||
|
||||
virtual ResultSet * getSuperTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
virtual int getSQLStateType() = 0;
|
||||
|
||||
virtual ResultSet * getSuperTypes(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern) = 0;
|
||||
virtual const sql::SQLString& getStringFunctions() = 0;
|
||||
|
||||
virtual const sql::SQLString& getSystemFunctions() = 0;
|
||||
virtual ResultSet * getSuperTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual ResultSet * getTablePrivileges(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 ResultSet * getTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, std::list<sql::SQLString> &types) = 0;
|
||||
virtual const sql::SQLString& getSystemFunctions() = 0;
|
||||
|
||||
virtual ResultSet * getTableTypes() = 0;
|
||||
virtual ResultSet * getTablePrivileges(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual const sql::SQLString& getTimeDateFunctions() = 0;
|
||||
virtual ResultSet * getTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, std::list<sql::SQLString> &types) = 0;
|
||||
|
||||
virtual ResultSet * getTypeInfo() = 0;
|
||||
virtual ResultSet * getTableTypes() = 0;
|
||||
|
||||
virtual ResultSet * getUDTs(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, std::list<int> &types) = 0;
|
||||
virtual ResultSet * getTableCollation(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual SQLString getURL() = 0;
|
||||
virtual ResultSet * getTableCharset(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
|
||||
|
||||
virtual SQLString getUserName() = 0;
|
||||
virtual const sql::SQLString& getTimeDateFunctions() = 0;
|
||||
|
||||
virtual ResultSet * getVersionColumns(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
|
||||
virtual ResultSet * getTypeInfo() = 0;
|
||||
|
||||
virtual bool insertsAreDetected(int type) = 0;
|
||||
virtual ResultSet * getUDTs(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, std::list<int> &types) = 0;
|
||||
|
||||
virtual bool isCatalogAtStart() = 0;
|
||||
virtual SQLString getURL() = 0;
|
||||
|
||||
virtual bool isReadOnly() = 0;
|
||||
virtual SQLString getUserName() = 0;
|
||||
|
||||
virtual bool locatorsUpdateCopy() = 0;
|
||||
virtual ResultSet * getVersionColumns(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
|
||||
|
||||
virtual bool nullPlusNonNullIsNull() = 0;
|
||||
virtual bool insertsAreDetected(int type) = 0;
|
||||
|
||||
virtual bool nullsAreSortedAtEnd() = 0;
|
||||
virtual bool isCatalogAtStart() = 0;
|
||||
|
||||
virtual bool nullsAreSortedAtStart() = 0;
|
||||
virtual bool isReadOnly() = 0;
|
||||
|
||||
virtual bool nullsAreSortedHigh() = 0;
|
||||
virtual bool locatorsUpdateCopy() = 0;
|
||||
|
||||
virtual bool nullsAreSortedLow() = 0;
|
||||
virtual bool nullPlusNonNullIsNull() = 0;
|
||||
|
||||
virtual bool othersDeletesAreVisible(int type) = 0;
|
||||
virtual bool nullsAreSortedAtEnd() = 0;
|
||||
|
||||
virtual bool othersInsertsAreVisible(int type) = 0;
|
||||
virtual bool nullsAreSortedAtStart() = 0;
|
||||
|
||||
virtual bool othersUpdatesAreVisible(int type) = 0;
|
||||
virtual bool nullsAreSortedHigh() = 0;
|
||||
|
||||
virtual bool ownDeletesAreVisible(int type) = 0;
|
||||
virtual bool nullsAreSortedLow() = 0;
|
||||
|
||||
virtual bool ownInsertsAreVisible(int type) = 0;
|
||||
virtual bool othersDeletesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool ownUpdatesAreVisible(int type) = 0;
|
||||
virtual bool othersInsertsAreVisible(int type) = 0;
|
||||
|
||||
virtual bool storesLowerCaseIdentifiers() = 0;
|
||||
virtual bool othersUpdatesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool storesLowerCaseQuotedIdentifiers() = 0;
|
||||
virtual bool ownDeletesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool storesMixedCaseIdentifiers() = 0;
|
||||
virtual bool ownInsertsAreVisible(int type) = 0;
|
||||
|
||||
virtual bool storesMixedCaseQuotedIdentifiers() = 0;
|
||||
virtual bool ownUpdatesAreVisible(int type) = 0;
|
||||
|
||||
virtual bool storesUpperCaseIdentifiers() = 0;
|
||||
virtual bool storesLowerCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool storesUpperCaseQuotedIdentifiers() = 0;
|
||||
virtual bool storesLowerCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsAlterTableWithAddColumn() = 0;
|
||||
virtual bool storesMixedCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsAlterTableWithDropColumn() = 0;
|
||||
virtual bool storesMixedCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsANSI92EntryLevelSQL() = 0;
|
||||
virtual bool storesUpperCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsANSI92FullSQL() = 0;
|
||||
virtual bool storesUpperCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsANSI92IntermediateSQL() = 0;
|
||||
virtual bool supportsAlterTableWithAddColumn() = 0;
|
||||
|
||||
virtual bool supportsBatchUpdates() = 0;
|
||||
virtual bool supportsAlterTableWithDropColumn() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInDataManipulation() = 0;
|
||||
virtual bool supportsANSI92EntryLevelSQL() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInIndexDefinitions() = 0;
|
||||
virtual bool supportsANSI92FullSQL() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInPrivilegeDefinitions() = 0;
|
||||
virtual bool supportsANSI92IntermediateSQL() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInProcedureCalls() = 0;
|
||||
virtual bool supportsBatchUpdates() = 0;
|
||||
|
||||
virtual bool supportsCatalogsInTableDefinitions() = 0;
|
||||
virtual bool supportsCatalogsInDataManipulation() = 0;
|
||||
|
||||
virtual bool supportsColumnAliasing() = 0;
|
||||
virtual bool supportsCatalogsInIndexDefinitions() = 0;
|
||||
|
||||
virtual bool supportsConvert() = 0;
|
||||
virtual bool supportsCatalogsInPrivilegeDefinitions() = 0;
|
||||
|
||||
virtual bool supportsConvert(int fromType, int toType) = 0;
|
||||
virtual bool supportsCatalogsInProcedureCalls() = 0;
|
||||
|
||||
virtual bool supportsCoreSQLGrammar() = 0;
|
||||
virtual bool supportsCatalogsInTableDefinitions() = 0;
|
||||
|
||||
virtual bool supportsCorrelatedSubqueries() = 0;
|
||||
virtual bool supportsColumnAliasing() = 0;
|
||||
|
||||
virtual bool supportsDataDefinitionAndDataManipulationTransactions() = 0;
|
||||
virtual bool supportsConvert() = 0;
|
||||
|
||||
virtual bool supportsDataManipulationTransactionsOnly() = 0;
|
||||
virtual bool supportsConvert(int fromType, int toType) = 0;
|
||||
|
||||
virtual bool supportsDifferentTableCorrelationNames() = 0;
|
||||
virtual bool supportsCoreSQLGrammar() = 0;
|
||||
|
||||
virtual bool supportsExpressionsInOrderBy() = 0;
|
||||
virtual bool supportsCorrelatedSubqueries() = 0;
|
||||
|
||||
virtual bool supportsExtendedSQLGrammar() = 0;
|
||||
virtual bool supportsDataDefinitionAndDataManipulationTransactions() = 0;
|
||||
|
||||
virtual bool supportsFullOuterJoins() = 0;
|
||||
virtual bool supportsDataManipulationTransactionsOnly() = 0;
|
||||
|
||||
virtual bool supportsGetGeneratedKeys() = 0;
|
||||
virtual bool supportsDifferentTableCorrelationNames() = 0;
|
||||
|
||||
virtual bool supportsGroupBy() = 0;
|
||||
virtual bool supportsExpressionsInOrderBy() = 0;
|
||||
|
||||
virtual bool supportsGroupByBeyondSelect() = 0;
|
||||
virtual bool supportsExtendedSQLGrammar() = 0;
|
||||
|
||||
virtual bool supportsGroupByUnrelated() = 0;
|
||||
virtual bool supportsFullOuterJoins() = 0;
|
||||
|
||||
virtual bool supportsIntegrityEnhancementFacility() = 0;
|
||||
virtual bool supportsGetGeneratedKeys() = 0;
|
||||
|
||||
virtual bool supportsLikeEscapeClause() = 0;
|
||||
virtual bool supportsGroupBy() = 0;
|
||||
|
||||
virtual bool supportsLimitedOuterJoins() = 0;
|
||||
virtual bool supportsGroupByBeyondSelect() = 0;
|
||||
|
||||
virtual bool supportsMinimumSQLGrammar() = 0;
|
||||
virtual bool supportsGroupByUnrelated() = 0;
|
||||
|
||||
virtual bool supportsMixedCaseIdentifiers() = 0;
|
||||
virtual bool supportsIntegrityEnhancementFacility() = 0;
|
||||
|
||||
virtual bool supportsMixedCaseQuotedIdentifiers() = 0;
|
||||
virtual bool supportsLikeEscapeClause() = 0;
|
||||
|
||||
virtual bool supportsMultipleOpenResults() = 0;
|
||||
virtual bool supportsLimitedOuterJoins() = 0;
|
||||
|
||||
virtual bool supportsMultipleResultSets() = 0;
|
||||
virtual bool supportsMinimumSQLGrammar() = 0;
|
||||
|
||||
virtual bool supportsMultipleTransactions() = 0;
|
||||
virtual bool supportsMixedCaseIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsNamedParameters() = 0;
|
||||
virtual bool supportsMixedCaseQuotedIdentifiers() = 0;
|
||||
|
||||
virtual bool supportsNonNullableColumns() = 0;
|
||||
virtual bool supportsMultipleOpenResults() = 0;
|
||||
|
||||
virtual bool supportsOpenCursorsAcrossCommit() = 0;
|
||||
virtual bool supportsMultipleResultSets() = 0;
|
||||
|
||||
virtual bool supportsOpenCursorsAcrossRollback() = 0;
|
||||
virtual bool supportsMultipleTransactions() = 0;
|
||||
|
||||
virtual bool supportsOpenStatementsAcrossCommit() = 0;
|
||||
virtual bool supportsNamedParameters() = 0;
|
||||
|
||||
virtual bool supportsOpenStatementsAcrossRollback() = 0;
|
||||
virtual bool supportsNonNullableColumns() = 0;
|
||||
|
||||
virtual bool supportsOrderByUnrelated() = 0;
|
||||
virtual bool supportsOpenCursorsAcrossCommit() = 0;
|
||||
|
||||
virtual bool supportsOuterJoins() = 0;
|
||||
virtual bool supportsOpenCursorsAcrossRollback() = 0;
|
||||
|
||||
virtual bool supportsPositionedDelete() = 0;
|
||||
virtual bool supportsOpenStatementsAcrossCommit() = 0;
|
||||
|
||||
virtual bool supportsPositionedUpdate() = 0;
|
||||
virtual bool supportsOpenStatementsAcrossRollback() = 0;
|
||||
|
||||
virtual bool supportsResultSetConcurrency(int type, int concurrency) = 0;
|
||||
virtual bool supportsOrderByUnrelated() = 0;
|
||||
|
||||
virtual bool supportsResultSetHoldability(int holdability) = 0;
|
||||
virtual bool supportsOuterJoins() = 0;
|
||||
|
||||
virtual bool supportsResultSetType(int type) = 0;
|
||||
virtual bool supportsPositionedDelete() = 0;
|
||||
|
||||
virtual bool supportsSavepoints() = 0;
|
||||
virtual bool supportsPositionedUpdate() = 0;
|
||||
|
||||
virtual bool supportsSchemasInDataManipulation() = 0;
|
||||
virtual bool supportsResultSetConcurrency(int type, int concurrency) = 0;
|
||||
|
||||
virtual bool supportsSchemasInIndexDefinitions() = 0;
|
||||
virtual bool supportsResultSetHoldability(int holdability) = 0;
|
||||
|
||||
virtual bool supportsSchemasInPrivilegeDefinitions() = 0;
|
||||
virtual bool supportsResultSetType(int type) = 0;
|
||||
|
||||
virtual bool supportsSchemasInProcedureCalls() = 0;
|
||||
virtual bool supportsSavepoints() = 0;
|
||||
|
||||
virtual bool supportsSchemasInTableDefinitions() = 0;
|
||||
virtual bool supportsSchemasInDataManipulation() = 0;
|
||||
|
||||
virtual bool supportsSelectForUpdate() = 0;
|
||||
virtual bool supportsSchemasInIndexDefinitions() = 0;
|
||||
|
||||
virtual bool supportsStatementPooling() = 0;
|
||||
virtual bool supportsSchemasInPrivilegeDefinitions() = 0;
|
||||
|
||||
virtual bool supportsStoredProcedures() = 0;
|
||||
virtual bool supportsSchemasInProcedureCalls() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInComparisons() = 0;
|
||||
virtual bool supportsSchemasInTableDefinitions() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInExists() = 0;
|
||||
virtual bool supportsSelectForUpdate() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInIns() = 0;
|
||||
virtual bool supportsStatementPooling() = 0;
|
||||
|
||||
virtual bool supportsSubqueriesInQuantifieds() = 0;
|
||||
virtual bool supportsStoredProcedures() = 0;
|
||||
|
||||
virtual bool supportsTableCorrelationNames() = 0;
|
||||
virtual bool supportsSubqueriesInComparisons() = 0;
|
||||
|
||||
virtual bool supportsTransactionIsolationLevel(int level) = 0;
|
||||
virtual bool supportsSubqueriesInExists() = 0;
|
||||
|
||||
virtual bool supportsTransactions() = 0;
|
||||
virtual bool supportsSubqueriesInIns() = 0;
|
||||
|
||||
virtual bool supportsTypeConversion() = 0; /* SDBC */
|
||||
virtual bool supportsSubqueriesInQuantifieds() = 0;
|
||||
|
||||
virtual bool supportsUnion() = 0;
|
||||
virtual bool supportsTableCorrelationNames() = 0;
|
||||
|
||||
virtual bool supportsUnionAll() = 0;
|
||||
virtual bool supportsTransactionIsolationLevel(int level) = 0;
|
||||
|
||||
virtual bool updatesAreDetected(int type) = 0;
|
||||
virtual bool supportsTransactions() = 0;
|
||||
|
||||
virtual bool usesLocalFilePerTable() = 0;
|
||||
virtual bool supportsTypeConversion() = 0; /* SDBC */
|
||||
|
||||
virtual bool usesLocalFiles() = 0;
|
||||
virtual bool supportsUnion() = 0;
|
||||
|
||||
virtual ResultSet *getSchemata(const sql::SQLString& catalogName = "") = 0;
|
||||
virtual bool supportsUnionAll() = 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 bool updatesAreDetected(int type) = 0;
|
||||
|
||||
virtual ResultSet *getSchemaObjectTypes() = 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;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -34,40 +42,40 @@ namespace sql
|
|||
class ParameterMetaData
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
parameterModeIn,
|
||||
parameterModeInOut,
|
||||
parameterModeOut,
|
||||
parameterModeUnknown
|
||||
};
|
||||
enum
|
||||
{
|
||||
parameterNoNulls,
|
||||
parameterNullable,
|
||||
parameterNullableUnknown
|
||||
};
|
||||
enum
|
||||
{
|
||||
parameterModeIn,
|
||||
parameterModeInOut,
|
||||
parameterModeOut,
|
||||
parameterModeUnknown
|
||||
};
|
||||
enum
|
||||
{
|
||||
parameterNoNulls,
|
||||
parameterNullable,
|
||||
parameterNullableUnknown
|
||||
};
|
||||
|
||||
virtual sql::SQLString getParameterClassName(unsigned int param) = 0;
|
||||
virtual sql::SQLString getParameterClassName(unsigned int param) = 0;
|
||||
|
||||
virtual int getParameterCount() = 0;
|
||||
virtual int getParameterCount() = 0;
|
||||
|
||||
virtual int getParameterMode(unsigned int param) = 0;
|
||||
virtual int getParameterMode(unsigned int param) = 0;
|
||||
|
||||
virtual int getParameterType(unsigned int param) = 0;
|
||||
virtual int getParameterType(unsigned int param) = 0;
|
||||
|
||||
virtual sql::SQLString getParameterTypeName(unsigned int param) = 0;
|
||||
virtual sql::SQLString getParameterTypeName(unsigned int param) = 0;
|
||||
|
||||
virtual int getPrecision(unsigned int param) = 0;
|
||||
virtual int getPrecision(unsigned int param) = 0;
|
||||
|
||||
virtual int getScale(unsigned int param) = 0;
|
||||
virtual int getScale(unsigned int param) = 0;
|
||||
|
||||
virtual int isNullable(unsigned int param) = 0;
|
||||
virtual int isNullable(unsigned int param) = 0;
|
||||
|
||||
virtual bool isSigned(unsigned int param) = 0;
|
||||
virtual bool isSigned(unsigned int param) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ParameterMetaData() {}
|
||||
virtual ~ParameterMetaData() {}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -41,46 +49,48 @@ class ParameterMetaData;
|
|||
class PreparedStatement : public Statement
|
||||
{
|
||||
public:
|
||||
virtual ~PreparedStatement() {}
|
||||
virtual ~PreparedStatement() {}
|
||||
|
||||
virtual void clearParameters() = 0;
|
||||
virtual void clearParameters() = 0;
|
||||
|
||||
virtual bool execute(const sql::SQLString& sql) = 0;
|
||||
virtual bool execute() = 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 ResultSet *executeQuery(const sql::SQLString& sql) = 0;
|
||||
virtual ResultSet *executeQuery() = 0;
|
||||
|
||||
virtual int executeUpdate(const sql::SQLString& sql) = 0;
|
||||
virtual int executeUpdate() = 0;
|
||||
virtual int executeUpdate(const sql::SQLString& sql) = 0;
|
||||
virtual int executeUpdate() = 0;
|
||||
|
||||
virtual ResultSetMetaData * getMetaData() = 0;
|
||||
virtual ResultSetMetaData * getMetaData() = 0;
|
||||
|
||||
virtual ParameterMetaData * getParameterMetaData() = 0;
|
||||
virtual ParameterMetaData * getParameterMetaData() = 0;
|
||||
|
||||
virtual void setBigInt(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
virtual bool getMoreResults() = 0;
|
||||
|
||||
virtual void setBlob(unsigned int parameterIndex, std::istream * blob) = 0;
|
||||
virtual void setBigInt(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
|
||||
virtual void setBoolean(unsigned int parameterIndex, bool value) = 0;
|
||||
virtual void setBlob(unsigned int parameterIndex, std::istream * blob) = 0;
|
||||
|
||||
virtual void setDateTime(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
virtual void setBoolean(unsigned int parameterIndex, bool value) = 0;
|
||||
|
||||
virtual void setDouble(unsigned int parameterIndex, double value) = 0;
|
||||
virtual void setDateTime(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
|
||||
virtual void setInt(unsigned int parameterIndex, int32_t value) = 0;
|
||||
virtual void setDouble(unsigned int parameterIndex, double value) = 0;
|
||||
|
||||
virtual void setUInt(unsigned int parameterIndex, uint32_t value) = 0;
|
||||
virtual void setInt(unsigned int parameterIndex, int32_t value) = 0;
|
||||
|
||||
virtual void setInt64(unsigned int parameterIndex, int64_t value) = 0;
|
||||
virtual void setUInt(unsigned int parameterIndex, uint32_t value) = 0;
|
||||
|
||||
virtual void setUInt64(unsigned int parameterIndex, uint64_t value) = 0;
|
||||
virtual void setInt64(unsigned int parameterIndex, int64_t value) = 0;
|
||||
|
||||
virtual void setNull(unsigned int parameterIndex, int sqlType) = 0;
|
||||
virtual void setUInt64(unsigned int parameterIndex, uint64_t value) = 0;
|
||||
|
||||
virtual void setString(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
virtual void setNull(unsigned int parameterIndex, int sqlType) = 0;
|
||||
|
||||
virtual PreparedStatement * setResultSetType(sql::ResultSet::enum_type type) = 0;
|
||||
virtual void setString(unsigned int parameterIndex, const sql::SQLString& value) = 0;
|
||||
|
||||
virtual PreparedStatement * setResultSetType(sql::ResultSet::enum_type type) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -42,137 +50,137 @@ class Statement;
|
|||
class RowID
|
||||
{
|
||||
public:
|
||||
virtual ~RowID() {}
|
||||
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;
|
||||
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 ~ResultSet() {}
|
||||
|
||||
virtual bool absolute(int row) = 0;
|
||||
virtual bool absolute(int row) = 0;
|
||||
|
||||
virtual void afterLast() = 0;
|
||||
virtual void afterLast() = 0;
|
||||
|
||||
virtual void beforeFirst() = 0;
|
||||
virtual void beforeFirst() = 0;
|
||||
|
||||
virtual void cancelRowUpdates() = 0;
|
||||
virtual void cancelRowUpdates() = 0;
|
||||
|
||||
virtual void clearWarnings() = 0;
|
||||
virtual void clearWarnings() = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual uint32_t findColumn(const sql::SQLString& columnLabel) const = 0;
|
||||
virtual uint32_t findColumn(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual bool first() = 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 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 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 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 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 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 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 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 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 uint64_t getUInt64(uint32_t columnIndex) const = 0;
|
||||
virtual uint64_t getUInt64(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual ResultSetMetaData * getMetaData() const = 0;
|
||||
virtual ResultSetMetaData * getMetaData() const = 0;
|
||||
|
||||
virtual size_t getRow() const = 0;
|
||||
virtual size_t getRow() const = 0;
|
||||
|
||||
virtual RowID * getRowId(uint32_t columnIndex) = 0;
|
||||
virtual RowID * getRowId(const sql::SQLString & columnLabel) = 0;
|
||||
virtual RowID * getRowId(uint32_t columnIndex) = 0;
|
||||
virtual RowID * getRowId(const sql::SQLString & columnLabel) = 0;
|
||||
|
||||
virtual const Statement * getStatement() const = 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 SQLString getString(uint32_t columnIndex) const = 0;
|
||||
virtual SQLString getString(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual enum_type getType() const = 0;
|
||||
virtual enum_type getType() const = 0;
|
||||
|
||||
virtual void getWarnings() = 0;
|
||||
virtual void getWarnings() = 0;
|
||||
|
||||
virtual void insertRow() = 0;
|
||||
virtual void insertRow() = 0;
|
||||
|
||||
virtual bool isAfterLast() const = 0;
|
||||
virtual bool isAfterLast() const = 0;
|
||||
|
||||
virtual bool isBeforeFirst() const = 0;
|
||||
virtual bool isBeforeFirst() const = 0;
|
||||
|
||||
virtual bool isClosed() const = 0;
|
||||
virtual bool isClosed() const = 0;
|
||||
|
||||
virtual bool isFirst() const = 0;
|
||||
virtual bool isFirst() const = 0;
|
||||
|
||||
virtual bool isLast() 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 isNull(uint32_t columnIndex) const = 0;
|
||||
virtual bool isNull(const sql::SQLString& columnLabel) const = 0;
|
||||
|
||||
virtual bool last() = 0;
|
||||
virtual bool last() = 0;
|
||||
|
||||
virtual bool next() = 0;
|
||||
virtual bool next() = 0;
|
||||
|
||||
virtual void moveToCurrentRow() = 0;
|
||||
virtual void moveToCurrentRow() = 0;
|
||||
|
||||
virtual void moveToInsertRow() = 0;
|
||||
virtual void moveToInsertRow() = 0;
|
||||
|
||||
virtual bool previous() = 0;
|
||||
virtual bool previous() = 0;
|
||||
|
||||
virtual void refreshRow() = 0;
|
||||
virtual void refreshRow() = 0;
|
||||
|
||||
virtual bool relative(int rows) = 0;
|
||||
virtual bool relative(int rows) = 0;
|
||||
|
||||
virtual bool rowDeleted() = 0;
|
||||
virtual bool rowDeleted() = 0;
|
||||
|
||||
virtual bool rowInserted() = 0;
|
||||
virtual bool rowInserted() = 0;
|
||||
|
||||
virtual bool rowUpdated() = 0;
|
||||
virtual bool rowUpdated() = 0;
|
||||
|
||||
virtual void setFetchSize(size_t rows) = 0;
|
||||
virtual void setFetchSize(size_t rows) = 0;
|
||||
|
||||
virtual size_t rowsCount() const = 0;
|
||||
virtual size_t rowsCount() const = 0;
|
||||
|
||||
virtual bool wasNull() const = 0;
|
||||
virtual bool wasNull() const = 0;
|
||||
};
|
||||
|
||||
} /* namespace sql */
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -34,57 +42,63 @@ namespace sql
|
|||
class ResultSetMetaData
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
columnNoNulls,
|
||||
columnNullable,
|
||||
columnNullableUnknown
|
||||
};
|
||||
enum
|
||||
{
|
||||
columnNoNulls,
|
||||
columnNullable,
|
||||
columnNullableUnknown
|
||||
};
|
||||
|
||||
virtual SQLString getCatalogName(unsigned int column) = 0;
|
||||
virtual SQLString getCatalogName(unsigned int column) = 0;
|
||||
|
||||
virtual unsigned int getColumnCount() = 0;
|
||||
virtual unsigned int getColumnCount() = 0;
|
||||
|
||||
virtual unsigned int getColumnDisplaySize(unsigned int column) = 0;
|
||||
virtual unsigned int getColumnDisplaySize(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getColumnLabel(unsigned int column) = 0;
|
||||
virtual SQLString getColumnLabel(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getColumnName(unsigned int column) = 0;
|
||||
virtual SQLString getColumnName(unsigned int column) = 0;
|
||||
|
||||
virtual int getColumnType(unsigned int column) = 0;
|
||||
virtual int getColumnType(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getColumnTypeName(unsigned int column) = 0;
|
||||
virtual SQLString getColumnTypeName(unsigned int column) = 0;
|
||||
|
||||
virtual unsigned int getPrecision(unsigned int column) = 0;
|
||||
virtual SQLString getColumnCharset(unsigned int columnIndex) = 0;
|
||||
|
||||
virtual unsigned int getScale(unsigned int column) = 0;
|
||||
virtual SQLString getColumnCollation(unsigned int columnIndex) = 0;
|
||||
|
||||
virtual SQLString getSchemaName(unsigned int column) = 0;
|
||||
virtual unsigned int getPrecision(unsigned int column) = 0;
|
||||
|
||||
virtual SQLString getTableName(unsigned int column) = 0;
|
||||
virtual unsigned int getScale(unsigned int column) = 0;
|
||||
|
||||
virtual bool isAutoIncrement(unsigned int column) = 0;
|
||||
virtual SQLString getSchemaName(unsigned int column) = 0;
|
||||
|
||||
virtual bool isCaseSensitive(unsigned int column) = 0;
|
||||
virtual SQLString getTableName(unsigned int column) = 0;
|
||||
|
||||
virtual bool isCurrency(unsigned int column) = 0;
|
||||
virtual bool isAutoIncrement(unsigned int column) = 0;
|
||||
|
||||
virtual bool isDefinitelyWritable(unsigned int column) = 0;
|
||||
virtual bool isCaseSensitive(unsigned int column) = 0;
|
||||
|
||||
virtual int isNullable(unsigned int column) = 0;
|
||||
virtual bool isCurrency(unsigned int column) = 0;
|
||||
|
||||
virtual bool isReadOnly(unsigned int column) = 0;
|
||||
virtual bool isDefinitelyWritable(unsigned int column) = 0;
|
||||
|
||||
virtual bool isSearchable(unsigned int column) = 0;
|
||||
virtual int isNullable(unsigned int column) = 0;
|
||||
|
||||
virtual bool isSigned(unsigned int column) = 0;
|
||||
virtual bool isNumeric(unsigned int column) = 0;
|
||||
|
||||
virtual bool isWritable(unsigned int column) = 0;
|
||||
virtual bool isReadOnly(unsigned int column) = 0;
|
||||
|
||||
virtual bool isZerofill(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() {}
|
||||
virtual ~ResultSetMetaData() {}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,175 +1,208 @@
|
|||
/*
|
||||
Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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 <algorithm>
|
||||
#include "build_config.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace sql
|
||||
{
|
||||
class CPPCONN_PUBLIC_FUNC SQLString
|
||||
{
|
||||
std::string realStr;
|
||||
class CPPCONN_PUBLIC_FUNC SQLString
|
||||
{
|
||||
std::string realStr;
|
||||
|
||||
public:
|
||||
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;
|
||||
static const size_t npos = std::string::npos;
|
||||
#endif
|
||||
|
||||
~SQLString() {}
|
||||
~SQLString() {}
|
||||
|
||||
SQLString() {}
|
||||
SQLString() {}
|
||||
|
||||
SQLString(const SQLString & other) : realStr(other.realStr) {}
|
||||
SQLString(const SQLString & other) : realStr(other.realStr) {}
|
||||
|
||||
SQLString(const std::string & other) : realStr(other) {}
|
||||
SQLString(const std::string & other) : realStr(other) {}
|
||||
|
||||
SQLString(const char other[]) : realStr(other) {}
|
||||
SQLString(const char other[]) : realStr(other) {}
|
||||
|
||||
SQLString(const char * s, size_t n) : realStr(s, n) {}
|
||||
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;
|
||||
}
|
||||
// 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 std::string & rhs)
|
||||
{
|
||||
realStr = rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const SQLString & operator=(const SQLString & rhs)
|
||||
{
|
||||
realStr = rhs.realStr;
|
||||
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;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
/** 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 SQLString& str) const
|
||||
{
|
||||
return realStr.compare(str.realStr);
|
||||
}
|
||||
|
||||
int compare(const char * s) const
|
||||
{
|
||||
return realStr.compare(s);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
int caseCompare(const SQLString &s) const
|
||||
{
|
||||
std::string tmp(realStr), str(s);
|
||||
std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
return tmp.compare(str);
|
||||
}
|
||||
|
||||
const char * c_str() const
|
||||
{
|
||||
return realStr.c_str();
|
||||
}
|
||||
int caseCompare(const char * s) const
|
||||
{
|
||||
std::string tmp(realStr), str(s);
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
|
||||
return tmp.compare(str);
|
||||
}
|
||||
|
||||
size_t length() const
|
||||
{
|
||||
return realStr.length();
|
||||
}
|
||||
int caseCompare(size_t pos1, size_t n1, const char * s) const
|
||||
{
|
||||
std::string tmp(realStr.c_str() + pos1, n1), str(s);
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
|
||||
return tmp.compare(str);
|
||||
}
|
||||
|
||||
SQLString & append(const std::string & str)
|
||||
{
|
||||
realStr.append(str);
|
||||
return *this;
|
||||
}
|
||||
const std::string & asStdString() const
|
||||
{
|
||||
return realStr;
|
||||
}
|
||||
|
||||
SQLString & append(const char * s)
|
||||
{
|
||||
realStr.append(s);
|
||||
return *this;
|
||||
}
|
||||
const char * c_str() const
|
||||
{
|
||||
return realStr.c_str();
|
||||
}
|
||||
|
||||
const char& operator[](size_t pos) const
|
||||
{
|
||||
return realStr[pos];
|
||||
}
|
||||
size_t length() const
|
||||
{
|
||||
return realStr.length();
|
||||
}
|
||||
|
||||
size_t find(char c, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find(c, pos);
|
||||
}
|
||||
SQLString & append(const std::string & str)
|
||||
{
|
||||
realStr.append(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t find(const SQLString & s, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find(s.realStr, pos);
|
||||
}
|
||||
SQLString & append(const char * s)
|
||||
{
|
||||
realStr.append(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SQLString substr(size_t pos = 0, size_t n = npos) const
|
||||
{
|
||||
return realStr.substr(pos, n);
|
||||
}
|
||||
const char& operator[](size_t pos) const
|
||||
{
|
||||
return realStr[pos];
|
||||
}
|
||||
|
||||
const SQLString& replace(size_t pos1, size_t n1, const SQLString & s)
|
||||
{
|
||||
realStr.replace(pos1, n1, s.realStr);
|
||||
return *this;
|
||||
}
|
||||
size_t find(char c, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find(c, pos);
|
||||
}
|
||||
|
||||
size_t find_first_of(char c, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find_first_of(c, pos);
|
||||
}
|
||||
size_t find(const SQLString & s, size_t pos = 0) const
|
||||
{
|
||||
return realStr.find(s.realStr, pos);
|
||||
}
|
||||
|
||||
size_t find_last_of(char c, size_t pos = npos) const
|
||||
{
|
||||
return realStr.find_last_of(c, pos);
|
||||
}
|
||||
SQLString substr(size_t pos = 0, size_t n = npos) const
|
||||
{
|
||||
return realStr.substr(pos, n);
|
||||
}
|
||||
|
||||
const SQLString & operator+=(const SQLString & op2)
|
||||
{
|
||||
realStr += op2.realStr;
|
||||
return *this;
|
||||
}
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -178,22 +211,22 @@ namespace sql
|
|||
*/
|
||||
inline const SQLString operator+(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return sql::SQLString(op1.asStdString() + op2.asStdString());
|
||||
return sql::SQLString(op1.asStdString() + op2.asStdString());
|
||||
}
|
||||
|
||||
inline bool operator ==(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return (op1.asStdString() == op2.asStdString());
|
||||
return (op1.asStdString() == op2.asStdString());
|
||||
}
|
||||
|
||||
inline bool operator !=(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return (op1.asStdString() != op2.asStdString());
|
||||
return (op1.asStdString() != op2.asStdString());
|
||||
}
|
||||
|
||||
inline bool operator <(const SQLString & op1, const SQLString & op2)
|
||||
{
|
||||
return op1.asStdString() < op2.asStdString();
|
||||
return op1.asStdString() < op2.asStdString();
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,10 +235,10 @@ inline bool operator <(const SQLString & op1, const SQLString & op2)
|
|||
|
||||
namespace std
|
||||
{
|
||||
// operator << for SQLString output
|
||||
inline ostream & operator << (ostream & os, const sql::SQLString & str )
|
||||
{
|
||||
return os << str.asStdString();
|
||||
}
|
||||
// operator << for SQLString output
|
||||
inline ostream & operator << (ostream & os, const sql::SQLString & str )
|
||||
{
|
||||
return os << str.asStdString();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -41,53 +49,53 @@ class SQLWarning;
|
|||
class Statement
|
||||
{
|
||||
public:
|
||||
virtual ~Statement() {};
|
||||
virtual ~Statement() {};
|
||||
|
||||
virtual Connection * getConnection() = 0;
|
||||
virtual Connection * getConnection() = 0;
|
||||
|
||||
virtual void cancel() = 0;
|
||||
virtual void cancel() = 0;
|
||||
|
||||
virtual void clearWarnings() = 0;
|
||||
virtual void clearWarnings() = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual bool execute(const sql::SQLString& sql) = 0;
|
||||
virtual bool execute(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual ResultSet * executeQuery(const sql::SQLString& sql) = 0;
|
||||
virtual ResultSet * executeQuery(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual int executeUpdate(const sql::SQLString& sql) = 0;
|
||||
virtual int executeUpdate(const sql::SQLString& sql) = 0;
|
||||
|
||||
virtual size_t getFetchSize() = 0;
|
||||
virtual size_t getFetchSize() = 0;
|
||||
|
||||
virtual unsigned int getMaxFieldSize() = 0;
|
||||
virtual unsigned int getMaxFieldSize() = 0;
|
||||
|
||||
virtual uint64_t getMaxRows() = 0;
|
||||
virtual uint64_t getMaxRows() = 0;
|
||||
|
||||
virtual bool getMoreResults() = 0;
|
||||
virtual bool getMoreResults() = 0;
|
||||
|
||||
virtual unsigned int getQueryTimeout() = 0;
|
||||
virtual unsigned int getQueryTimeout() = 0;
|
||||
|
||||
virtual ResultSet * getResultSet() = 0;
|
||||
virtual ResultSet * getResultSet() = 0;
|
||||
|
||||
virtual sql::ResultSet::enum_type getResultSetType() = 0;
|
||||
virtual sql::ResultSet::enum_type getResultSetType() = 0;
|
||||
|
||||
virtual uint64_t getUpdateCount() = 0;
|
||||
virtual uint64_t getUpdateCount() = 0;
|
||||
|
||||
virtual const SQLWarning * getWarnings() = 0;
|
||||
virtual const SQLWarning * getWarnings() = 0;
|
||||
|
||||
virtual void setCursorName(const sql::SQLString & name) = 0;
|
||||
virtual void setCursorName(const sql::SQLString & name) = 0;
|
||||
|
||||
virtual void setEscapeProcessing(bool enable) = 0;
|
||||
virtual void setEscapeProcessing(bool enable) = 0;
|
||||
|
||||
virtual void setFetchSize(size_t rows) = 0;
|
||||
virtual void setFetchSize(size_t rows) = 0;
|
||||
|
||||
virtual void setMaxFieldSize(unsigned int max) = 0;
|
||||
virtual void setMaxFieldSize(unsigned int max) = 0;
|
||||
|
||||
virtual void setMaxRows(unsigned int max) = 0;
|
||||
virtual void setMaxRows(unsigned int max) = 0;
|
||||
|
||||
virtual void setQueryTimeout(unsigned int seconds) = 0;
|
||||
virtual void setQueryTimeout(unsigned int seconds) = 0;
|
||||
|
||||
virtual Statement * setResultSetType(sql::ResultSet::enum_type type) = 0;
|
||||
virtual Statement * setResultSetType(sql::ResultSet::enum_type type) = 0;
|
||||
};
|
||||
|
||||
} /* namespace sql */
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -43,26 +51,26 @@ class SQLWarning
|
|||
{
|
||||
public:
|
||||
|
||||
SQLWarning(){}
|
||||
SQLWarning(){}
|
||||
|
||||
virtual const sql::SQLString & getMessage() const = 0;
|
||||
virtual const sql::SQLString & getMessage() const = 0;
|
||||
|
||||
virtual const sql::SQLString & getSQLState() const = 0;
|
||||
virtual const sql::SQLString & getSQLState() const = 0;
|
||||
|
||||
virtual int getErrorCode() const = 0;
|
||||
virtual int getErrorCode() const = 0;
|
||||
|
||||
virtual const SQLWarning * getNextWarning() const = 0;
|
||||
virtual const SQLWarning * getNextWarning() const = 0;
|
||||
|
||||
virtual void setNextWarning(const SQLWarning * _next) = 0;
|
||||
virtual void setNextWarning(const SQLWarning * _next) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~SQLWarning(){};
|
||||
virtual ~SQLWarning(){};
|
||||
|
||||
SQLWarning(const SQLWarning& e){};
|
||||
SQLWarning(const SQLWarning&){};
|
||||
|
||||
private:
|
||||
const SQLWarning & operator = (const SQLWarning & rhs);
|
||||
const SQLWarning & operator = (const SQLWarning & rhs);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -46,19 +46,6 @@
|
|||
#include "httpdef.h"
|
||||
#include "http_content.h"
|
||||
|
||||
namespace hv {
|
||||
|
||||
struct NetAddr {
|
||||
std::string ip;
|
||||
int port;
|
||||
|
||||
std::string ipport() {
|
||||
return hv::asprintf("%s:%d", ip.c_str(), port);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
|
||||
// Cookie: sessionid=1; domain=.example.com; path=/; max-age=86400; secure; httponly
|
||||
struct HV_EXPORT HttpCookie {
|
||||
|
@ -297,6 +284,7 @@ public:
|
|||
void* Content() {
|
||||
if (content == NULL && body.size() != 0) {
|
||||
content = (void*)body.data();
|
||||
content_length = body.size();
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
|
|
@ -72,11 +72,9 @@ int main() {
|
|||
return 200;
|
||||
});
|
||||
|
||||
HttpServer server;
|
||||
server.registerHttpService(&service);
|
||||
server.setPort(8080);
|
||||
HttpServer server(&service);
|
||||
server.setThreadNum(4);
|
||||
server.run();
|
||||
server.run(":8080");
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
@ -130,12 +128,20 @@ public:
|
|||
return setSslCtx(ssl_ctx);
|
||||
}
|
||||
|
||||
int run(bool wait = true) {
|
||||
// run(":8080")
|
||||
// run("0.0.0.0:8080")
|
||||
// run("[::]:8080")
|
||||
int run(const char* ip_port = NULL, bool wait = true) {
|
||||
if (ip_port) {
|
||||
hv::NetAddr listen_addr(ip_port);
|
||||
if (listen_addr.ip.size() != 0) setHost(listen_addr.ip.c_str());
|
||||
if (listen_addr.port != 0) setPort(listen_addr.port);
|
||||
}
|
||||
return http_server_run(this, wait);
|
||||
}
|
||||
|
||||
int start() {
|
||||
return run(false);
|
||||
int start(const char* ip_port = NULL) {
|
||||
return run(ip_port, false);
|
||||
}
|
||||
|
||||
int stop() {
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
if (ret != 0) {
|
||||
perror("bind");
|
||||
}
|
||||
hio_set_localaddr(channel->io(), &local_addr.sa, SOCKADDR_LEN(&local_addr));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_STDATOMIC_H
|
||||
#define HAVE_STDATOMIC_H 1
|
||||
#define HAVE_STDATOMIC_H 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SYS_TYPES_H
|
||||
|
@ -22,7 +22,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_SYS_TIME_H
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#define HAVE_SYS_TIME_H 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FCNTL_H
|
||||
|
@ -30,11 +30,11 @@
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_PTHREAD_H
|
||||
#define HAVE_PTHREAD_H 1
|
||||
#define HAVE_PTHREAD_H 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ENDIAN_H
|
||||
#define HAVE_ENDIAN_H 1
|
||||
#define HAVE_ENDIAN_H 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SYS_ENDIAN_H
|
||||
|
@ -54,46 +54,49 @@
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_CLOCK_GETTIME
|
||||
#define HAVE_CLOCK_GETTIME 1
|
||||
#define HAVE_CLOCK_GETTIME 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define HAVE_GETTIMEOFDAY 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PTHREAD_SPIN_LOCK
|
||||
#define HAVE_PTHREAD_SPIN_LOCK 1
|
||||
#define HAVE_PTHREAD_SPIN_LOCK 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
||||
#define HAVE_PTHREAD_MUTEX_TIMEDLOCK 1
|
||||
#define HAVE_PTHREAD_MUTEX_TIMEDLOCK 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SEM_TIMEDWAIT
|
||||
#define HAVE_SEM_TIMEDWAIT 1
|
||||
#define HAVE_SEM_TIMEDWAIT 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PIPE
|
||||
#define HAVE_PIPE 1
|
||||
#define HAVE_PIPE 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKETPAIR
|
||||
#define HAVE_SOCKETPAIR 1
|
||||
#define HAVE_SOCKETPAIR 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_EVENTFD
|
||||
#define HAVE_EVENTFD 1
|
||||
#define HAVE_EVENTFD 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SETPROCTITLE
|
||||
#define HAVE_SETPROCTITLE 0
|
||||
#endif
|
||||
|
||||
/* #undef WITH_OPENSSL */
|
||||
#define WITH_OPENSSL 1
|
||||
/* #undef WITH_GNUTLS */
|
||||
/* #undef WITH_MBEDTLS */
|
||||
|
||||
/* #undef ENABLE_UDS */
|
||||
/* #undef USE_MULTIMAP */
|
||||
|
||||
#define WITH_WEPOLL 1
|
||||
/* #undef WITH_KCP */
|
||||
|
||||
#endif // HV_CONFIG_H_
|
||||
|
|
|
@ -31,7 +31,8 @@ typedef void (*hclose_cb) (hio_t* io);
|
|||
typedef enum {
|
||||
HLOOP_STATUS_STOP,
|
||||
HLOOP_STATUS_RUNNING,
|
||||
HLOOP_STATUS_PAUSE
|
||||
HLOOP_STATUS_PAUSE,
|
||||
HLOOP_STATUS_DESTROY
|
||||
} hloop_status_e;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -75,6 +75,18 @@ HV_EXPORT std::string trim_pairs(const std::string& str, const char* pairs = PAI
|
|||
HV_EXPORT std::string replace(const std::string& str, const std::string& find, const std::string& rep);
|
||||
HV_EXPORT std::string replaceAll(const std::string& str, const std::string& find, const std::string& rep);
|
||||
|
||||
struct HV_EXPORT NetAddr {
|
||||
std::string ip;
|
||||
int port;
|
||||
|
||||
NetAddr() : port(0) {}
|
||||
NetAddr(const std::string& _ip, int _port) : ip(_ip), port(_port) {}
|
||||
NetAddr(const std::string& ipport) { from_string(ipport); }
|
||||
|
||||
void from_string(const std::string& ipport);
|
||||
std::string to_string();
|
||||
};
|
||||
|
||||
} // end namespace hv
|
||||
|
||||
#endif // HV_STRING_H_
|
||||
|
|
|
@ -29,6 +29,7 @@ struct mqtt_client_s {
|
|||
unsigned char alloced_ssl_ctx: 1; // intern
|
||||
unsigned char connected : 1;
|
||||
unsigned short keepalive;
|
||||
int ping_cnt;
|
||||
char client_id[64];
|
||||
// will
|
||||
mqtt_message_t* will;
|
||||
|
@ -125,4 +126,210 @@ HV_EXPORT int mqtt_client_unsubscribe(mqtt_client_t* cli,
|
|||
|
||||
END_EXTERN_C
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace hv {
|
||||
|
||||
// @usage examples/mqtt/mqtt_client_test.cpp
|
||||
class MqttClient {
|
||||
public:
|
||||
mqtt_client_t* client;
|
||||
// callbacks
|
||||
typedef std::function<void(MqttClient*)> MqttCallback;
|
||||
typedef std::function<void(MqttClient*, mqtt_message_t*)> MqttMessageCallback;
|
||||
MqttCallback onConnect;
|
||||
MqttCallback onClose;
|
||||
MqttMessageCallback onMessage;
|
||||
|
||||
MqttClient(hloop_t* loop = NULL) {
|
||||
client = mqtt_client_new(loop);
|
||||
}
|
||||
|
||||
~MqttClient() {
|
||||
if (client) {
|
||||
mqtt_client_free(client);
|
||||
client = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void run() {
|
||||
mqtt_client_set_callback(client, on_mqtt);
|
||||
mqtt_client_set_userdata(client, this);
|
||||
mqtt_client_run(client);
|
||||
}
|
||||
|
||||
void stop() {
|
||||
mqtt_client_stop(client);
|
||||
}
|
||||
|
||||
void setID(const char* id) {
|
||||
mqtt_client_set_id(client, id);
|
||||
}
|
||||
|
||||
void setWill(mqtt_message_t* will) {
|
||||
mqtt_client_set_will(client, will);
|
||||
}
|
||||
|
||||
void setAuth(const char* username, const char* password) {
|
||||
mqtt_client_set_auth(client, username, password);
|
||||
}
|
||||
|
||||
void setPingInterval(int sec) {
|
||||
client->keepalive = sec;
|
||||
}
|
||||
|
||||
int lastError() {
|
||||
return mqtt_client_get_last_error(client);
|
||||
}
|
||||
|
||||
// SSL/TLS
|
||||
int setSslCtx(hssl_ctx_t ssl_ctx) {
|
||||
return mqtt_client_set_ssl_ctx(client, ssl_ctx);
|
||||
}
|
||||
int newSslCtx(hssl_ctx_opt_t* opt) {
|
||||
return mqtt_client_new_ssl_ctx(client, opt);
|
||||
}
|
||||
|
||||
void setReconnect(reconn_setting_t* reconn) {
|
||||
mqtt_client_set_reconnect(client, reconn);
|
||||
}
|
||||
|
||||
void setConnectTimeout(int ms) {
|
||||
mqtt_client_set_connect_timeout(client, ms);
|
||||
}
|
||||
|
||||
int connect(const char* host, int port = DEFAULT_MQTT_PORT, int ssl = 0) {
|
||||
return mqtt_client_connect(client, host, port, ssl);
|
||||
}
|
||||
|
||||
int reconnect() {
|
||||
return mqtt_client_reconnect(client);
|
||||
}
|
||||
|
||||
int disconnect() {
|
||||
return mqtt_client_disconnect(client);
|
||||
}
|
||||
|
||||
bool isConnected() {
|
||||
return mqtt_client_is_connected(client);
|
||||
}
|
||||
|
||||
int publish(mqtt_message_t* msg, MqttCallback ack_cb = NULL) {
|
||||
int mid = mqtt_client_publish(client, msg);
|
||||
if (msg->qos > 0 && mid >= 0 && ack_cb) {
|
||||
setAckCallback(mid, ack_cb);
|
||||
}
|
||||
return mid;
|
||||
}
|
||||
|
||||
int publish(const std::string& topic, const std::string& payload, int qos = 0, int retain = 0, MqttCallback ack_cb = NULL) {
|
||||
mqtt_message_t msg;
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.topic_len = topic.size();
|
||||
msg.topic = topic.c_str();
|
||||
msg.payload_len = payload.size();
|
||||
msg.payload = payload.c_str();
|
||||
msg.qos = qos;
|
||||
msg.retain = retain;
|
||||
return publish(&msg, ack_cb);
|
||||
}
|
||||
|
||||
int subscribe(const char* topic, int qos = 0, MqttCallback ack_cb = NULL) {
|
||||
int mid = mqtt_client_subscribe(client, topic, qos);
|
||||
if (qos > 0 && mid >= 0 && ack_cb) {
|
||||
setAckCallback(mid, ack_cb);
|
||||
}
|
||||
return mid;
|
||||
}
|
||||
|
||||
int unsubscribe(const char* topic, MqttCallback ack_cb = NULL) {
|
||||
int mid = mqtt_client_unsubscribe(client, topic);
|
||||
if (mid >= 0 && ack_cb) {
|
||||
setAckCallback(mid, ack_cb);
|
||||
}
|
||||
return mid;
|
||||
}
|
||||
|
||||
protected:
|
||||
void setAckCallback(int mid, MqttCallback cb) {
|
||||
ack_cbs_mutex.lock();
|
||||
ack_cbs[mid] = std::move(cb);
|
||||
ack_cbs_mutex.unlock();
|
||||
}
|
||||
|
||||
void invokeAckCallback(int mid) {
|
||||
MqttCallback ack_cb = NULL;
|
||||
ack_cbs_mutex.lock();
|
||||
auto iter = ack_cbs.find(mid);
|
||||
if (iter != ack_cbs.end()) {
|
||||
ack_cb = std::move(iter->second);
|
||||
ack_cbs.erase(iter);
|
||||
}
|
||||
ack_cbs_mutex.unlock();
|
||||
if (ack_cb) ack_cb(this);
|
||||
}
|
||||
|
||||
static void on_mqtt(mqtt_client_t* cli, int type) {
|
||||
MqttClient* client = (MqttClient*)mqtt_client_get_userdata(cli);
|
||||
// printf("on_mqtt type=%d\n", type);
|
||||
switch(type) {
|
||||
case MQTT_TYPE_CONNECT:
|
||||
// printf("mqtt connected!\n");
|
||||
break;
|
||||
case MQTT_TYPE_DISCONNECT:
|
||||
// printf("mqtt disconnected!\n");
|
||||
if (client->onClose) {
|
||||
client->onClose(client);
|
||||
}
|
||||
break;
|
||||
case MQTT_TYPE_CONNACK:
|
||||
// printf("mqtt connack!\n");
|
||||
if (client->onConnect) {
|
||||
client->onConnect(client);
|
||||
}
|
||||
break;
|
||||
case MQTT_TYPE_PUBLISH:
|
||||
if (client->onMessage) {
|
||||
client->onMessage(client, &cli->message);
|
||||
}
|
||||
break;
|
||||
case MQTT_TYPE_PUBACK: /* qos = 1 */
|
||||
// printf("mqtt puback mid=%d\n", cli->mid);
|
||||
client->invokeAckCallback(cli->mid);
|
||||
break;
|
||||
case MQTT_TYPE_PUBREC: /* qos = 2 */
|
||||
// printf("mqtt pubrec mid=%d\n", cli->mid);
|
||||
// wait MQTT_TYPE_PUBCOMP
|
||||
break;
|
||||
case MQTT_TYPE_PUBCOMP: /* qos = 2 */
|
||||
// printf("mqtt pubcomp mid=%d\n", cli->mid);
|
||||
client->invokeAckCallback(cli->mid);
|
||||
break;
|
||||
case MQTT_TYPE_SUBACK:
|
||||
// printf("mqtt suback mid=%d\n", cli->mid);
|
||||
client->invokeAckCallback(cli->mid);
|
||||
break;
|
||||
case MQTT_TYPE_UNSUBACK:
|
||||
// printf("mqtt unsuback mid=%d\n", cli->mid);
|
||||
client->invokeAckCallback(cli->mid);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// mid => ack callback
|
||||
std::map<int, MqttCallback> ack_cbs;
|
||||
std::mutex ack_cbs_mutex;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // HV_MQTT_CLIENT_H_
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define _LIBICONV_H
|
||||
|
||||
#define _LIBICONV_VERSION 0x0111 /* version number: (major<<8) + minor */
|
||||
extern int _libiconv_version; /* Likewise */
|
||||
extern __declspec (dllimport) int _libiconv_version; /* Likewise */
|
||||
|
||||
/* We would like to #include any system header file which could define
|
||||
iconv_t, 1. in order to eliminate the risk that the user gets compilation
|
||||
|
|
|
@ -2,22 +2,33 @@
|
|||
This file is part of the GNU CHARSET Library.
|
||||
|
||||
The GNU CHARSET Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public License as
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU CHARSET Library 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
|
||||
Lesser General Public License for more details.
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with the GNU CHARSET Library; see the file COPYING.LIB. If not,
|
||||
see <https://www.gnu.org/licenses/>. */
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LIBCHARSET_H
|
||||
#define _LIBCHARSET_H
|
||||
|
||||
#ifdef LIBCHARSET_STATIC
|
||||
#define LIBCHARSET_DLL_EXPORTED
|
||||
#else /* LIBCHARSET_STATIC */
|
||||
#ifdef BUILDING_LIBCHARSET
|
||||
#define LIBCHARSET_DLL_EXPORTED __declspec(dllexport)
|
||||
#else
|
||||
#define LIBCHARSET_DLL_EXPORTED __declspec(dllimport)
|
||||
#endif
|
||||
#endif /* LIBCHARSET_STATIC */
|
||||
|
||||
#include <localcharset.h>
|
||||
|
||||
|
||||
|
@ -33,8 +44,8 @@ extern "C" {
|
|||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
extern void libcharset_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
extern LIBCHARSET_DLL_EXPORTED void libcharset_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,23 +1,34 @@
|
|||
/* Determine a canonical name for the current locale's character encoding.
|
||||
Copyright (C) 2000-2003, 2009-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU CHARSET Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _LOCALCHARSET_H
|
||||
#define _LOCALCHARSET_H
|
||||
|
||||
#ifdef LIBCHARSET_STATIC
|
||||
#define LIBCHARSET_DLL_EXPORTED
|
||||
#else /* LIBCHARSET_STATIC */
|
||||
#ifdef BUILDING_LIBCHARSET
|
||||
#define LIBCHARSET_DLL_EXPORTED __declspec(dllexport)
|
||||
#else
|
||||
#define LIBCHARSET_DLL_EXPORTED __declspec(dllimport)
|
||||
#endif
|
||||
#endif /* LIBCHARSET_STATIC */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -25,108 +36,11 @@ extern "C" {
|
|||
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed below.
|
||||
The result must not be freed; it is statically allocated. The result
|
||||
becomes invalid when setlocale() is used to change the global locale, or
|
||||
when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
|
||||
is changed; threads in multithreaded programs should not do this.
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
extern const char * locale_charset (void);
|
||||
|
||||
/* About GNU canonical names for character encodings:
|
||||
|
||||
Every canonical name must be supported by GNU libiconv. Support by GNU libc
|
||||
is also desirable.
|
||||
|
||||
The name is case insensitive. Usually an upper case MIME charset name is
|
||||
preferred.
|
||||
|
||||
The current list of these GNU canonical names is:
|
||||
|
||||
name MIME? used by which systems
|
||||
(darwin = Mac OS X, windows = native Windows)
|
||||
|
||||
ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin
|
||||
ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-3 Y glibc solaris cygwin
|
||||
ISO-8859-4 Y hpux osf solaris freebsd netbsd openbsd darwin
|
||||
ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-6 Y glibc aix hpux solaris cygwin
|
||||
ISO-8859-7 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-8 Y glibc aix hpux osf solaris cygwin zos
|
||||
ISO-8859-9 Y glibc aix hpux irix osf solaris freebsd darwin cygwin zos
|
||||
ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin
|
||||
ISO-8859-14 glibc cygwin
|
||||
ISO-8859-15 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin
|
||||
KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin
|
||||
KOI8-T glibc
|
||||
CP437 dos
|
||||
CP775 dos
|
||||
CP850 aix osf dos
|
||||
CP852 dos
|
||||
CP855 dos
|
||||
CP856 aix
|
||||
CP857 dos
|
||||
CP861 dos
|
||||
CP862 dos
|
||||
CP864 dos
|
||||
CP865 dos
|
||||
CP866 freebsd netbsd openbsd darwin dos
|
||||
CP869 dos
|
||||
CP874 windows dos
|
||||
CP922 aix
|
||||
CP932 aix cygwin windows dos
|
||||
CP943 aix zos
|
||||
CP949 osf darwin windows dos
|
||||
CP950 windows dos
|
||||
CP1046 aix
|
||||
CP1124 aix
|
||||
CP1125 dos
|
||||
CP1129 aix
|
||||
CP1131 freebsd darwin
|
||||
CP1250 windows
|
||||
CP1251 glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows
|
||||
CP1252 aix windows
|
||||
CP1253 windows
|
||||
CP1254 windows
|
||||
CP1255 glibc windows
|
||||
CP1256 windows
|
||||
CP1257 windows
|
||||
GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin cygwin zos
|
||||
EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
|
||||
EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin zos
|
||||
EUC-TW glibc aix hpux irix osf solaris netbsd
|
||||
BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin zos
|
||||
BIG5-HKSCS glibc hpux solaris netbsd darwin
|
||||
GBK glibc aix osf solaris freebsd darwin cygwin windows dos
|
||||
GB18030 glibc hpux solaris freebsd netbsd darwin
|
||||
SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
|
||||
JOHAB glibc solaris windows
|
||||
TIS-620 glibc aix hpux osf solaris cygwin zos
|
||||
VISCII Y glibc
|
||||
TCVN5712-1 glibc
|
||||
ARMSCII-8 glibc freebsd netbsd darwin
|
||||
GEORGIAN-PS glibc cygwin
|
||||
PT154 glibc netbsd cygwin
|
||||
HP-ROMAN8 hpux
|
||||
HP-ARABIC8 hpux
|
||||
HP-GREEK8 hpux
|
||||
HP-HEBREW8 hpux
|
||||
HP-TURKISH8 hpux
|
||||
HP-KANA8 hpux
|
||||
DEC-KANJI osf
|
||||
DEC-HANYU osf
|
||||
UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin zos
|
||||
|
||||
Note: Names which are not marked as being a MIME name should not be used in
|
||||
Internet protocols for information interchange (mail, news, etc.).
|
||||
|
||||
Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
must understand both names and treat them as equivalent.
|
||||
*/
|
||||
extern LIBCHARSET_DLL_EXPORTED const char * locale_charset (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,32 +1,41 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -35,25 +44,26 @@ namespace mysql
|
|||
|
||||
class MySQL_Savepoint : public sql::Savepoint
|
||||
{
|
||||
sql::SQLString name;
|
||||
sql::SQLString name;
|
||||
|
||||
public:
|
||||
MySQL_Savepoint(const sql::SQLString &savepoint);
|
||||
virtual ~MySQL_Savepoint() {}
|
||||
MySQL_Savepoint(const sql::SQLString &savepoint);
|
||||
virtual ~MySQL_Savepoint() {}
|
||||
|
||||
int getSavepointId();
|
||||
int getSavepointId();
|
||||
|
||||
sql::SQLString getSavepointName();
|
||||
sql::SQLString getSavepointName();
|
||||
|
||||
private:
|
||||
/* Prevent use of these */
|
||||
MySQL_Savepoint(const MySQL_Savepoint &);
|
||||
void operator=(MySQL_Savepoint &);
|
||||
/* Prevent use of these */
|
||||
MySQL_Savepoint(const MySQL_Savepoint &);
|
||||
void operator=(MySQL_Savepoint &);
|
||||
};
|
||||
|
||||
|
||||
class MySQL_DebugLogger;
|
||||
class MySQL_ConnectionData; /* PIMPL */
|
||||
struct MySQL_ConnectionData; /* PIMPL */
|
||||
class MySQL_Statement;
|
||||
|
||||
namespace NativeAPI
|
||||
{
|
||||
|
@ -62,105 +72,123 @@ 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,
|
||||
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);
|
||||
MySQL_Connection(Driver * _driver, ::sql::mysql::NativeAPI::NativeConnectionWrapper & _proxy,
|
||||
std::map< sql::SQLString, sql::ConnectPropertyVal > & options);
|
||||
|
||||
virtual ~MySQL_Connection();
|
||||
virtual ~MySQL_Connection();
|
||||
|
||||
void clearWarnings();
|
||||
void clearWarnings();
|
||||
|
||||
void close();
|
||||
void close();
|
||||
|
||||
void commit();
|
||||
void commit();
|
||||
|
||||
sql::Statement * createStatement();
|
||||
sql::Statement * createStatement();
|
||||
|
||||
sql::SQLString escapeString(const sql::SQLString &);
|
||||
sql::SQLString escapeString(const sql::SQLString &);
|
||||
|
||||
bool getAutoCommit();
|
||||
bool getAutoCommit();
|
||||
|
||||
sql::SQLString getCatalog();
|
||||
sql::SQLString getCatalog();
|
||||
|
||||
Driver *getDriver();
|
||||
Driver *getDriver();
|
||||
|
||||
sql::SQLString getSchema();
|
||||
sql::SQLString getSchema();
|
||||
|
||||
sql::SQLString getClientInfo();
|
||||
sql::SQLString getClientInfo();
|
||||
|
||||
void getClientOption(const sql::SQLString & optionName, void * optionValue);
|
||||
void getClientOption(const sql::SQLString & optionName, void * optionValue);
|
||||
|
||||
sql::DatabaseMetaData * getMetaData();
|
||||
sql::SQLString getClientOption(const sql::SQLString & optionName);
|
||||
|
||||
enum_transaction_isolation getTransactionIsolation();
|
||||
sql::DatabaseMetaData * getMetaData();
|
||||
|
||||
const SQLWarning * getWarnings();
|
||||
enum_transaction_isolation getTransactionIsolation();
|
||||
|
||||
bool isClosed();
|
||||
const SQLWarning * getWarnings();
|
||||
|
||||
bool isReadOnly();
|
||||
bool isClosed();
|
||||
|
||||
sql::SQLString nativeSQL(const sql::SQLString& sql);
|
||||
bool isReadOnly();
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql);
|
||||
bool isValid();
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys);
|
||||
bool reconnect();
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int columnIndexes[]);
|
||||
sql::SQLString nativeSQL(const sql::SQLString& sql);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency);
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability);
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys);
|
||||
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]);
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int columnIndexes[]);
|
||||
|
||||
void releaseSavepoint(Savepoint * savepoint) ;
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency);
|
||||
|
||||
void rollback();
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability);
|
||||
|
||||
void rollback(Savepoint * savepoint);
|
||||
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]);
|
||||
|
||||
void setAutoCommit(bool autoCommit);
|
||||
void releaseSavepoint(Savepoint * savepoint) ;
|
||||
|
||||
void setCatalog(const sql::SQLString& catalog);
|
||||
void rollback();
|
||||
|
||||
void setSchema(const sql::SQLString& catalog);
|
||||
void rollback(Savepoint * savepoint);
|
||||
|
||||
sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue);
|
||||
void setAutoCommit(bool autoCommit);
|
||||
|
||||
void setHoldability(int holdability);
|
||||
void setCatalog(const sql::SQLString& catalog);
|
||||
|
||||
void setReadOnly(bool readOnly);
|
||||
void setSchema(const sql::SQLString& catalog);
|
||||
|
||||
sql::Savepoint * setSavepoint();
|
||||
sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue);
|
||||
|
||||
sql::Savepoint * setSavepoint(const sql::SQLString& name);
|
||||
sql::Connection * setClientOption(const sql::SQLString & optionName, const sql::SQLString & optionValue);
|
||||
|
||||
void setTransactionIsolation(enum_transaction_isolation level);
|
||||
void setHoldability(int holdability);
|
||||
|
||||
sql::SQLString getSessionVariable(const sql::SQLString & varname);
|
||||
void setReadOnly(bool readOnly);
|
||||
|
||||
void setSessionVariable(const sql::SQLString & varname, const sql::SQLString & value);
|
||||
sql::Savepoint * setSavepoint();
|
||||
|
||||
protected:
|
||||
void checkClosed();
|
||||
void init(std::map< sql::SQLString, sql::ConnectPropertyVal > & properties);
|
||||
sql::Savepoint * setSavepoint(const sql::SQLString& name);
|
||||
|
||||
Driver * driver;
|
||||
boost::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
|
||||
void setTransactionIsolation(enum_transaction_isolation level);
|
||||
|
||||
MySQL_ConnectionData * intern; /* pimpl */
|
||||
virtual sql::SQLString getSessionVariable(const sql::SQLString & varname);
|
||||
|
||||
virtual void setSessionVariable(const sql::SQLString & varname, const sql::SQLString & value);
|
||||
|
||||
virtual void setSessionVariable(const sql::SQLString & varname, unsigned int value);
|
||||
|
||||
virtual sql::SQLString getLastStatementInfo();
|
||||
|
||||
private:
|
||||
/* Prevent use of these */
|
||||
MySQL_Connection(const MySQL_Connection &);
|
||||
void operator=(MySQL_Connection &);
|
||||
/* 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;
|
||||
|
||||
boost::scoped_ptr< ::sql::mysql::MySQL_ConnectionData > intern; /* pimpl */
|
||||
|
||||
/* Prevent use of these */
|
||||
MySQL_Connection(const MySQL_Connection &);
|
||||
void operator=(MySQL_Connection &);
|
||||
};
|
||||
|
||||
} /* namespace mysql */
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2.0, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is also distributed with certain software (including
|
||||
* but not limited to OpenSSL) that is licensed under separate terms,
|
||||
* as designated in a particular file or component or in included license
|
||||
* documentation. The authors of MySQL hereby grant you an
|
||||
* additional permission to link the program and your derivative works
|
||||
* with the separately licensed software that they have included with
|
||||
* MySQL.
|
||||
*
|
||||
* Without limiting anything contained in the foregoing, this file,
|
||||
* which is part of MySQL Connector/C++, is also subject to the
|
||||
* Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
* http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
*
|
||||
* 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, version 2.0, 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
|
||||
*/
|
||||
|
||||
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_
|
||||
|
@ -40,41 +48,41 @@ namespace mysql
|
|||
{
|
||||
namespace NativeAPI
|
||||
{
|
||||
class NativeDriverWrapper;
|
||||
class NativeDriverWrapper;
|
||||
}
|
||||
|
||||
//class sql::mysql::NativeAPI::NativeDriverWrapper;
|
||||
|
||||
class CPPCONN_PUBLIC_FUNC MySQL_Driver : public sql::Driver
|
||||
{
|
||||
boost::scoped_ptr< ::sql::mysql::NativeAPI::NativeDriverWrapper > proxy;
|
||||
boost::scoped_ptr< ::sql::mysql::NativeAPI::NativeDriverWrapper > proxy;
|
||||
|
||||
public:
|
||||
MySQL_Driver();
|
||||
MySQL_Driver(const ::sql::SQLString & clientLib);
|
||||
MySQL_Driver();
|
||||
MySQL_Driver(const ::sql::SQLString & clientLib);
|
||||
|
||||
virtual ~MySQL_Driver();
|
||||
virtual ~MySQL_Driver();
|
||||
|
||||
sql::Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password);
|
||||
sql::Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password);
|
||||
|
||||
sql::Connection * connect(sql::ConnectOptionsMap & options);
|
||||
sql::Connection * connect(sql::ConnectOptionsMap & options);
|
||||
|
||||
int getMajorVersion();
|
||||
int getMajorVersion();
|
||||
|
||||
int getMinorVersion();
|
||||
int getMinorVersion();
|
||||
|
||||
int getPatchVersion();
|
||||
int getPatchVersion();
|
||||
|
||||
const sql::SQLString & getName();
|
||||
const sql::SQLString & getName();
|
||||
|
||||
void threadInit();
|
||||
void threadInit();
|
||||
|
||||
void threadEnd();
|
||||
void threadEnd();
|
||||
|
||||
private:
|
||||
/* Prevent use of these */
|
||||
MySQL_Driver(const MySQL_Driver &);
|
||||
void operator=(MySQL_Driver &);
|
||||
/* 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
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
/* #undef Z_PREFIX */
|
||||
/* #undef Z_HAVE_UNISTD_H */
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
|
@ -433,11 +435,11 @@ typedef uLong FAR uLongf;
|
|||
typedef unsigned long z_crc_t;
|
||||
#endif
|
||||
|
||||
#if 1 /* was set to #if 1 by ./configure */
|
||||
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#if 1 /* was set to #if 1 by ./configure */
|
||||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_STDARG_H
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue