Shadowrun: Awakened 29 September 2011 - Build 871
mysql_connection.h
Go to the documentation of this file.
00001 /*
00002    Copyright 2007 - 2008 MySQL AB, 2008 - 2009 Sun Microsystems, Inc.  All rights reserved.
00003 
00004    The MySQL Connector/C++ is licensed under the terms of the GPL
00005    <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
00006    MySQL Connectors. There are special exceptions to the terms and
00007    conditions of the GPL as it is applied to this software, see the
00008    FLOSS License Exception
00009    <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
00010 */
00011 
00012 #ifndef _MYSQL_CONNECTION_H_
00013 #define _MYSQL_CONNECTION_H_
00014 
00015 #include <cppconn/connection.h>
00016 struct st_mysql;
00017 
00018 
00019 namespace sql
00020 {
00021 namespace mysql
00022 {
00023 
00024 class MySQL_Savepoint : public sql::Savepoint
00025 {
00026     std::string name;
00027 
00028 public:
00029     MySQL_Savepoint(const std::string &savepoint);
00030     virtual ~MySQL_Savepoint() {}
00031 
00032     int getSavepointId();
00033 
00034     std::string getSavepointName();
00035 
00036 private:
00037     /* Prevent use of these */
00038     MySQL_Savepoint(const MySQL_Savepoint &);
00039     void operator=(MySQL_Savepoint &);
00040 };
00041 
00042 
00043 class MySQL_DebugLogger;
00044 class MySQL_ConnectionData; /* PIMPL */
00045 
00046 class CPPCONN_PUBLIC_FUNC MySQL_Connection : public sql::Connection
00047 {
00048 public:
00049     MySQL_Connection(const std::string& hostName, const std::string& userName, const std::string& password);
00050 
00051     MySQL_Connection(std::map< std::string, sql::ConnectPropertyVal > & options);
00052 
00053     virtual ~MySQL_Connection();
00054 
00055     struct ::st_mysql * getMySQLHandle();
00056 
00057     void clearWarnings();
00058 
00059     void close();
00060 
00061     void commit();
00062 
00063     sql::Statement * createStatement();
00064 
00065     bool getAutoCommit();
00066 
00067     std::string getCatalog();
00068 
00069     std::string getSchema();
00070 
00071     std::string getClientInfo();
00072 
00073     void getClientOption(const std::string & optionName, void * optionValue);
00074 
00075     sql::DatabaseMetaData * getMetaData();
00076 
00077     enum_transaction_isolation getTransactionIsolation();
00078 
00079     const SQLWarning * getWarnings();
00080 
00081     bool isClosed();
00082 
00083     std::string nativeSQL(const std::string& sql);
00084 
00085     sql::PreparedStatement * prepareStatement(const std::string& sql);
00086 
00087     void releaseSavepoint(Savepoint * savepoint) ;
00088 
00089     void rollback();
00090 
00091     void rollback(Savepoint * savepoint);
00092 
00093     void setAutoCommit(bool autoCommit);
00094 
00095     void setCatalog(const std::string& catalog);
00096 
00097     void setSchema(const std::string& catalog);
00098 
00099     sql::Connection * setClientOption(const std::string & optionName, const void * optionValue);
00100 
00101     sql::Savepoint * setSavepoint(const std::string& name);
00102 
00103     void setTransactionIsolation(enum_transaction_isolation level);
00104 
00105     std::string getSessionVariable(const std::string & varname);
00106 
00107     void setSessionVariable(const std::string & varname, const std::string & value);
00108 
00109 protected:
00110     void checkClosed();
00111     void init(std::map<std::string, sql::ConnectPropertyVal> & properties);
00112 
00113     MySQL_ConnectionData * intern; /* pimpl */
00114 
00115 private:
00116     /* Prevent use of these */
00117     MySQL_Connection(const MySQL_Connection &);
00118     void operator=(MySQL_Connection &);
00119 };
00120 
00121 } /* namespace mysql */
00122 } /* namespace sql */
00123 
00124 #endif // _MYSQL_CONNECTION_H_
00125 
00126 /*
00127  * Local variables:
00128  * tab-width: 4
00129  * c-basic-offset: 4
00130  * End:
00131  * vim600: noet sw=4 ts=4 fdm=marker
00132  * vim<600: noet sw=4 ts=4
00133  */

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net