001: /*
002: Copyright (C) 2003 Together
003:
004: This library is free software; you can redistribute it and/or
005: modify it under the terms of the GNU Lesser General Public
006: License as published by the Free Software Foundation; either
007: version 2.1 of the License, or (at your option) any later version.
008:
009: This library is distributed in the hope that it will be useful,
010: but WITHOUT ANY WARRANTY; without even the implied warranty of
011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: Lesser General Public License for more details.
013:
014: You should have received a copy of the GNU Lesser General Public
015: License along with this library; if not, write to the Free Software
016: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package org.webdocwf.util.xml;
020:
021: import java.sql.Array;
022: import java.sql.Blob;
023: import java.sql.CallableStatement;
024: import java.sql.Clob;
025: import java.sql.Connection;
026: import java.sql.DatabaseMetaData;
027: import java.sql.NClob;
028: import java.sql.PreparedStatement;
029: import java.sql.SQLClientInfoException;
030: import java.sql.SQLException;
031: import java.sql.SQLWarning;
032: import java.sql.SQLXML;
033: import java.sql.Savepoint;
034: import java.sql.Statement;
035: import java.sql.Struct;
036: import java.util.Enumeration;
037: import java.util.Hashtable;
038: import java.util.Map;
039: import java.util.Properties; //import java.util.Vector;
040: import java.util.ArrayList; //xml
041: import org.enhydra.xml.SearchElement;
042:
043: /**
044: * Class that implements JDBC Connection interface.
045: *
046: * @author Zoran Milakovic
047: */
048: public class XmlConnection implements Connection {
049:
050: /** Directory where the XML files to use are located */
051: private String path;
052:
053: /** File extension to use */
054: private String extension = XmlDriver.DEFAULT_EXTENSION;
055:
056: /** Collection of all created Statements */
057: private ArrayList statements = new ArrayList();
058:
059: /** Charset that should be used to read the files */
060: private String charset = null;
061:
062: /** Stores whether this Connection is closed or not */
063: private boolean closed;
064:
065: /** If value is true xml file will be saved after each query.Default value is true in JDBC compliant drivers.*/
066: private boolean autoCommit = true;
067:
068: /**
069: * Creates a new XmlConnection that takes the supplied path
070: * @param path of the XML file
071: */
072: protected XmlConnection(String path) {
073: // validate argument(s)
074: if (path == null || path.length() == 0) {
075: throw new IllegalArgumentException(
076: "'path' argument may not be empty or null");
077: }
078: this .path = path;
079: }
080:
081: /**
082: * Creates a new XmlConnection that takes the supplied path and properties
083: * @param path directory where the XML files are located
084: * @param info set of properties containing custom options
085: */
086: protected XmlConnection(String path, Properties info) {
087: this (path);
088: // check for properties
089: if (info != null) {
090: // set the file extension to be used
091: if (info.getProperty(XmlDriver.FILE_EXTENSION) != null) {
092: extension = info.getProperty(XmlDriver.FILE_EXTENSION);
093: }
094:
095: }
096: }
097:
098: /**
099: * Creates a <code>Statement</code> object for sending
100: * SQL statements to the database.
101: * SQL statements without parameters are normally
102: * executed using <code>Statement</code> objects. If the same SQL statement
103: * is executed many times, it may be more efficient to use a
104: * <code>PreparedStatement</code> object.
105: * <P>
106: * Result sets created using the returned <code>Statement</code>
107: * object will by default be type <code>TYPE_FORWARD_ONLY</code>
108: * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
109: *
110: * @return a new default <code>Statement</code> object
111: * @exception SQLException if a database access error occurs
112: */
113: public Statement createStatement() throws SQLException {
114: XmlStatement statement = new XmlStatement(this );
115: statements.add(statement);
116: return statement;
117: }
118:
119: /**
120: * Creates a <code>PreparedStatement</code> object for sending
121: * parameterized SQL statements to the database.
122: * <P>
123: * A SQL statement with or without IN parameters can be
124: * pre-compiled and stored in a <code>PreparedStatement</code> object. This
125: * object can then be used to efficiently execute this statement
126: * multiple times.
127: *
128: * <P><B>Note:</B> This method is optimized for handling
129: * parametric SQL statements that benefit from precompilation. If
130: * the driver supports precompilation,
131: * the method <code>prepareStatement</code> will send
132: * the statement to the database for precompilation. Some drivers
133: * may not support precompilation. In this case, the statement may
134: * not be sent to the database until the <code>PreparedStatement</code>
135: * object is executed. This has no direct effect on users; however, it does
136: * affect which methods throw certain <code>SQLException</code> objects.
137: * <P>
138: * Result sets created using the returned <code>PreparedStatement</code>
139: * object will by default be type <code>TYPE_FORWARD_ONLY</code>
140: * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
141: *
142: * @param sql an SQL statement that may contain one or more '?' IN
143: * parameter placeholders
144: * @return a new default <code>PreparedStatement</code> object containing the
145: * pre-compiled SQL statement
146: * @exception SQLException if a database access error occurs
147: */
148: public PreparedStatement prepareStatement(String sql)
149: throws SQLException {
150: int index = sql.indexOf("?");
151: while (index != -1) {
152: sql = sql.substring(0, index)
153: + XmlPreparedStatement.PREPARE_SEPARATOR
154: + sql.substring(index + 1);
155: index = sql.indexOf("?");
156: }
157:
158: XmlPreparedStatement statement = new XmlPreparedStatement(this ,
159: sql);
160: statements.add(statement);
161: return statement;
162:
163: }
164:
165: /**
166: * Creates a <code>CallableStatement</code> object for calling
167: * database stored procedures.
168: * The <code>CallableStatement</code> object provides
169: * methods for setting up its IN and OUT parameters, and
170: * methods for executing the call to a stored procedure.
171: *
172: * <P><B>Note:</B> This method is optimized for handling stored
173: * procedure call statements. Some drivers may send the call
174: * statement to the database when the method <code>prepareCall</code>
175: * is done; others
176: * may wait until the <code>CallableStatement</code> object
177: * is executed. This has no
178: * direct effect on users; however, it does affect which method
179: * throws certain SQLExceptions.
180: * <P>
181: * Result sets created using the returned <code>CallableStatement</code>
182: * object will by default be type <code>TYPE_FORWARD_ONLY</code>
183: * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
184: *
185: * @param sql an SQL statement that may contain one or more '?'
186: * parameter placeholders. Typically this statement is a JDBC
187: * function call escape string.
188: * @return a new default <code>CallableStatement</code> object containing the
189: * pre-compiled SQL statement
190: * @exception SQLException if a database access error occurs
191: */
192: public CallableStatement prepareCall(String sql)
193: throws SQLException {
194: throw new UnsupportedOperationException(
195: "Connection.prepareCall(String) unsupported");
196: }
197:
198: /**
199: * Converts the given SQL statement into the system's native SQL grammar.
200: * A driver may convert the JDBC SQL grammar into its system's
201: * native SQL grammar prior to sending it. This method returns the
202: * native form of the statement that the driver would have sent.
203: *
204: * @param sql an SQL statement that may contain one or more '?'
205: * parameter placeholders
206: * @return the native form of this statement
207: * @exception SQLException if a database access error occurs
208: */
209: public String nativeSQL(String sql) throws SQLException {
210: throw new UnsupportedOperationException(
211: "Connection.nativeSQL(String) unsupported");
212: }
213:
214: /**
215: * Sets this connection's auto-commit mode to the given state.
216: * If a connection is in auto-commit mode, then all its SQL
217: * statements will be executed and committed as individual
218: * transactions. Otherwise, its SQL statements are grouped into
219: * transactions that are terminated by a call to either
220: * the method <code>commit</code> or the method <code>rollback</code>.
221: * By default, new connections are in auto-commit
222: * mode.
223: * <P>
224: * The commit occurs when the statement completes or the next
225: * execute occurs, whichever comes first. In the case of
226: * statements returning a <code>ResultSet</code> object,
227: * the statement completes when the last row of the
228: * <code>ResultSet</code> object has been retrieved or the
229: * <code>ResultSet</code> object has been closed. In advanced cases, a
230: * single statement may return multiple results as well as output
231: * parameter values. In these cases, the commit occurs when all results and
232: * output parameter values have been retrieved.
233: * <P>
234: * <B>NOTE:</B> If this method is called during a transaction, the
235: * transaction is committed.
236: *
237: * @param autoCommit <code>true</code> to enable auto-commit mode;
238: * <code>false</code> to disable it
239: * @exception SQLException if a database access error occurs
240: * @see #getAutoCommit
241: */
242: public void setAutoCommit(boolean autoCommit) throws SQLException {
243: this .autoCommit = autoCommit;
244: }
245:
246: /**
247: * Retrieves the current auto-commit mode for this <code>Connection</code>
248: * object.
249: *
250: * @return the current state of this <code>Connection</code> object's
251: * auto-commit mode
252: * @exception SQLException if a database access error occurs
253: * @see #setAutoCommit
254: */
255: public boolean getAutoCommit() throws SQLException {
256: return this .autoCommit;
257: }
258:
259: /**
260: * Makes all changes made since the previous
261: * commit/rollback permanent and releases any database locks
262: * currently held by this <code>Connection</code> object.
263: * This method should be
264: * used only when auto-commit mode has been disabled.
265: *
266: * @exception SQLException if a database access error occurs or this
267: * <code>Connection</code> object is in auto-commit mode
268: * @see #setAutoCommit
269: */
270: public void commit() throws SQLException {
271: XmlWriter.commit(this .getPath());
272: }
273:
274: /**
275: * Undoes all changes made in the current transaction
276: * and releases any database locks currently held
277: * by this <code>Connection</code> object. This method should be
278: * used only when auto-commit mode has been disabled.
279: *
280: * @exception SQLException if a database access error occurs or this
281: * <code>Connection</code> object is in auto-commit mode
282: * @see #setAutoCommit
283: */
284: public void rollback() throws SQLException {
285: }
286:
287: /**
288: * Releases this <code>Connection</code> object's database and JDBC
289: * resources immediately instead of waiting for them to be automatically
290: * released.
291: * <P>
292: * Calling the method <code>close</code> on a <code>Connection</code>
293: * object that is already closed is a no-op.
294: * <P>
295: * <B>Note:</B> A <code>Connection</code> object is automatically
296: * closed when it is garbage collected. Certain fatal errors also
297: * close a <code>Connection</code> object.
298: *
299: * @exception SQLException if a database access error occurs
300: */
301: public void close() throws SQLException {
302: // close all created statements
303: // for(Enumeration i = statements.elements(); i.hasMoreElements(); ) {
304: // XmlStatement statement = (XmlStatement)i.nextElement();
305: // statement.close();
306: // }
307: // set this Connection as closed
308: closed = true;
309: }
310:
311: /**
312: * Retrieves whether this <code>Connection</code> object has been
313: * closed. A connection is closed if the method <code>close</code>
314: * has been called on it or if certain fatal errors have occurred.
315: * This method is guaranteed to return <code>true</code> only when
316: * it is called after the method <code>Connection.close</code> has
317: * been called.
318: * <P>
319: * This method generally cannot be called to determine whether a
320: * connection to a database is valid or invalid. A typical client
321: * can determine that a connection is invalid by catching any
322: * exceptions that might be thrown when an operation is attempted.
323: *
324: * @return <code>true</code> if this <code>Connection</code> object
325: * is closed; <code>false</code> if it is still open
326: * @exception SQLException if a database access error occurs
327: */
328: public boolean isClosed() throws SQLException {
329: return closed;
330: }
331:
332: /**
333: * Retrieves a <code>DatabaseMetaData</code> object that contains
334: * metadata about the database to which this
335: * <code>Connection</code> object represents a connection.
336: * The metadata includes information about the database's
337: * tables, its supported SQL grammar, its stored
338: * procedures, the capabilities of this connection, and so on.
339: *
340: * @return a <code>DatabaseMetaData</code> object for this
341: * <code>Connection</code> object
342: * @exception SQLException if a database access error occurs
343: */
344: public DatabaseMetaData getMetaData() throws SQLException {
345: return new XmlDatabaseMetaData(this );
346: }
347:
348: /**
349: * Puts this connection in read-only mode as a hint to the driver to enable
350: * database optimizations.
351: *
352: * <P><B>Note:</B> This method cannot be called during a transaction.
353: *
354: * @param readOnly <code>true</code> enables read-only mode;
355: * <code>false</code> disables it
356: * @exception SQLException if a database access error occurs or this
357: * method is called during a transaction
358: */
359: public void setReadOnly(boolean readOnly) throws SQLException {
360: throw new UnsupportedOperationException(
361: "Connection.setReadOnly(boolean) unsupported");
362: }
363:
364: /**
365: * Retrieves whether this <code>Connection</code>
366: * object is in read-only mode.
367: *
368: * @return <code>true</code> if this <code>Connection</code> object
369: * is read-only; <code>false</code> otherwise
370: * @exception SQLException if a database access error occurs
371: */
372: public boolean isReadOnly() throws SQLException {
373: return false;
374: }
375:
376: /**
377: * Sets the given catalog name in order to select
378: * a subspace of this <code>Connection</code> object's database
379: * in which to work.
380: * <P>
381: * If the driver does not support catalogs, it will
382: * silently ignore this request.
383: *
384: * @param catalog the name of a catalog (subspace in this
385: * <code>Connection</code> object's database) in which to work
386: * @exception SQLException if a database access error occurs
387: * @see #getCatalog
388: */
389: public void setCatalog(String catalog) throws SQLException {
390: // silently ignore this request
391: }
392:
393: /**
394: * Retrieves this <code>Connection</code> object's current catalog name.
395: *
396: * @return the current catalog name or <code>null</code> if there is none
397: * @exception SQLException if a database access error occurs
398: * @see #setCatalog
399: */
400: public String getCatalog() throws SQLException {
401: return null;
402: }
403:
404: /**
405: * Attempts to change the transaction isolation level for this
406: * <code>Connection</code> object to the one given.
407: * The constants defined in the interface <code>Connection</code>
408: * are the possible transaction isolation levels.
409: * <P>
410: * <B>Note:</B> If this method is called during a transaction, the result
411: * is implementation-defined.
412: *
413: * @param level one of the following <code>Connection</code> constants:
414: * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
415: * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
416: * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
417: * <code>Connection.TRANSACTION_SERIALIZABLE</code>.
418: * (Note that <code>Connection.TRANSACTION_NONE</code> cannot be used
419: * because it specifies that transactions are not supported.)
420: * @exception SQLException if a database access error occurs
421: * or the given parameter is not one of the <code>Connection</code>
422: * constants
423: * @see DatabaseMetaData#supportsTransactionIsolationLevel
424: * @see #getTransactionIsolation
425: */
426: public void setTransactionIsolation(int level) throws SQLException {
427: throw new UnsupportedOperationException(
428: "Connection.setTransactionIsolation(int) unsupported");
429: }
430:
431: /**
432: * Retrieves this <code>Connection</code> object's current
433: * transaction isolation level.
434: *
435: * @return the current transaction isolation level, which will be one
436: * of the following constants:
437: * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
438: * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
439: * <code>Connection.TRANSACTION_REPEATABLE_READ</code>,
440: * <code>Connection.TRANSACTION_SERIALIZABLE</code>, or
441: * <code>Connection.TRANSACTION_NONE</code>.
442: * @exception SQLException if a database access error occurs
443: * @see #setTransactionIsolation
444: */
445: public int getTransactionIsolation() throws SQLException {
446: return Connection.TRANSACTION_NONE;
447: }
448:
449: /**
450: * Retrieves the first warning reported by calls on this
451: * <code>Connection</code> object. If there is more than one
452: * warning, subsequent warnings will be chained to the first one
453: * and can be retrieved by calling the method
454: * <code>SQLWarning.getNextWarning</code> on the warning
455: * that was retrieved previously.
456: * <P>
457: * This method may not be
458: * called on a closed connection; doing so will cause an
459: * <code>SQLException</code> to be thrown.
460: *
461: * <P><B>Note:</B> Subsequent warnings will be chained to this
462: * SQLWarning.
463: *
464: * @return the first <code>SQLWarning</code> object or <code>null</code>
465: * if there are none
466: * @exception SQLException if a database access error occurs or
467: * this method is called on a closed connection
468: * @see SQLWarning
469: */
470: public SQLWarning getWarnings() throws SQLException {
471: throw new UnsupportedOperationException(
472: "Connection.getWarnings() unsupported");
473: }
474:
475: /**
476: * Clears all warnings reported for this <code>Connection</code> object.
477: * After a call to this method, the method <code>getWarnings</code>
478: * returns <code>null</code> until a new warning is
479: * reported for this <code>Connection</code> object.
480: *
481: * @exception SQLException if a database access error occurs
482: */
483: public void clearWarnings() throws SQLException {
484: throw new UnsupportedOperationException(
485: "Connection.getWarnings() unsupported");
486: }
487:
488: //--------------------------JDBC 2.0-----------------------------
489:
490: /**
491: * Creates a <code>Statement</code> object that will generate
492: * <code>ResultSet</code> objects with the given type and concurrency.
493: * This method is the same as the <code>createStatement</code> method
494: * above, but it allows the default result set
495: * type and concurrency to be overridden.
496: *
497: * @param resultSetType a result set type; one of
498: * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
499: * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
500: * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
501: * @param resultSetConcurrency a concurrency type; one of
502: * <code>ResultSet.CONCUR_READ_ONLY</code> or
503: * <code>ResultSet.CONCUR_UPDATABLE</code>
504: * @return a new <code>Statement</code> object that will generate
505: * <code>ResultSet</code> objects with the given type and
506: * concurrency
507: * @exception SQLException if a database access error occurs
508: * or the given parameters are not <code>ResultSet</code>
509: * constants indicating type and concurrency
510: */
511: public Statement createStatement(int resultSetType,
512: int resultSetConcurrency) throws SQLException {
513: throw new UnsupportedOperationException(
514: "Connection.createStatement(int, int) unsupported");
515: }
516:
517: /**
518: * Creates a <code>PreparedStatement</code> object that will generate
519: * <code>ResultSet</code> objects with the given type and concurrency.
520: * This method is the same as the <code>prepareStatement</code> method
521: * above, but it allows the default result set
522: * type and concurrency to be overridden.
523: *
524: * @param sql a <code>String</code> object that is the SQL statement to
525: * be sent to the database; may contain one or more ? IN
526: * parameters
527: * @param resultSetType a result set type; one of
528: * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
529: * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
530: * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
531: * @param resultSetConcurrency a concurrency type; one of
532: * <code>ResultSet.CONCUR_READ_ONLY</code> or
533: * <code>ResultSet.CONCUR_UPDATABLE</code>
534: * @return a new PreparedStatement object containing the
535: * pre-compiled SQL statement that will produce <code>ResultSet</code>
536: * objects with the given type and concurrency
537: * @exception SQLException if a database access error occurs
538: * or the given parameters are not <code>ResultSet</code>
539: * constants indicating type and concurrency
540: */
541: public PreparedStatement prepareStatement(String sql,
542: int resultSetType, int resultSetConcurrency)
543: throws SQLException {
544: throw new UnsupportedOperationException(
545: "Connection.prepareStatement(String, int, int) unsupported");
546: }
547:
548: /**
549: * Creates a <code>CallableStatement</code> object that will generate
550: * <code>ResultSet</code> objects with the given type and concurrency.
551: * This method is the same as the <code>prepareCall</code> method
552: * above, but it allows the default result set
553: * type and concurrency to be overridden.
554: *
555: * @param sql a <code>String</code> object that is the SQL statement to
556: * be sent to the database; may contain on or more ? parameters
557: * @param resultSetType a result set type; one of
558: * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
559: * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
560: * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
561: * @param resultSetConcurrency a concurrency type; one of
562: * <code>ResultSet.CONCUR_READ_ONLY</code> or
563: * <code>ResultSet.CONCUR_UPDATABLE</code>
564: * @return a new <code>CallableStatement</code> object containing the
565: * pre-compiled SQL statement that will produce <code>ResultSet</code>
566: * objects with the given type and concurrency
567: * @exception SQLException if a database access error occurs
568: * or the given parameters are not <code>ResultSet</code>
569: * constants indicating type and concurrency
570: */
571: public CallableStatement prepareCall(String sql, int resultSetType,
572: int resultSetConcurrency) throws SQLException {
573: throw new UnsupportedOperationException(
574: "Connection.prepareCall(String, int, int) unsupported");
575: }
576:
577: /**
578: * Retrieves the <code>Map</code> object associated with this
579: * <code>Connection</code> object.
580: * Unless the application has added an entry, the type map returned
581: * will be empty.
582: *
583: * @return the <code>java.util.Map</code> object associated
584: * with this <code>Connection</code> object
585: * @exception SQLException if a database access error occurs
586: * @see #setTypeMap
587: */
588: public Map getTypeMap() throws SQLException {
589: throw new UnsupportedOperationException(
590: "Connection.getTypeMap() unsupported");
591: }
592:
593: /**
594: * Installs the given <code>TypeMap</code> object as the type map for
595: * this <code>Connection</code> object. The type map will be used for the
596: * custom mapping of SQL structured types and distinct types.
597: *
598: * @param map the <code>java.util.Map</code> object to install
599: * as the replacement for this <code>Connection</code>
600: * object's default type map
601: * @exception SQLException if a database access error occurs or
602: * the given parameter is not a <code>java.util.Map</code>
603: * object
604: * @see #getTypeMap
605: */
606: public void setTypeMap(Map map) throws SQLException {
607: throw new UnsupportedOperationException(
608: "Connection.setTypeMap(Map) unsupported");
609: }
610:
611: //--------------------------JDBC 3.0-----------------------------
612: /**
613: * Changes the holdability of <code>ResultSet</code> objects
614: * created using this <code>Connection</code> object to the given
615: * holdability.
616: *
617: * @param holdability a <code>ResultSet</code> holdability constant; one of
618: * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
619: * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
620: * @throws SQLException if a database access occurs, the given parameter
621: * is not a <code>ResultSet</code> constant indicating holdability,
622: * or the given holdability is not supported
623: * @since 1.4
624: * @see #getHoldability
625: * @see java.sql.ResultSet
626: */
627: public void setHoldability(int holdability) throws SQLException {
628: throw new UnsupportedOperationException(
629: "Connection.setHoldability(int) unsupported");
630: }
631:
632: /**
633: * Retrieves the current holdability of ResultSet objects created
634: * using this Connection object.
635: *
636: * @return the holdability, one of <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
637: * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
638: * @throws SQLException if a database access occurs
639: * @since 1.4
640: * @see #setHoldability
641: * @see java.sql.ResultSet
642: */
643: public int getHoldability() throws SQLException {
644: throw new UnsupportedOperationException(
645: "Connection.getHoldability() unsupported");
646: }
647:
648: // Removed since this only builds under JDK 1.4
649: public Savepoint setSavepoint() throws SQLException {
650: throw new UnsupportedOperationException(
651: "Connection.setSavepoint() unsupported");
652: }
653:
654: public Savepoint setSavepoint(String name) throws SQLException {
655: throw new UnsupportedOperationException(
656: "Connection.setSavepoint(String) unsupported");
657: }
658:
659: public void rollback(Savepoint savepoint) throws SQLException {
660: throw new UnsupportedOperationException(
661: "Connection.rollback(Savepoint) unsupported");
662: }
663:
664: public void releaseSavepoint(Savepoint savepoint)
665: throws SQLException {
666: throw new UnsupportedOperationException(
667: "Connection.releaseSavepoint(Savepoint) unsupported");
668: }
669:
670: public Statement createStatement(int resultSetType,
671: int resultSetConcurrency, int resultSetHoldability)
672: throws SQLException {
673: throw new UnsupportedOperationException(
674: "Connection.createStatement(int,int,int) unsupported");
675: }
676:
677: public PreparedStatement prepareStatement(String sql,
678: int resultSetType, int resultSetConcurrency,
679: int resultSetHoldability) throws SQLException {
680: throw new UnsupportedOperationException(
681: "Connection.prepareStatement(String,int,int,int) unsupported");
682: }
683:
684: public CallableStatement prepareCall(String sql, int resultSetType,
685: int resultSetConcurrency, int resultSetHoldability)
686: throws SQLException {
687: throw new UnsupportedOperationException(
688: "Connection.prepareCall(String,int,int,int) unsupported");
689: }
690:
691: public PreparedStatement prepareStatement(String sql,
692: int autoGeneratedKeys) throws SQLException {
693: throw new UnsupportedOperationException(
694: "Connection.prepareStatement(String,int) unsupported");
695: }
696:
697: public PreparedStatement prepareStatement(String sql,
698: int[] columnIndexes) throws SQLException {
699: throw new UnsupportedOperationException(
700: "Connection.prepareStatement(String,int[]) unsupported");
701: }
702:
703: public PreparedStatement prepareStatement(String sql,
704: String[] columnNames) throws SQLException {
705: throw new UnsupportedOperationException(
706: "Connection.prepareStatement(String,String[]) unsupported");
707: }
708:
709: //---------------------------------------------------------------------
710: // Properties
711: //---------------------------------------------------------------------
712:
713: /**
714: * Accessor method for the path property
715: * @return current value for the path property
716: */
717: protected String getPath() {
718: return path;
719: }
720:
721: /**
722: * Accessor method for the extension property
723: * @return current value for the extension property
724: */
725: protected String getExtension() {
726: if (this .path.endsWith(XmlDriver.DEFAULT_EXTENSION))
727: return "";
728: else
729: return extension;
730: }
731:
732: /**
733: * Accessor method for the charset property
734: * @return current value for the suppressHeaders property
735: */
736: protected String getCharset() {
737: return charset;
738: }
739:
740: public Array createArrayOf(String typeName, Object[] elements)
741: throws SQLException {
742: // TODO Auto-generated method stub
743: return null;
744: }
745:
746: public Blob createBlob() throws SQLException {
747: // TODO Auto-generated method stub
748: return null;
749: }
750:
751: public Clob createClob() throws SQLException {
752: // TODO Auto-generated method stub
753: return null;
754: }
755:
756: public NClob createNClob() throws SQLException {
757: // TODO Auto-generated method stub
758: return null;
759: }
760:
761: public SQLXML createSQLXML() throws SQLException {
762: // TODO Auto-generated method stub
763: return null;
764: }
765:
766: public Struct createStruct(String typeName, Object[] attributes)
767: throws SQLException {
768: // TODO Auto-generated method stub
769: return null;
770: }
771:
772: public Properties getClientInfo() throws SQLException {
773: // TODO Auto-generated method stub
774: return null;
775: }
776:
777: public String getClientInfo(String name) throws SQLException {
778: // TODO Auto-generated method stub
779: return null;
780: }
781:
782: public boolean isValid(int timeout) throws SQLException {
783: // TODO Auto-generated method stub
784: return false;
785: }
786:
787: public void setClientInfo(Properties properties)
788: throws SQLClientInfoException {
789: // TODO Auto-generated method stub
790: throw new UnsupportedOperationException(
791: "Connection.setClientInfo(Properties) unsupported");
792: }
793:
794: public void setClientInfo(String name, String value)
795: throws SQLClientInfoException {
796: // TODO Auto-generated method stub
797: throw new UnsupportedOperationException(
798: "Connection.setClientInfo(String,String) unsupported");
799: }
800:
801: // public void setTypeMap(Map<String, Class<?>> arg0) throws SQLException {
802: // // TODO Auto-generated method stub
803: //
804: // }
805:
806: public boolean isWrapperFor(Class<?> iface) throws SQLException {
807: // TODO Auto-generated method stub
808: return false;
809: }
810:
811: public <T> T unwrap(Class<T> iface) throws SQLException {
812: // TODO Auto-generated method stub
813: return null;
814: }
815:
816: /**
817: * Sets current DOM.Used when autoCommit mode is false.
818: * @param node current DOM
819: */
820: // public void setCurrentDocument(SearchElement node) {
821: // try {
822: // this.currentDocument = new SearchElement(node);
823: // XmlWriter.saveDOM( this.currentDocument, "c:/XMLbaze/inSet"+XmlWriter.counter+++".xml");
824: // }catch(Exception e) { System.out.println(e.getMessage()); }
825: // }
826: /**
827: * Gets current DOM.Used when autoCommit mode is false.
828: * @param node current DOM
829: */
830: // public SearchElement getCurrentDocument() {
831: // try {
832: // if(this.currentDocument != null)
833: // XmlWriter.saveDOM( this.currentDocument, "c:/XMLbaze/inGet"+XmlWriter.counter+++".xml");
834: // }catch(Exception e) { System.out.println(e.getMessage()); }
835: // if(this.currentDocument != null)
836: // return new SearchElement(this.currentDocument);
837: // else
838: // return null;
839: // }
840: }
|