![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
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 _SQL_CONNECTION_H_ 00013 #define _SQL_CONNECTION_H_ 00014 00015 #include <string> 00016 #include <map> 00017 00018 #include "build_config.h" 00019 #include "warning.h" 00020 00021 namespace sql 00022 { 00023 00024 typedef union _ConnectPropertyVal 00025 { 00026 struct 00027 { 00028 const char * val; 00029 size_t len; 00030 } str; 00031 double dval; 00032 long long lval; 00033 bool bval; 00034 void * pval; 00035 } ConnectPropertyVal; 00036 00037 00038 class DatabaseMetaData; 00039 class PreparedStatement; 00040 class Statement; 00041 00042 typedef enum transaction_isolation 00043 { 00044 TRANSACTION_NONE= 0, 00045 TRANSACTION_READ_COMMITTED, 00046 TRANSACTION_READ_UNCOMMITTED, 00047 TRANSACTION_REPEATABLE_READ, 00048 TRANSACTION_SERIALIZABLE 00049 } enum_transaction_isolation; 00050 00051 class Savepoint 00052 { 00053 /* Prevent use of these */ 00054 Savepoint(const Savepoint &); 00055 void operator=(Savepoint &); 00056 public: 00057 Savepoint() {}; 00058 virtual ~Savepoint() {}; 00059 virtual int getSavepointId() = 0; 00060 00061 virtual std::string getSavepointName() = 0; 00062 }; 00063 00064 00065 class CPPCONN_PUBLIC_FUNC Connection 00066 { 00067 /* Prevent use of these */ 00068 Connection(const Connection &); 00069 void operator=(Connection &); 00070 public: 00071 00072 Connection() {}; 00073 00074 virtual ~Connection() {}; 00075 00076 virtual void clearWarnings() = 0; 00077 00078 virtual Statement *createStatement() = 0; 00079 00080 virtual void close() = 0; 00081 00082 virtual void commit() = 0; 00083 00084 virtual bool getAutoCommit() = 0; 00085 00086 virtual std::string getCatalog() = 0; 00087 00088 virtual std::string getSchema() = 0; 00089 00090 virtual std::string getClientInfo() = 0; 00091 00092 virtual void getClientOption(const std::string & optionName, void * optionValue) = 0; 00093 00094 /* virtual int getHoldability() = 0; */ 00095 00096 /* virtual std::map getTypeMap() = 0; */ 00097 00098 virtual DatabaseMetaData * getMetaData() = 0; 00099 00100 virtual enum_transaction_isolation getTransactionIsolation() = 0; 00101 00102 virtual const SQLWarning * getWarnings() = 0; 00103 00104 virtual bool isClosed() = 0; 00105 00106 virtual std::string nativeSQL(const std::string& sql) = 0; 00107 00108 virtual PreparedStatement * prepareStatement(const std::string& sql) = 0; 00109 00110 virtual void releaseSavepoint(Savepoint * savepoint) = 0; 00111 00112 virtual void rollback() = 0; 00113 00114 virtual void rollback(Savepoint * savepoint) = 0; 00115 00116 virtual void setAutoCommit(bool autoCommit) = 0; 00117 00118 virtual void setCatalog(const std::string& catalog) = 0; 00119 00120 virtual void setSchema(const std::string& catalog) = 0; 00121 00122 virtual sql::Connection * setClientOption(const std::string & optionName, const void * optionValue) = 0; 00123 00124 virtual Savepoint * setSavepoint(const std::string& name) = 0; 00125 00126 virtual void setTransactionIsolation(enum_transaction_isolation level) = 0; 00127 00128 /* virtual void setTypeMap(Map map) = 0; */ 00129 }; 00130 00131 } /* namespace sql */ 00132 00133 #endif // _SQL_CONNECTION_H_
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.