comparison src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @ 262:2d62ca1f758b

Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java to class MonetWrapper such that it can be called directly from all classes which extend MonetWrapper. Call MonetWrapper.newSQLFeatureNotSupportedException() from more classes and places. Update java documentation: - add "@throws SQLFeatureNotSupportedException" to methods which can throw it - remove "@throws SQLFeatureNotSupportedException" from methods which do not throw it
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 03 Jan 2019 18:33:25 +0100 (2019-01-03)
parents d4baf8a4b43a
children eefa7f625673
comparison
equal deleted inserted replaced
261:d4baf8a4b43a 262:2d62ca1f758b
18 import java.sql.DatabaseMetaData; 18 import java.sql.DatabaseMetaData;
19 import java.sql.PreparedStatement; 19 import java.sql.PreparedStatement;
20 import java.sql.ResultSet; 20 import java.sql.ResultSet;
21 import java.sql.SQLClientInfoException; 21 import java.sql.SQLClientInfoException;
22 import java.sql.SQLException; 22 import java.sql.SQLException;
23 import java.sql.SQLFeatureNotSupportedException;
24 import java.sql.SQLNonTransientConnectionException; 23 import java.sql.SQLNonTransientConnectionException;
25 import java.sql.SQLWarning; 24 import java.sql.SQLWarning;
26 import java.sql.Savepoint; 25 import java.sql.Savepoint;
27 import java.sql.Statement; 26 import java.sql.Statement;
28 import java.util.ArrayList; 27 import java.util.ArrayList;
511 * 510 *
512 * @return the current state of this Connection object's auto-commit mode 511 * @return the current state of this Connection object's auto-commit mode
513 * @see #setAutoCommit(boolean) 512 * @see #setAutoCommit(boolean)
514 */ 513 */
515 @Override 514 @Override
516 public boolean getAutoCommit() throws SQLException { 515 public boolean getAutoCommit() {
517 return autoCommit; 516 return autoCommit;
518 } 517 }
519 518
520 /** 519 /**
521 * Retrieves this Connection object's current catalog name. 520 * Retrieves this Connection object's current catalog name.
522 * 521 *
523 * @return the current catalog name or null if there is none 522 * @return the current catalog name or null if there is none
524 * @throws SQLException if a database access error occurs or the 523 */
525 * current language is not SQL 524 @Override
526 */ 525 public String getCatalog() {
527 @Override
528 public String getCatalog() throws SQLException {
529 // MonetDB does NOT support catalogs 526 // MonetDB does NOT support catalogs
530 return null; 527 return null;
531 } 528 }
532 529
533 /** 530 /**
651 /** 648 /**
652 * Converts the given SQL statement into the system's native SQL grammar. 649 * Converts the given SQL statement into the system's native SQL grammar.
653 * A driver may convert the JDBC SQL grammar into its system's native SQL grammar prior to sending it. 650 * A driver may convert the JDBC SQL grammar into its system's native SQL grammar prior to sending it.
654 * This method returns the native form of the statement that the driver would have sent. 651 * This method returns the native form of the statement that the driver would have sent.
655 * 652 *
656 * Parameters: 653 * @param sql - an SQL statement that may contain one or more '?' parameter placeholders.
657 * sql - an SQL statement that may contain one or more '?' parameter placeholders. 654 * @return the native form of this statement
658 * Returns: the native form of this statement
659 * Throws: SQLException - if a database access error occurs or this method is called on a closed connection
660 */ 655 */
661 @Override 656 @Override
662 public String nativeSQL(String sql) { 657 public String nativeSQL(String sql) {
663 /* there is currently no way to get the native MonetDB rewritten SQL string back, so just return the original string */ 658 /* there is currently no way to get the native MonetDB rewritten SQL string back, so just return the original string */
664 /* in future we may replace/remove the escape sequences { <escape-type> ...} before sending it to the server */ 659 /* in future we may replace/remove the escape sequences { <escape-type> ...} before sending it to the server */
677 * 672 *
678 * Result sets created using the returned CallableStatement object will by default be type TYPE_FORWARD_ONLY 673 * Result sets created using the returned CallableStatement object will by default be type TYPE_FORWARD_ONLY
679 * and have a concurrency level of CONCUR_READ_ONLY. 674 * and have a concurrency level of CONCUR_READ_ONLY.
680 * The holdability of the created result sets can be determined by calling getHoldability(). 675 * The holdability of the created result sets can be determined by calling getHoldability().
681 * 676 *
682 * Parameters: 677 * @param sql - an SQL statement that may contain one or more '?' parameter placeholders.
683 * sql - an SQL statement that may contain one or more '?' parameter placeholders.
684 * Typically this statement is specified using JDBC call escape syntax. 678 * Typically this statement is specified using JDBC call escape syntax.
685 * Returns: a new default CallableStatement object containing the pre-compiled SQL statement 679 * @return a new default CallableStatement object containing the pre-compiled SQL statement
686 * Throws: SQLException - if a database access error occurs or this method is called on a closed connection 680 * @throws SQLException - if a database access error occurs or this method is called on a closed connection
681 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this method.
687 */ 682 */
688 @Override 683 @Override
689 public CallableStatement prepareCall(String sql) throws SQLException { 684 public CallableStatement prepareCall(String sql) throws SQLException {
690 return prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); 685 return prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
691 } 686 }
693 /** 688 /**
694 * Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. 689 * Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
695 * This method is the same as the prepareCall method above, but it allows the default result set type and concurrency to be overridden. 690 * This method is the same as the prepareCall method above, but it allows the default result set type and concurrency to be overridden.
696 * The holdability of the created result sets can be determined by calling getHoldability(). 691 * The holdability of the created result sets can be determined by calling getHoldability().
697 * 692 *
698 * Parameters: 693 * @param sql - a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
699 * sql - a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
700 * Typically this statement is specified using JDBC call escape syntax. 694 * Typically this statement is specified using JDBC call escape syntax.
701 * resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE 695 * @param resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
702 * resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE 696 * @param resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
703 * Returns: a new CallableStatement object containing the pre-compiled SQL statement that 697 * @return a new CallableStatement object containing the pre-compiled SQL statement that
704 * will produce ResultSet objects with the given type and concurrency 698 * will produce ResultSet objects with the given type and concurrency
705 * Throws: 699 * @throws SQLException - if a database access error occurs, this method is called on a closed connection or
706 * SQLException - if a database access error occurs, this method is called on a closed connection or 700 * the given parameters are not ResultSet constants indicating type and concurrency
707 * the given parameters are not ResultSet constants indicating type and concurrency 701 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this method or
708 * SQLFeatureNotSupportedException - if the JDBC driver does not support this method or 702 * this method is not supported for the specified result set type and result set concurrency.
709 * this method is not supported for the specified result set type and result set concurrency.
710 */ 703 */
711 @Override 704 @Override
712 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { 705 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
713 return prepareCall(sql, resultSetType, resultSetConcurrency, ResultSet.HOLD_CURSORS_OVER_COMMIT); 706 return prepareCall(sql, resultSetType, resultSetConcurrency, ResultSet.HOLD_CURSORS_OVER_COMMIT);
714 } 707 }
715 708
716 /** 709 /**
717 * Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. 710 * Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
718 * This method is the same as the prepareCall method above, but it allows the default result set type, result set concurrency type and holdability to be overridden. 711 * This method is the same as the prepareCall method above, but it allows the default result set type, result set concurrency type and holdability to be overridden.
719 * 712 *
720 * Parameters: 713 * @param sql - a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
721 * sql - a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
722 * Typically this statement is specified using JDBC call escape syntax. 714 * Typically this statement is specified using JDBC call escape syntax.
723 * resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE 715 * @param resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
724 * resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE 716 * @param resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
725 * resultSetHoldability - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT 717 * @param resultSetHoldability - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
726 * Returns: a new CallableStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability 718 * @return a new CallableStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
727 * Throws: 719 * @throws SQLException - if a database access error occurs, this method is called on a closed connection or
728 * SQLException - if a database access error occurs, this method is called on a closed connection or 720 * the given parameters are not ResultSet constants indicating type, concurrency, and holdability
729 * the given parameters are not ResultSet constants indicating type, concurrency, and holdability 721 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this method or
730 * SQLFeatureNotSupportedException - if the JDBC driver does not support this method or 722 * this method is not supported for the specified result set type, result set holdability and result set concurrency.
731 * this method is not supported for the specified result set type, result set holdability and result set concurrency.
732 */ 723 */
733 @Override 724 @Override
734 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) 725 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
735 throws SQLException 726 throws SQLException
736 { 727 {
737 throw new SQLFeatureNotSupportedException("prepareCall() not yet supported", "0A000"); 728 throw newSQLFeatureNotSupportedException("prepareCall");
738 /* a request to implement prepareCall() has already been logged, see https://www.monetdb.org/bugzilla/show_bug.cgi?id=6402 */ 729 /* a request to implement prepareCall() has already been logged, see https://www.monetdb.org/bugzilla/show_bug.cgi?id=6402 */
739 } 730 }
740 731
741 /** 732 /**
742 * Creates a PreparedStatement object for sending parameterized SQL 733 * Creates a PreparedStatement object for sending parameterized SQL
837 statements.put(ret, null); 828 statements.put(ret, null);
838 return ret; 829 return ret;
839 } catch (IllegalArgumentException e) { 830 } catch (IllegalArgumentException e) {
840 throw new SQLException(e.toString(), "M0M03"); 831 throw new SQLException(e.toString(), "M0M03");
841 } 832 }
842 // we don't have to catch SQLException because that is declared to 833 // we don't have to catch SQLException because that is declared to be thrown
843 // be thrown
844 } 834 }
845 835
846 /** 836 /**
847 * Creates a default PreparedStatement object that has the 837 * Creates a default PreparedStatement object that has the
848 * capability to retrieve auto-generated keys. The given constant 838 * capability to retrieve auto-generated keys. The given constant
877 * whether auto-generated keys should be returned 867 * whether auto-generated keys should be returned
878 */ 868 */
879 @Override 869 @Override
880 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { 870 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
881 if (autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS && 871 if (autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS &&
882 autoGeneratedKeys != Statement.NO_GENERATED_KEYS) 872 autoGeneratedKeys != Statement.NO_GENERATED_KEYS)
883 throw new SQLException("Invalid argument, expected RETURN_GENERATED_KEYS or NO_GENERATED_KEYS", "M1M05"); 873 throw new SQLException("Invalid argument, expected RETURN_GENERATED_KEYS or NO_GENERATED_KEYS", "M1M05");
884 874
885 /* MonetDB has no way to disable this, so just do the normal 875 /* MonetDB has no way to disable this, so just do the normal thing ;) */
886 * thing ;) */
887 return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); 876 return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
888 } 877 }
889 878
890 /** 879 /**
891 * Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. 880 * Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
902 * object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions. 891 * object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.
903 * 892 *
904 * Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have 893 * Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have
905 * a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability(). 894 * a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability().
906 * 895 *
907 * Parameters: 896 * @param sql - an SQL statement that may contain one or more '?' IN parameter placeholders
908 * sql - an SQL statement that may contain one or more '?' IN parameter placeholders 897 * @param columnIndexes - an array of column indexes indicating the columns that should be returned from the inserted row or rows
909 * columnIndexes - an array of column indexes indicating the columns that should be returned from the inserted row or rows 898 * @return a new PreparedStatement object, containing the pre-compiled statement, that is capable of
910 * Returns: 899 * returning the auto-generated keys designated by the given array of column indexes
911 * a new PreparedStatement object, containing the pre-compiled statement, that is capable of 900 * @throws SQLException - if a database access error occurs or this method is called on a closed connection
912 * returning the auto-generated keys designated by the given array of column indexes 901 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this method
913 * Throws:
914 * SQLException - if a database access error occurs or this method is called on a closed connection
915 * SQLFeatureNotSupportedException - if the JDBC driver does not support this method
916 */ 902 */
917 @Override 903 @Override
918 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { 904 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
919 throw new SQLFeatureNotSupportedException("prepareStatement(String sql, int[] columnIndexes) not supported", "0A000"); 905 throw newSQLFeatureNotSupportedException("prepareStatement(String sql, int[] columnIndexes)");
920 } 906 }
921 907
922 /** 908 /**
923 * Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. 909 * Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
924 * This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned. 910 * This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned.
934 * object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions. 920 * object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.
935 * 921 *
936 * Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have 922 * Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have
937 * a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability(). 923 * a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling getHoldability().
938 * 924 *
939 * Parameters: 925 * @param sql - an SQL statement that may contain one or more '?' IN parameter placeholders
940 * sql - an SQL statement that may contain one or more '?' IN parameter placeholders 926 * @param columnNames - an array of column names indicating the columns that should be returned from the inserted row or rows
941 * columnNames - an array of column names indicating the columns that should be returned from the inserted row or rows 927 * @return a new PreparedStatement object, containing the pre-compiled statement, that is capable of
942 * Returns: 928 * returning the auto-generated keys designated by the given array of column names
943 * a new PreparedStatement object, containing the pre-compiled statement, that is capable of 929 * @throws SQLException - if a database access error occurs or this method is called on a closed connection
944 * returning the auto-generated keys designated by the given array of column names 930 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this method
945 * Throws:
946 * SQLException - if a database access error occurs or this method is called on a closed connection
947 * SQLFeatureNotSupportedException - if the JDBC driver does not support this method
948 */ 931 */
949 @Override 932 @Override
950 public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { 933 public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
951 throw new SQLFeatureNotSupportedException("prepareStatement(String sql, String[] columnNames) not supported", "0A000"); 934 throw newSQLFeatureNotSupportedException("prepareStatement(String sql, String[] columnNames)");
952 } 935 }
953 936
954 /** 937 /**
955 * Removes the given Savepoint object from the current transaction. 938 * Removes the given Savepoint object from the current transaction.
956 * Any reference to the savepoint after it have been removed will 939 * Any reference to the savepoint after it have been removed will
1047 * Sets the given catalog name in order to select a subspace of this 1030 * Sets the given catalog name in order to select a subspace of this
1048 * Connection object's database in which to work. If the driver 1031 * Connection object's database in which to work. If the driver
1049 * does not support catalogs, it will silently ignore this request. 1032 * does not support catalogs, it will silently ignore this request.
1050 */ 1033 */
1051 @Override 1034 @Override
1052 public void setCatalog(String catalog) throws SQLException { 1035 public void setCatalog(String catalog) {
1053 // silently ignore this request as MonetDB does not support catalogs 1036 // silently ignore this request as MonetDB does not support catalogs
1054 } 1037 }
1055 1038
1056 /** 1039 /**
1057 * Changes the default holdability of ResultSet objects created using this 1040 * Changes the default holdability of ResultSet objects created using this
1059 * ResultSet objects can be be determined by invoking DatabaseMetaData.getResultSetHoldability(). 1042 * ResultSet objects can be be determined by invoking DatabaseMetaData.getResultSetHoldability().
1060 * 1043 *
1061 * @param holdability - a ResultSet holdability constant; one of 1044 * @param holdability - a ResultSet holdability constant; one of
1062 * ResultSet.HOLD_CURSORS_OVER_COMMIT or 1045 * ResultSet.HOLD_CURSORS_OVER_COMMIT or
1063 * ResultSet.CLOSE_CURSORS_AT_COMMIT 1046 * ResultSet.CLOSE_CURSORS_AT_COMMIT
1047 * @throws SQLException - if a database access error occurs or this method is called on a closed connection
1048 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this method or argument
1064 * @see #getHoldability() 1049 * @see #getHoldability()
1065 */ 1050 */
1066 @Override 1051 @Override
1067 public void setHoldability(int holdability) throws SQLException { 1052 public void setHoldability(int holdability) throws SQLException {
1068 // we only support ResultSet.HOLD_CURSORS_OVER_COMMIT 1053 // we only support ResultSet.HOLD_CURSORS_OVER_COMMIT
1069 if (holdability != ResultSet.HOLD_CURSORS_OVER_COMMIT) 1054 if (holdability != ResultSet.HOLD_CURSORS_OVER_COMMIT)
1070 throw new SQLFeatureNotSupportedException("setHoldability(CLOSE_CURSORS_AT_COMMIT) not supported", "0A000"); 1055 throw newSQLFeatureNotSupportedException("setHoldability(CLOSE_CURSORS_AT_COMMIT)");
1071 } 1056 }
1072 1057
1073 /** 1058 /**
1074 * Puts this connection in read-only mode as a hint to the driver to 1059 * Puts this connection in read-only mode as a hint to the driver to
1075 * enable database optimizations. MonetDB doesn't support any mode 1060 * enable database optimizations. MonetDB doesn't support any mode
1203 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type 1188 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type
1204 * @since 1.6 1189 * @since 1.6
1205 */ 1190 */
1206 @Override 1191 @Override
1207 public java.sql.Array createArrayOf(String typeName, Object[] elements) throws SQLException { 1192 public java.sql.Array createArrayOf(String typeName, Object[] elements) throws SQLException {
1208 throw new SQLFeatureNotSupportedException("createArrayOf() not supported", "0A000"); 1193 throw newSQLFeatureNotSupportedException("createArrayOf");
1209 } 1194 }
1210 1195
1211 1196
1212 /** 1197 /**
1213 * Constructs an object that implements the Clob interface. The 1198 * Constructs an object that implements the Clob interface. The
1254 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type 1239 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type
1255 * @since 1.6 1240 * @since 1.6
1256 */ 1241 */
1257 @Override 1242 @Override
1258 public java.sql.NClob createNClob() throws SQLException { 1243 public java.sql.NClob createNClob() throws SQLException {
1259 throw new SQLFeatureNotSupportedException("createNClob() not supported", "0A000"); 1244 throw newSQLFeatureNotSupportedException("createNClob");
1260 } 1245 }
1261 1246
1262 /** 1247 /**
1263 * Factory method for creating Struct objects. 1248 * Factory method for creating Struct objects.
1264 * 1249 *
1274 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type 1259 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type
1275 * @since 1.6 1260 * @since 1.6
1276 */ 1261 */
1277 @Override 1262 @Override
1278 public java.sql.Struct createStruct(String typeName, Object[] attributes) throws SQLException { 1263 public java.sql.Struct createStruct(String typeName, Object[] attributes) throws SQLException {
1279 throw new SQLFeatureNotSupportedException("createStruct() not supported", "0A000"); 1264 throw newSQLFeatureNotSupportedException("createStruct");
1280 } 1265 }
1281 1266
1282 /** 1267 /**
1283 * Constructs an object that implements the SQLXML interface. The 1268 * Constructs an object that implements the SQLXML interface. The
1284 * object returned initially contains no data. The 1269 * object returned initially contains no data. The
1291 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type 1276 * @throws SQLFeatureNotSupportedException - if the JDBC driver does not support this data type
1292 * @since 1.6 1277 * @since 1.6
1293 */ 1278 */
1294 @Override 1279 @Override
1295 public java.sql.SQLXML createSQLXML() throws SQLException { 1280 public java.sql.SQLXML createSQLXML() throws SQLException {
1296 throw new SQLFeatureNotSupportedException("createSQLXML() not supported", "0A000"); 1281 throw newSQLFeatureNotSupportedException("createSQLXML");
1297 } 1282 }
1298 1283
1299 /** 1284 /**
1300 * Returns true if the connection has not been closed and is still 1285 * Returns true if the connection has not been closed and is still
1301 * valid. The driver shall submit a query on the connection or use 1286 * valid. The driver shall submit a query on the connection or use
1883 public abstract void complete() throws SQLException; 1868 public abstract void complete() throws SQLException;
1884 1869
1885 /** 1870 /**
1886 * Instructs the Response implementation to close and do the 1871 * Instructs the Response implementation to close and do the
1887 * necessary clean up procedures. 1872 * necessary clean up procedures.
1888 *
1889 * @throws SQLException
1890 */ 1873 */
1891 public abstract void close(); 1874 public abstract void close();
1892 } 1875 }
1893 // }}} 1876 // }}}
1894 1877
2406 } 2389 }
2407 2390
2408 /** 2391 /**
2409 * Instructs the Response implementation to close and do the 2392 * Instructs the Response implementation to close and do the
2410 * necessary clean up procedures. 2393 * necessary clean up procedures.
2411 *
2412 * @throws SQLException
2413 */ 2394 */
2414 @Override 2395 @Override
2415 public void close() { 2396 public void close() {
2416 // feed all rows to the garbage collector 2397 // feed all rows to the garbage collector
2417 for (int i = 0; i < data.length; i++) data[i] = null; 2398 for (int i = 0; i < data.length; i++) data[i] = null;
2590 Response getNextResponse() throws SQLException { 2571 Response getNextResponse() throws SQLException {
2591 if (rstype == ResultSet.TYPE_FORWARD_ONLY) { 2572 if (rstype == ResultSet.TYPE_FORWARD_ONLY) {
2592 // free resources if we're running forward only 2573 // free resources if we're running forward only
2593 if (curResponse >= 0 && curResponse < responses.size()) { 2574 if (curResponse >= 0 && curResponse < responses.size()) {
2594 Response tmp = responses.get(curResponse); 2575 Response tmp = responses.get(curResponse);
2595 if (tmp != null) tmp.close(); 2576 if (tmp != null)
2577 tmp.close();
2596 responses.set(curResponse, null); 2578 responses.set(curResponse, null);
2597 } 2579 }
2598 } 2580 }
2599 curResponse++; 2581 curResponse++;
2600 if (curResponse >= responses.size()) { 2582 if (curResponse >= responses.size()) {
2611 * Closes the Reponse at index i, if not null. 2593 * Closes the Reponse at index i, if not null.
2612 * 2594 *
2613 * @param i the index position of the header to close 2595 * @param i the index position of the header to close
2614 */ 2596 */
2615 void closeResponse(int i) { 2597 void closeResponse(int i) {
2616 if (i < 0 || i >= responses.size()) return; 2598 if (i < 0 || i >= responses.size())
2599 return;
2617 Response tmp = responses.set(i, null); 2600 Response tmp = responses.set(i, null);
2618 if (tmp != null) 2601 if (tmp != null)
2619 tmp.close(); 2602 tmp.close();
2620 } 2603 }
2621 2604