View Javadoc
1 /* 2 Copyright (C) 2003 Together 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with this library; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 package org.webdocwf.util.xml; 20 21 import java.sql.CallableStatement; 22 import java.sql.Connection; 23 import java.sql.DatabaseMetaData; 24 import java.sql.PreparedStatement; 25 import java.sql.SQLException; 26 import java.sql.SQLWarning; 27 import java.sql.Savepoint; 28 import java.sql.Statement; 29 import java.util.Enumeration; 30 import java.util.Hashtable; 31 import java.util.Map; 32 import java.util.Properties; 33 //import java.util.Vector; 34 import java.util.ArrayList; 35 //xml 36 import org.enhydra.xml.SearchElement; 37 38 /*** 39 * Class that implements JDBC Connection interface. 40 * 41 * @author Zoran Milakovic 42 */ 43 public class XmlConnection implements Connection { 44 45 /*** Directory where the XML files to use are located */ 46 private String path; 47 48 /*** File extension to use */ 49 private String extension = XmlDriver.DEFAULT_EXTENSION; 50 51 52 /*** Collection of all created Statements */ 53 private ArrayList statements = new ArrayList(); 54 55 /*** Charset that should be used to read the files */ 56 private String charset = null; 57 58 /*** Stores whether this Connection is closed or not */ 59 private boolean closed; 60 61 /*** If value is true xml file will be saved after each query.Default value is true in JDBC compliant drivers.*/ 62 private boolean autoCommit = true; 63 64 /*** 65 * Creates a new XmlConnection that takes the supplied path 66 * @param path of the XML file 67 */ 68 protected XmlConnection(String path) { 69 // validate argument(s) 70 if(path == null || path.length() == 0) { 71 throw new IllegalArgumentException( 72 "'path' argument may not be empty or null"); 73 } 74 this.path = path; 75 } 76 77 /*** 78 * Creates a new XmlConnection that takes the supplied path and properties 79 * @param path directory where the XML files are located 80 * @param info set of properties containing custom options 81 */ 82 protected XmlConnection(String path, Properties info) { 83 this(path); 84 // check for properties 85 if(info != null) { 86 // set the file extension to be used 87 if(info.getProperty(XmlDriver.FILE_EXTENSION) != null) { 88 extension = info.getProperty(XmlDriver.FILE_EXTENSION); 89 } 90 91 } 92 } 93 94 /*** 95 * Creates a <code>Statement</code> object for sending 96 * SQL statements to the database. 97 * SQL statements without parameters are normally 98 * executed using <code>Statement</code> objects. If the same SQL statement 99 * is executed many times, it may be more efficient to use a 100 * <code>PreparedStatement</code> object. 101 * <P> 102 * Result sets created using the returned <code>Statement</code> 103 * object will by default be type <code>TYPE_FORWARD_ONLY</code> 104 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>. 105 * 106 * @return a new default <code>Statement</code> object 107 * @exception SQLException if a database access error occurs 108 */ 109 public Statement createStatement() throws SQLException { 110 XmlStatement statement = new XmlStatement(this); 111 statements.add(statement); 112 return statement; 113 } 114 115 /*** 116 * Creates a <code>PreparedStatement</code> object for sending 117 * parameterized SQL statements to the database. 118 * <P> 119 * A SQL statement with or without IN parameters can be 120 * pre-compiled and stored in a <code>PreparedStatement</code> object. This 121 * object can then be used to efficiently execute this statement 122 * multiple times. 123 * 124 * <P><B>Note:</B> This method is optimized for handling 125 * parametric SQL statements that benefit from precompilation. If 126 * the driver supports precompilation, 127 * the method <code>prepareStatement</code> will send 128 * the statement to the database for precompilation. Some drivers 129 * may not support precompilation. In this case, the statement may 130 * not be sent to the database until the <code>PreparedStatement</code> 131 * object is executed. This has no direct effect on users; however, it does 132 * affect which methods throw certain <code>SQLException</code> objects. 133 * <P> 134 * Result sets created using the returned <code>PreparedStatement</code> 135 * object will by default be type <code>TYPE_FORWARD_ONLY</code> 136 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>. 137 * 138 * @param sql an SQL statement that may contain one or more '?' IN 139 * parameter placeholders 140 * @return a new default <code>PreparedStatement</code> object containing the 141 * pre-compiled SQL statement 142 * @exception SQLException if a database access error occurs 143 */ 144 public PreparedStatement prepareStatement(String sql) throws SQLException { 145 int index = sql.indexOf("?"); 146 while (index != -1) { 147 sql = sql.substring(0, index) + XmlPreparedStatement.PREPARE_SEPARATOR + 148 sql.substring(index + 1); 149 index = sql.indexOf("?"); 150 } 151 152 XmlPreparedStatement statement = new XmlPreparedStatement(this, sql); 153 statements.add(statement); 154 return statement; 155 156 } 157 158 /*** 159 * Creates a <code>CallableStatement</code> object for calling 160 * database stored procedures. 161 * The <code>CallableStatement</code> object provides 162 * methods for setting up its IN and OUT parameters, and 163 * methods for executing the call to a stored procedure. 164 * 165 * <P><B>Note:</B> This method is optimized for handling stored 166 * procedure call statements. Some drivers may send the call 167 * statement to the database when the method <code>prepareCall</code> 168 * is done; others 169 * may wait until the <code>CallableStatement</code> object 170 * is executed. This has no 171 * direct effect on users; however, it does affect which method 172 * throws certain SQLExceptions. 173 * <P> 174 * Result sets created using the returned <code>CallableStatement</code> 175 * object will by default be type <code>TYPE_FORWARD_ONLY</code> 176 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>. 177 * 178 * @param sql an SQL statement that may contain one or more '?' 179 * parameter placeholders. Typically this statement is a JDBC 180 * function call escape string. 181 * @return a new default <code>CallableStatement</code> object containing the 182 * pre-compiled SQL statement 183 * @exception SQLException if a database access error occurs 184 */ 185 public CallableStatement prepareCall(String sql) throws SQLException { 186 throw new UnsupportedOperationException( 187 "Connection.prepareCall(String) unsupported"); 188 } 189 190 /*** 191 * Converts the given SQL statement into the system's native SQL grammar. 192 * A driver may convert the JDBC SQL grammar into its system's 193 * native SQL grammar prior to sending it. This method returns the 194 * native form of the statement that the driver would have sent. 195 * 196 * @param sql an SQL statement that may contain one or more '?' 197 * parameter placeholders 198 * @return the native form of this statement 199 * @exception SQLException if a database access error occurs 200 */ 201 public String nativeSQL(String sql) throws SQLException { 202 throw new UnsupportedOperationException( 203 "Connection.nativeSQL(String) unsupported"); 204 } 205 206 /*** 207 * Sets this connection's auto-commit mode to the given state. 208 * If a connection is in auto-commit mode, then all its SQL 209 * statements will be executed and committed as individual 210 * transactions. Otherwise, its SQL statements are grouped into 211 * transactions that are terminated by a call to either 212 * the method <code>commit</code> or the method <code>rollback</code>. 213 * By default, new connections are in auto-commit 214 * mode. 215 * <P> 216 * The commit occurs when the statement completes or the next 217 * execute occurs, whichever comes first. In the case of 218 * statements returning a <code>ResultSet</code> object, 219 * the statement completes when the last row of the 220 * <code>ResultSet</code> object has been retrieved or the 221 * <code>ResultSet</code> object has been closed. In advanced cases, a 222 * single statement may return multiple results as well as output 223 * parameter values. In these cases, the commit occurs when all results and 224 * output parameter values have been retrieved. 225 * <P> 226 * <B>NOTE:</B> If this method is called during a transaction, the 227 * transaction is committed. 228 * 229 * @param autoCommit <code>true</code> to enable auto-commit mode; 230 * <code>false</code> to disable it 231 * @exception SQLException if a database access error occurs 232 * @see #getAutoCommit 233 */ 234 public void setAutoCommit(boolean autoCommit) throws SQLException { 235 this.autoCommit = autoCommit; 236 } 237 238 /*** 239 * Retrieves the current auto-commit mode for this <code>Connection</code> 240 * object. 241 * 242 * @return the current state of this <code>Connection</code> object's 243 * auto-commit mode 244 * @exception SQLException if a database access error occurs 245 * @see #setAutoCommit 246 */ 247 public boolean getAutoCommit() throws SQLException { 248 return this.autoCommit; 249 } 250 251 /*** 252 * Makes all changes made since the previous 253 * commit/rollback permanent and releases any database locks 254 * currently held by this <code>Connection</code> object. 255 * This method should be 256 * used only when auto-commit mode has been disabled. 257 * 258 * @exception SQLException if a database access error occurs or this 259 * <code>Connection</code> object is in auto-commit mode 260 * @see #setAutoCommit 261 */ 262 public void commit() throws SQLException { 263 XmlWriter.commit( this.getPath() ); 264 } 265 266 /*** 267 * Undoes all changes made in the current transaction 268 * and releases any database locks currently held 269 * by this <code>Connection</code> object. This method should be 270 * used only when auto-commit mode has been disabled. 271 * 272 * @exception SQLException if a database access error occurs or this 273 * <code>Connection</code> object is in auto-commit mode 274 * @see #setAutoCommit 275 */ 276 public void rollback() throws SQLException { 277 } 278 279 /*** 280 * Releases this <code>Connection</code> object's database and JDBC 281 * resources immediately instead of waiting for them to be automatically 282 * released. 283 * <P> 284 * Calling the method <code>close</code> on a <code>Connection</code> 285 * object that is already closed is a no-op. 286 * <P> 287 * <B>Note:</B> A <code>Connection</code> object is automatically 288 * closed when it is garbage collected. Certain fatal errors also 289 * close a <code>Connection</code> object. 290 * 291 * @exception SQLException if a database access error occurs 292 */ 293 public void close() throws SQLException { 294 // close all created statements 295 // for(Enumeration i = statements.elements(); i.hasMoreElements(); ) { 296 // XmlStatement statement = (XmlStatement)i.nextElement(); 297 // statement.close(); 298 // } 299 // set this Connection as closed 300 closed = true; 301 } 302 303 /*** 304 * Retrieves whether this <code>Connection</code> object has been 305 * closed. A connection is closed if the method <code>close</code> 306 * has been called on it or if certain fatal errors have occurred. 307 * This method is guaranteed to return <code>true</code> only when 308 * it is called after the method <code>Connection.close</code> has 309 * been called. 310 * <P> 311 * This method generally cannot be called to determine whether a 312 * connection to a database is valid or invalid. A typical client 313 * can determine that a connection is invalid by catching any 314 * exceptions that might be thrown when an operation is attempted. 315 * 316 * @return <code>true</code> if this <code>Connection</code> object 317 * is closed; <code>false</code> if it is still open 318 * @exception SQLException if a database access error occurs 319 */ 320 public boolean isClosed() throws SQLException { 321 return closed; 322 } 323 324 /*** 325 * Retrieves a <code>DatabaseMetaData</code> object that contains 326 * metadata about the database to which this 327 * <code>Connection</code> object represents a connection. 328 * The metadata includes information about the database's 329 * tables, its supported SQL grammar, its stored 330 * procedures, the capabilities of this connection, and so on. 331 * 332 * @return a <code>DatabaseMetaData</code> object for this 333 * <code>Connection</code> object 334 * @exception SQLException if a database access error occurs 335 */ 336 public DatabaseMetaData getMetaData() throws SQLException { 337 return new XmlDatabaseMetaData( this ); 338 } 339 340 /*** 341 * Puts this connection in read-only mode as a hint to the driver to enable 342 * database optimizations. 343 * 344 * <P><B>Note:</B> This method cannot be called during a transaction. 345 * 346 * @param readOnly <code>true</code> enables read-only mode; 347 * <code>false</code> disables it 348 * @exception SQLException if a database access error occurs or this 349 * method is called during a transaction 350 */ 351 public void setReadOnly(boolean readOnly) throws SQLException { 352 throw new UnsupportedOperationException( 353 "Connection.setReadOnly(boolean) unsupported"); 354 } 355 356 /*** 357 * Retrieves whether this <code>Connection</code> 358 * object is in read-only mode. 359 * 360 * @return <code>true</code> if this <code>Connection</code> object 361 * is read-only; <code>false</code> otherwise 362 * @exception SQLException if a database access error occurs 363 */ 364 public boolean isReadOnly() throws SQLException { 365 return false; 366 } 367 368 /*** 369 * Sets the given catalog name in order to select 370 * a subspace of this <code>Connection</code> object's database 371 * in which to work. 372 * <P> 373 * If the driver does not support catalogs, it will 374 * silently ignore this request. 375 * 376 * @param catalog the name of a catalog (subspace in this 377 * <code>Connection</code> object's database) in which to work 378 * @exception SQLException if a database access error occurs 379 * @see #getCatalog 380 */ 381 public void setCatalog(String catalog) throws SQLException { 382 // silently ignore this request 383 } 384 385 /*** 386 * Retrieves this <code>Connection</code> object's current catalog name. 387 * 388 * @return the current catalog name or <code>null</code> if there is none 389 * @exception SQLException if a database access error occurs 390 * @see #setCatalog 391 */ 392 public String getCatalog() throws SQLException { 393 return null; 394 } 395 396 /*** 397 * Attempts to change the transaction isolation level for this 398 * <code>Connection</code> object to the one given. 399 * The constants defined in the interface <code>Connection</code> 400 * are the possible transaction isolation levels. 401 * <P> 402 * <B>Note:</B> If this method is called during a transaction, the result 403 * is implementation-defined. 404 * 405 * @param level one of the following <code>Connection</code> constants: 406 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, 407 * <code>Connection.TRANSACTION_READ_COMMITTED</code>, 408 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or 409 * <code>Connection.TRANSACTION_SERIALIZABLE</code>. 410 * (Note that <code>Connection.TRANSACTION_NONE</code> cannot be used 411 * because it specifies that transactions are not supported.) 412 * @exception SQLException if a database access error occurs 413 * or the given parameter is not one of the <code>Connection</code> 414 * constants 415 * @see DatabaseMetaData#supportsTransactionIsolationLevel 416 * @see #getTransactionIsolation 417 */ 418 public void setTransactionIsolation(int level) throws SQLException { 419 throw new UnsupportedOperationException( 420 "Connection.setTransactionIsolation(int) unsupported"); 421 } 422 423 /*** 424 * Retrieves this <code>Connection</code> object's current 425 * transaction isolation level. 426 * 427 * @return the current transaction isolation level, which will be one 428 * of the following constants: 429 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, 430 * <code>Connection.TRANSACTION_READ_COMMITTED</code>, 431 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, 432 * <code>Connection.TRANSACTION_SERIALIZABLE</code>, or 433 * <code>Connection.TRANSACTION_NONE</code>. 434 * @exception SQLException if a database access error occurs 435 * @see #setTransactionIsolation 436 */ 437 public int getTransactionIsolation() throws SQLException { 438 return Connection.TRANSACTION_NONE; 439 } 440 441 /*** 442 * Retrieves the first warning reported by calls on this 443 * <code>Connection</code> object. If there is more than one 444 * warning, subsequent warnings will be chained to the first one 445 * and can be retrieved by calling the method 446 * <code>SQLWarning.getNextWarning</code> on the warning 447 * that was retrieved previously. 448 * <P> 449 * This method may not be 450 * called on a closed connection; doing so will cause an 451 * <code>SQLException</code> to be thrown. 452 * 453 * <P><B>Note:</B> Subsequent warnings will be chained to this 454 * SQLWarning. 455 * 456 * @return the first <code>SQLWarning</code> object or <code>null</code> 457 * if there are none 458 * @exception SQLException if a database access error occurs or 459 * this method is called on a closed connection 460 * @see SQLWarning 461 */ 462 public SQLWarning getWarnings() throws SQLException { 463 throw new UnsupportedOperationException( 464 "Connection.getWarnings() unsupported"); 465 } 466 467 /*** 468 * Clears all warnings reported for this <code>Connection</code> object. 469 * After a call to this method, the method <code>getWarnings</code> 470 * returns <code>null</code> until a new warning is 471 * reported for this <code>Connection</code> object. 472 * 473 * @exception SQLException if a database access error occurs 474 */ 475 public void clearWarnings() throws SQLException { 476 throw new UnsupportedOperationException( 477 "Connection.getWarnings() unsupported"); 478 } 479 480 //--------------------------JDBC 2.0----------------------------- 481 482 /*** 483 * Creates a <code>Statement</code> object that will generate 484 * <code>ResultSet</code> objects with the given type and concurrency. 485 * This method is the same as the <code>createStatement</code> method 486 * above, but it allows the default result set 487 * type and concurrency to be overridden. 488 * 489 * @param resultSetType a result set type; one of 490 * <code>ResultSet.TYPE_FORWARD_ONLY</code>, 491 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or 492 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> 493 * @param resultSetConcurrency a concurrency type; one of 494 * <code>ResultSet.CONCUR_READ_ONLY</code> or 495 * <code>ResultSet.CONCUR_UPDATABLE</code> 496 * @return a new <code>Statement</code> object that will generate 497 * <code>ResultSet</code> objects with the given type and 498 * concurrency 499 * @exception SQLException if a database access error occurs 500 * or the given parameters are not <code>ResultSet</code> 501 * constants indicating type and concurrency 502 */ 503 public Statement createStatement(int resultSetType, int resultSetConcurrency) 504 throws SQLException { 505 throw new UnsupportedOperationException( 506 "Connection.createStatement(int, int) unsupported"); 507 } 508 509 /*** 510 * Creates a <code>PreparedStatement</code> object that will generate 511 * <code>ResultSet</code> objects with the given type and concurrency. 512 * This method is the same as the <code>prepareStatement</code> method 513 * above, but it allows the default result set 514 * type and concurrency to be overridden. 515 * 516 * @param sql a <code>String</code> object that is the SQL statement to 517 * be sent to the database; may contain one or more ? IN 518 * parameters 519 * @param resultSetType a result set type; one of 520 * <code>ResultSet.TYPE_FORWARD_ONLY</code>, 521 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or 522 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> 523 * @param resultSetConcurrency a concurrency type; one of 524 * <code>ResultSet.CONCUR_READ_ONLY</code> or 525 * <code>ResultSet.CONCUR_UPDATABLE</code> 526 * @return a new PreparedStatement object containing the 527 * pre-compiled SQL statement that will produce <code>ResultSet</code> 528 * objects with the given type and concurrency 529 * @exception SQLException if a database access error occurs 530 * or the given parameters are not <code>ResultSet</code> 531 * constants indicating type and concurrency 532 */ 533 public PreparedStatement prepareStatement(String sql, int resultSetType, 534 int resultSetConcurrency) throws SQLException { 535 throw new UnsupportedOperationException( 536 "Connection.prepareStatement(String, int, int) unsupported"); 537 } 538 539 /*** 540 * Creates a <code>CallableStatement</code> object that will generate 541 * <code>ResultSet</code> objects with the given type and concurrency. 542 * This method is the same as the <code>prepareCall</code> method 543 * above, but it allows the default result set 544 * type and concurrency to be overridden. 545 * 546 * @param sql a <code>String</code> object that is the SQL statement to 547 * be sent to the database; may contain on or more ? parameters 548 * @param resultSetType a result set type; one of 549 * <code>ResultSet.TYPE_FORWARD_ONLY</code>, 550 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or 551 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> 552 * @param resultSetConcurrency a concurrency type; one of 553 * <code>ResultSet.CONCUR_READ_ONLY</code> or 554 * <code>ResultSet.CONCUR_UPDATABLE</code> 555 * @return a new <code>CallableStatement</code> object containing the 556 * pre-compiled SQL statement that will produce <code>ResultSet</code> 557 * objects with the given type and concurrency 558 * @exception SQLException if a database access error occurs 559 * or the given parameters are not <code>ResultSet</code> 560 * constants indicating type and concurrency 561 */ 562 public CallableStatement prepareCall(String sql, int resultSetType, 563 int resultSetConcurrency) throws SQLException { 564 throw new UnsupportedOperationException( 565 "Connection.prepareCall(String, int, int) unsupported"); 566 } 567 568 /*** 569 * Retrieves the <code>Map</code> object associated with this 570 * <code>Connection</code> object. 571 * Unless the application has added an entry, the type map returned 572 * will be empty. 573 * 574 * @return the <code>java.util.Map</code> object associated 575 * with this <code>Connection</code> object 576 * @exception SQLException if a database access error occurs 577 * @see #setTypeMap 578 */ 579 public Map getTypeMap() throws SQLException { 580 throw new UnsupportedOperationException( 581 "Connection.getTypeMap() unsupported"); 582 } 583 584 /*** 585 * Installs the given <code>TypeMap</code> object as the type map for 586 * this <code>Connection</code> object. The type map will be used for the 587 * custom mapping of SQL structured types and distinct types. 588 * 589 * @param map the <code>java.util.Map</code> object to install 590 * as the replacement for this <code>Connection</code> 591 * object's default type map 592 * @exception SQLException if a database access error occurs or 593 * the given parameter is not a <code>java.util.Map</code> 594 * object 595 * @see #getTypeMap 596 */ 597 public void setTypeMap(Map map) throws SQLException { 598 throw new UnsupportedOperationException( 599 "Connection.setTypeMap(Map) unsupported"); 600 } 601 602 //--------------------------JDBC 3.0----------------------------- 603 /*** 604 * Changes the holdability of <code>ResultSet</code> objects 605 * created using this <code>Connection</code> object to the given 606 * holdability. 607 * 608 * @param holdability a <code>ResultSet</code> holdability constant; one of 609 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or 610 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> 611 * @throws SQLException if a database access occurs, the given parameter 612 * is not a <code>ResultSet</code> constant indicating holdability, 613 * or the given holdability is not supported 614 * @since 1.4 615 * @see #getHoldability 616 * @see java.sql.ResultSet 617 */ 618 public void setHoldability(int holdability) throws SQLException { 619 throw new UnsupportedOperationException("Connection.setHoldability(int) unsupported"); 620 } 621 622 /*** 623 * Retrieves the current holdability of ResultSet objects created 624 * using this Connection object. 625 * 626 * @return the holdability, one of <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or 627 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> 628 * @throws SQLException if a database access occurs 629 * @since 1.4 630 * @see #setHoldability 631 * @see java.sql.ResultSet 632 */ 633 public int getHoldability() throws SQLException { 634 throw new UnsupportedOperationException("Connection.getHoldability() unsupported"); 635 } 636 637 // Removed since this only builds under JDK 1.4 638 public Savepoint setSavepoint() throws SQLException { 639 throw new UnsupportedOperationException("Connection.setSavepoint() unsupported"); 640 } 641 642 public Savepoint setSavepoint(String name) throws SQLException { 643 throw new UnsupportedOperationException("Connection.setSavepoint(String) unsupported"); 644 } 645 646 public void rollback(Savepoint savepoint) throws SQLException { 647 throw new UnsupportedOperationException("Connection.rollback(Savepoint) unsupported"); 648 } 649 650 public void releaseSavepoint(Savepoint savepoint) throws SQLException { 651 throw new UnsupportedOperationException("Connection.releaseSavepoint(Savepoint) unsupported"); 652 } 653 654 655 public Statement createStatement(int resultSetType, 656 int resultSetConcurrency, 657 int resultSetHoldability) throws SQLException { 658 throw new UnsupportedOperationException("Connection.createStatement(int,int,int) unsupported"); 659 } 660 661 public PreparedStatement prepareStatement(String sql, 662 int resultSetType, 663 int resultSetConcurrency, 664 int resultSetHoldability) throws SQLException { 665 throw new UnsupportedOperationException("Connection.prepareStatement(String,int,int,int) unsupported"); 666 } 667 668 public CallableStatement prepareCall(String sql, 669 int resultSetType, 670 int resultSetConcurrency, 671 int resultSetHoldability) throws SQLException { 672 throw new UnsupportedOperationException("Connection.prepareCall(String,int,int,int) unsupported"); 673 } 674 675 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { 676 throw new UnsupportedOperationException("Connection.prepareStatement(String,int) unsupported"); 677 } 678 679 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { 680 throw new UnsupportedOperationException("Connection.prepareStatement(String,int[]) unsupported"); 681 } 682 683 public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { 684 throw new UnsupportedOperationException("Connection.prepareStatement(String,String[]) unsupported"); 685 } 686 687 //--------------------------------------------------------------------- 688 // Properties 689 //--------------------------------------------------------------------- 690 691 /*** 692 * Accessor method for the path property 693 * @return current value for the path property 694 */ 695 protected String getPath() { 696 return path; 697 } 698 699 /*** 700 * Accessor method for the extension property 701 * @return current value for the extension property 702 */ 703 protected String getExtension() { 704 if( this.path.endsWith(XmlDriver.DEFAULT_EXTENSION) ) 705 return ""; 706 else 707 return extension; 708 } 709 710 711 /*** 712 * Accessor method for the charset property 713 * @return current value for the suppressHeaders property 714 */ 715 protected String getCharset() { 716 return charset; 717 } 718 719 /*** 720 * Sets current DOM.Used when autoCommit mode is false. 721 * @param node current DOM 722 */ 723 // public void setCurrentDocument(SearchElement node) { 724 // try { 725 // this.currentDocument = new SearchElement(node); 726 // XmlWriter.saveDOM( this.currentDocument, "c:/XMLbaze/inSet"+XmlWriter.counter+++".xml"); 727 // }catch(Exception e) { System.out.println(e.getMessage()); } 728 // } 729 730 /*** 731 * Gets current DOM.Used when autoCommit mode is false. 732 * @param node current DOM 733 */ 734 // public SearchElement getCurrentDocument() { 735 // try { 736 // if(this.currentDocument != null) 737 // XmlWriter.saveDOM( this.currentDocument, "c:/XMLbaze/inGet"+XmlWriter.counter+++".xml"); 738 // }catch(Exception e) { System.out.println(e.getMessage()); } 739 // if(this.currentDocument != null) 740 // return new SearchElement(this.currentDocument); 741 // else 742 // return null; 743 // } 744 }

This page was automatically generated by Maven