*** empty log message ***
[csql.git] / src / jdbc / JdbcSqlConnectionWrapper.java
blobf0a60c3ac1fbbed4c568588f0afc0d8dc177f544
1 package csql.jdbc;
2 import java.sql.Connection;
3 import java.sql.SQLException;
4 import java.sql.SQLWarning;
5 import java.sql.DatabaseMetaData;
6 import java.sql.Savepoint;
7 import java.sql.Statement;
8 import java.sql.PreparedStatement;
9 import java.sql.CallableStatement;
10 import java.lang.String;
11 import java.util.LinkedList;
12 import java.util.ListIterator;
13 import java.util.Map;
14 import java.util.Properties;
15 import java.sql.Clob;
16 import java.sql.NClob;
17 import java.sql.Blob;
18 import java.sql.SQLXML;
19 import java.sql.Struct;
20 import java.sql.Array;
22 public class JdbcSqlConnectionWrapper extends JSqlError implements Connection, JSqlErrorType
24 private Connection actualCon = null;
25 private JdbcSqlPooledConnection poolcon = null;
26 boolean isClosed=false;
27 public JdbcSqlConnectionWrapper( JdbcSqlPooledConnection cpc,JdbcSqlConnection csqlc)
29 this.poolcon = cpc ;
30 this.actualCon = csqlc ;
31 isClosed=false;
33 static JdbcSqlConnectionWrapper getInstance(JdbcSqlPooledConnection cpc,JdbcSqlConnection phyCon)
35 return new JdbcSqlConnectionWrapper(cpc, phyCon);
38 public void close() throws SQLException
40 if(isClosed) return;
41 isClosed = true;
42 this.poolcon.eventListentionMethod(isClosed,null);
45 public void commit() throws SQLException
47 this.actualCon.commit();
50 public Statement createStatement() throws SQLException
52 return this.actualCon.createStatement();
54 public boolean getAutoCommit() throws SQLException
56 return this.actualCon.getAutoCommit();
59 public int getTransactionIsolation() throws SQLException
62 return this.actualCon.getTransactionIsolation();
65 public boolean isClosed() throws SQLException
67 return this.actualCon.isClosed();
70 public String nativeSQL (String query) throws SQLException
72 return query;
75 public PreparedStatement prepareStatement(String query) throws SQLException
77 return this.actualCon.prepareStatement(query);
80 public void rollback() throws SQLException
82 this.actualCon.rollback();
85 public void setAutoCommit(boolean aCommit) throws SQLException
87 this.actualCon.setAutoCommit(aCommit);
90 public void setTransactionIsolation(int level) throws SQLException
92 this.actualCon.setTransactionIsolation(level);
95 /* public java.sql.Statement createAutoStatement() throws SQLException
97 throw getException(CSQL_NOT_SUPPORTED);
101 //Unsupported Methods
102 public void clearWarnings() throws SQLException
104 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::clearWarnings called");
106 throw getException(CSQL_NOT_SUPPORTED);
108 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
110 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createStatement(int, int) called");
111 throw getException(CSQL_NOT_SUPPORTED);
113 public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
115 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createStatement(int, int, int) called");
116 throw getException(CSQL_NOT_SUPPORTED);
118 public String getCatalog() throws SQLException
120 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::getCatalog called");
121 throw getException(CSQL_NOT_SUPPORTED);
123 public int getHoldability() throws SQLException
125 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::getHoldability called");
126 throw getException(CSQL_NOT_SUPPORTED);
128 public DatabaseMetaData getMetaData() throws SQLException
130 return this.actualCon.getMetaData();
132 public Map getTypeMap() throws SQLException
134 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::getTypeMap called");
135 throw getException(CSQL_NOT_SUPPORTED);
137 public SQLWarning getWarnings() throws SQLException
139 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::getWarnings called");
140 throw getException(CSQL_NOT_SUPPORTED);
142 public boolean isReadOnly() throws SQLException
144 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::isReadOnly called");
145 throw getException(CSQL_NOT_SUPPORTED);
147 public CallableStatement prepareCall(String query ) throws SQLException
149 return this.actualCon.prepareCall( query);
151 public CallableStatement prepareCall(String query, int resultSetType,
152 int resultSetConcurrency) throws SQLException
154 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::prepareCall(String, int, int) called");
155 throw getException(CSQL_NOT_SUPPORTED);
157 public CallableStatement prepareCall(String query, int resultSetType,
158 int resultSetConcurrency, int resultSetHoldability) throws SQLException
160 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::prepareCall(String, int, int, int) called");
161 throw getException(CSQL_NOT_SUPPORTED);
163 public PreparedStatement prepareStatement(String query, int autoGeneratedKeys) throws SQLException
165 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::prepareStatement(String, int) called");
166 throw getException(CSQL_NOT_SUPPORTED);
168 public PreparedStatement prepareStatement(String query, int[] columnIndexes) throws SQLException
170 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::prepareStatement(String, int[]) called");
171 throw getException(CSQL_NOT_SUPPORTED);
173 public PreparedStatement prepareStatement( String query, int resultSetType,
174 int resultSetConcurrency) throws SQLException
176 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::prepareStatement(String, int, int) called");
177 throw getException(CSQL_NOT_SUPPORTED);
179 public PreparedStatement prepareStatement( String query, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
181 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::prepareStatement(String, int, int, int) called");
182 throw getException(CSQL_NOT_SUPPORTED);
184 public PreparedStatement prepareStatement(String query, String[] columnNames) throws SQLException
186 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::prepareStatement(String, String[]) called");
187 throw getException(CSQL_NOT_SUPPORTED);
189 public void releaseSavepoint(Savepoint savepoint) throws SQLException
191 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::releaseSavepoint called");
192 throw getException(CSQL_NOT_SUPPORTED);
194 public void rollback(Savepoint savepoint) throws SQLException
196 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::rollback called");
197 throw getException(CSQL_NOT_SUPPORTED);
199 public void setCatalog(String catalog) throws SQLException
201 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::setCatalog called");
202 throw getException(CSQL_NOT_SUPPORTED);
204 public void setHoldability(int holdability) throws SQLException
206 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::setHoldability called");
207 throw getException(CSQL_NOT_SUPPORTED);
209 public void setReadOnly(boolean rOnly) throws SQLException
211 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::setReadOnly called");
212 throw getException(CSQL_NOT_SUPPORTED);
214 public Savepoint setSavepoint() throws SQLException
216 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::setSavepoint called");
217 throw getException(CSQL_NOT_SUPPORTED);
219 public Savepoint setSavepoint(String query) throws SQLException
221 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::setSavepoint(String) called");
222 throw getException(CSQL_NOT_SUPPORTED);
224 public void setTypeMap(Map map) throws SQLException
226 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::setTypeMpa called");
227 throw getException(CSQL_NOT_SUPPORTED);
229 //Java 1.6 methods
230 public Struct createStruct(String typeName, Object[] attributes) throws SQLException
232 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createStruct called");
233 throw getException(CSQL_NOT_SUPPORTED);
235 public Array createArrayOf(String typeName, Object[] elements) throws SQLException
237 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createArrayOf called");
238 throw getException(CSQL_NOT_SUPPORTED);
240 public Blob createBlob() throws SQLException
242 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createBlob called");
243 throw getException(CSQL_NOT_SUPPORTED);
245 public Clob createClob() throws SQLException
247 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createClob called");
248 throw getException(CSQL_NOT_SUPPORTED);
250 public NClob createNClob() throws SQLException
252 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createNClob called");
253 throw getException(CSQL_NOT_SUPPORTED);
255 public SQLXML createSQLXML() throws SQLException
257 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::createSQLXML called");
258 throw getException(CSQL_NOT_SUPPORTED);
260 public Properties getClientInfo() throws SQLException
262 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::getClientInfo called");
263 throw getException(CSQL_NOT_SUPPORTED);
265 public String getClientInfo(String name) throws SQLException
267 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::getClientInfo(String) called");
268 throw getException(CSQL_NOT_SUPPORTED);
270 public void setClientInfo(String name , String value)
272 return;
274 public void setClientInfo(Properties properties)
276 return;
278 public boolean isValid(int timeout) throws SQLException
280 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::isValid called");
281 throw getException(CSQL_NOT_SUPPORTED);
283 public boolean isWrapperFor(Class ifact) throws SQLException
285 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::isWrapperFor called");
286 throw getException(CSQL_NOT_SUPPORTED);
288 public Class unwrap(Class iface) throws SQLException
290 if (JSqlError.isDebug) System.out.println("JdbcSqlConnectionWrapper::unwrap called");
291 throw getException(CSQL_NOT_SUPPORTED);