Skip to content

Commit 41ed4b1

Browse files
khanakiakhanakia
khanakia
authored and
khanakia
committed
Git created
0 parents  commit 41ed4b1

25 files changed

+2833
-0
lines changed

cppconn/build_config.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
3+
4+
The MySQL Connector/C++ is licensed under the terms of the GPLv2
5+
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
6+
MySQL Connectors. There are special exceptions to the terms and
7+
conditions of the GPLv2 as it is applied to this software, see the
8+
FLOSS License Exception
9+
<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10+
11+
This program is free software; you can redistribute it and/or modify
12+
it under the terms of the GNU General Public License as published
13+
by the Free Software Foundation; version 2 of the License.
14+
15+
This program is distributed in the hope that it will be useful, but
16+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18+
for more details.
19+
20+
You should have received a copy of the GNU General Public License along
21+
with this program; if not, write to the Free Software Foundation, Inc.,
22+
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23+
*/
24+
25+
26+
27+
#ifndef _SQL_BUILD_CONFIG_H_
28+
#define _SQL_BUILD_CONFIG_H_
29+
30+
#ifndef CPPCONN_PUBLIC_FUNC
31+
32+
#if defined(_WIN32)
33+
// mysqlcppconn_EXPORTS is added by cmake and defined for dynamic lib build only
34+
#ifdef mysqlcppconn_EXPORTS
35+
#define CPPCONN_PUBLIC_FUNC __declspec(dllexport)
36+
#else
37+
// this is for static build
38+
#ifdef CPPCONN_LIB_BUILD
39+
#define CPPCONN_PUBLIC_FUNC
40+
#else
41+
// this is for clients using dynamic lib
42+
#define CPPCONN_PUBLIC_FUNC __declspec(dllimport)
43+
#endif
44+
#endif
45+
#else
46+
#define CPPCONN_PUBLIC_FUNC
47+
#endif
48+
49+
#endif //#ifndef CPPCONN_PUBLIC_FUNC
50+
51+
#endif //#ifndef _SQL_BUILD_CONFIG_H_

cppconn/config.h

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
3+
4+
The MySQL Connector/C++ is licensed under the terms of the GPLv2
5+
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
6+
MySQL Connectors. There are special exceptions to the terms and
7+
conditions of the GPL as it is applied to this software, see the
8+
FLOSS License Exception
9+
<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10+
11+
This program is free software; you can redistribute it and/or modify
12+
it under the terms of the GNU General Public License as published
13+
by the Free Software Foundation; version 2 of the License.
14+
15+
This program is distributed in the hope that it will be useful, but
16+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18+
for more details.
19+
20+
You should have received a copy of the GNU General Public License along
21+
with this program; if not, write to the Free Software Foundation, Inc.,
22+
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23+
*/
24+
25+
// libmysql defines HAVE_STRTOUL (on win), so we have to follow different pattern in definitions names
26+
// to avoid annoying warnings.
27+
28+
#define HAVE_FUNCTION_STRTOLD 1
29+
#define HAVE_FUNCTION_STRTOLL 1
30+
#define HAVE_FUNCTION_STRTOL 1
31+
#define HAVE_FUNCTION_STRTOULL 1
32+
33+
#define HAVE_FUNCTION_STRTOUL 1
34+
35+
#define HAVE_FUNCTION_STRTOIMAX 1
36+
#define HAVE_FUNCTION_STRTOUMAX 1
37+
38+
#define HAVE_STDINT_H 1
39+
#define HAVE_INTTYPES_H 1
40+
41+
#define HAVE_INT8_T 1
42+
#define HAVE_UINT8_T 1
43+
#define HAVE_INT16_T 1
44+
#define HAVE_UINT16_T 1
45+
#define HAVE_INT32_T 1
46+
#define HAVE_UINT32_T 1
47+
#define HAVE_INT32_T 1
48+
#define HAVE_UINT32_T 1
49+
#define HAVE_INT64_T 1
50+
#define HAVE_UINT64_T 1
51+
/* #undef HAVE_MS_INT8 */
52+
/* #undef HAVE_MS_UINT8 */
53+
/* #undef HAVE_MS_INT16 */
54+
/* #undef HAVE_MS_UINT16 */
55+
/* #undef HAVE_MS_INT32 */
56+
/* #undef HAVE_MS_UINT32 */
57+
/* #undef HAVE_MS_INT64 */
58+
/* #undef HAVE_MS_UINT64 */
59+
60+
61+
#ifdef HAVE_STDINT_H
62+
#include <stdint.h>
63+
#endif
64+
65+
66+
#if defined(HAVE_INTTYPES_H) && !defined(_WIN32)
67+
#include <inttypes.h>
68+
#endif
69+
70+
#if defined(_WIN32)
71+
#ifndef CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES
72+
73+
#if _MSC_VER >= 1600
74+
75+
#include <stdint.h>
76+
77+
#else
78+
79+
#if !defined(HAVE_INT8_T) && defined(HAVE_MS_INT8)
80+
typedef __int8 int8_t;
81+
#endif
82+
83+
#ifdef HAVE_MS_UINT8
84+
typedef unsigned __int8 uint8_t;
85+
#endif
86+
#ifdef HAVE_MS_INT16
87+
typedef __int16 int16_t;
88+
#endif
89+
90+
#ifdef HAVE_MS_UINT16
91+
typedef unsigned __int16 uint16_t;
92+
#endif
93+
94+
#ifdef HAVE_MS_INT32
95+
typedef __int32 int32_t;
96+
#endif
97+
98+
#ifdef HAVE_MS_UINT32
99+
typedef unsigned __int32 uint32_t;
100+
#endif
101+
102+
#ifdef HAVE_MS_INT64
103+
typedef __int64 int64_t;
104+
#endif
105+
#ifdef HAVE_MS_UINT64
106+
typedef unsigned __int64 uint64_t;
107+
#endif
108+
109+
#endif // _MSC_VER >= 1600
110+
#endif // CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES
111+
#endif // _WIN32

cppconn/connection.h

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*
2+
Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
3+
4+
The MySQL Connector/C++ is licensed under the terms of the GPLv2
5+
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
6+
MySQL Connectors. There are special exceptions to the terms and
7+
conditions of the GPLv2 as it is applied to this software, see the
8+
FLOSS License Exception
9+
<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10+
11+
This program is free software; you can redistribute it and/or modify
12+
it under the terms of the GNU General Public License as published
13+
by the Free Software Foundation; version 2 of the License.
14+
15+
This program is distributed in the hope that it will be useful, but
16+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18+
for more details.
19+
20+
You should have received a copy of the GNU General Public License along
21+
with this program; if not, write to the Free Software Foundation, Inc.,
22+
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23+
*/
24+
25+
26+
27+
#ifndef _SQL_CONNECTION_H_
28+
#define _SQL_CONNECTION_H_
29+
30+
#include <map>
31+
32+
#include "build_config.h"
33+
#include "warning.h"
34+
#include "sqlstring.h"
35+
#include "variant.h"
36+
37+
namespace sql
38+
{
39+
40+
typedef sql::Variant ConnectPropertyVal;
41+
42+
typedef std::map< sql::SQLString, ConnectPropertyVal > ConnectOptionsMap;
43+
44+
class DatabaseMetaData;
45+
class PreparedStatement;
46+
class Statement;
47+
class Driver;
48+
49+
typedef enum transaction_isolation
50+
{
51+
TRANSACTION_NONE= 0,
52+
TRANSACTION_READ_COMMITTED,
53+
TRANSACTION_READ_UNCOMMITTED,
54+
TRANSACTION_REPEATABLE_READ,
55+
TRANSACTION_SERIALIZABLE
56+
} enum_transaction_isolation;
57+
58+
enum ssl_mode
59+
{
60+
SSL_MODE_DISABLED= 1, SSL_MODE_PREFERRED, SSL_MODE_REQUIRED,
61+
SSL_MODE_VERIFY_CA, SSL_MODE_VERIFY_IDENTITY
62+
};
63+
64+
class Savepoint
65+
{
66+
/* Prevent use of these */
67+
Savepoint(const Savepoint &);
68+
void operator=(Savepoint &);
69+
public:
70+
Savepoint() {};
71+
virtual ~Savepoint() {};
72+
virtual int getSavepointId() = 0;
73+
74+
virtual sql::SQLString getSavepointName() = 0;
75+
};
76+
77+
78+
class CPPCONN_PUBLIC_FUNC Connection
79+
{
80+
/* Prevent use of these */
81+
Connection(const Connection &);
82+
void operator=(Connection &);
83+
public:
84+
85+
Connection() {};
86+
87+
virtual ~Connection() {};
88+
89+
virtual void clearWarnings() = 0;
90+
91+
virtual Statement *createStatement() = 0;
92+
93+
virtual void close() = 0;
94+
95+
virtual void commit() = 0;
96+
97+
virtual bool getAutoCommit() = 0;
98+
99+
virtual sql::SQLString getCatalog() = 0;
100+
101+
virtual Driver *getDriver() = 0;
102+
103+
virtual sql::SQLString getSchema() = 0;
104+
105+
virtual sql::SQLString getClientInfo() = 0;
106+
107+
virtual void getClientOption(const sql::SQLString & optionName, void * optionValue) = 0;
108+
109+
virtual sql::SQLString getClientOption(const sql::SQLString & optionName) = 0;
110+
111+
virtual DatabaseMetaData * getMetaData() = 0;
112+
113+
virtual enum_transaction_isolation getTransactionIsolation() = 0;
114+
115+
virtual const SQLWarning * getWarnings() = 0;
116+
117+
virtual bool isClosed() = 0;
118+
119+
virtual bool isReadOnly() = 0;
120+
121+
virtual bool isValid() = 0;
122+
123+
virtual bool reconnect() = 0;
124+
125+
virtual sql::SQLString nativeSQL(const sql::SQLString& sql) = 0;
126+
127+
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql) = 0;
128+
129+
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys) = 0;
130+
131+
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int* columnIndexes) = 0;
132+
133+
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency) = 0;
134+
135+
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) = 0;
136+
137+
virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, sql::SQLString columnNames[]) = 0;
138+
139+
virtual void releaseSavepoint(Savepoint * savepoint) = 0;
140+
141+
virtual void rollback() = 0;
142+
143+
virtual void rollback(Savepoint * savepoint) = 0;
144+
145+
virtual void setAutoCommit(bool autoCommit) = 0;
146+
147+
virtual void setCatalog(const sql::SQLString& catalog) = 0;
148+
149+
virtual void setSchema(const sql::SQLString& catalog) = 0;
150+
151+
virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const void * optionValue) = 0;
152+
153+
virtual sql::Connection * setClientOption(const sql::SQLString & optionName, const sql::SQLString & optionValue) = 0;
154+
155+
virtual void setHoldability(int holdability) = 0;
156+
157+
virtual void setReadOnly(bool readOnly) = 0;
158+
159+
virtual Savepoint * setSavepoint() = 0;
160+
161+
virtual Savepoint * setSavepoint(const sql::SQLString& name) = 0;
162+
163+
virtual void setTransactionIsolation(enum_transaction_isolation level) = 0;
164+
165+
/* virtual void setTypeMap(Map map) = 0; */
166+
};
167+
168+
} /* namespace sql */
169+
170+
#endif // _SQL_CONNECTION_H_

0 commit comments

Comments
 (0)