Debian Codegraph @

src/main/org/h2/jdbc/JdbcDatabaseMetaData.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.jdbc;
7
8 import java.sql.Connection;
9 import java.sql.DatabaseMetaData;
10 import java.sql.ResultSet;
11 import java.sql.RowIdLifetime;
12 import java.sql.SQLException;
13 import java.util.Map.Entry;
14 import java.util.Properties;
15
16 import org.h2.engine.Constants;
17 import org.h2.engine.Session;
18 import org.h2.jdbc.meta.DatabaseMeta;
19 import org.h2.jdbc.meta.DatabaseMetaLegacy;
20 import org.h2.message.DbException;
21 import org.h2.message.Trace;
22 import org.h2.message.TraceObject;
23 import org.h2.mode.DefaultNullOrdering;
24 import org.h2.result.ResultInterface;
25 import org.h2.result.SimpleResult;
26 import org.h2.value.TypeInfo;
27 import org.h2.value.ValueInteger;
28 import org.h2.value.ValueVarchar;
29
30 /**
31 * Represents the meta data for a database.
32 */
33 public final class JdbcDatabaseMetaData extends TraceObject
34 implements DatabaseMetaData, JdbcDatabaseMetaDataBackwardsCompat {
35
36 private final JdbcConnection conn;
37
38 private final DatabaseMeta meta;
39
40 JdbcDatabaseMetaData(JdbcConnection conn, Trace trace, int id) {
41 setTrace(trace, TraceObject.DATABASE_META_DATA, id);
42 this.conn = conn;
43 Session session = conn.getSession();
44 meta = session.isOldInformationSchema() ? new DatabaseMetaLegacy(session)
45 : conn.getSession().getDatabaseMeta();
46 }
47
48 /**
49 * Returns the major version of this driver.
50 *
51 * @return the major version number
52 */
53 @Override
54 public int getDriverMajorVersion() {
55 debugCodeCall("getDriverMajorVersion");
56 return Constants.VERSION_MAJOR;
57 }
58
59 /**
60 * Returns the minor version of this driver.
61 *
62 * @return the minor version number
63 */
64 @Override
65 public int getDriverMinorVersion() {
66 debugCodeCall("getDriverMinorVersion");
67 return Constants.VERSION_MINOR;
68 }
69
70 /**
71 * Gets the database product name.
72 *
73 * @return the product name ("H2")
74 */
75 @Override
76 public String getDatabaseProductName() {
77 debugCodeCall("getDatabaseProductName");
78 // This value must stay like that, see
79 // https://hibernate.atlassian.net/browse/HHH-2682
80 return "H2";
81 }
82
83 /**
84 * Gets the product version of the database.
85 *
86 * @return the product version
87 */
88 @Override
89 public String getDatabaseProductVersion() throws SQLException {
90 try {
91 debugCodeCall("getDatabaseProductVersion");
92 return meta.getDatabaseProductVersion();
93 } catch (Exception e) {
94 throw logAndConvert(e);
95 }
96 }
97
98 /**
99 * Gets the name of the JDBC driver.
100 *
101 * @return the driver name ("H2 JDBC Driver")
102 */
103 @Override
104 public String getDriverName() {
105 debugCodeCall("getDriverName");
106 return "H2 JDBC Driver";
107 }
108
109 /**
110 * Gets the version number of the driver. The format is
111 * [MajorVersion].[MinorVersion].
112 *
113 * @return the version number
114 */
115 @Override
116 public String getDriverVersion() {
117 debugCodeCall("getDriverVersion");
118 return Constants.FULL_VERSION;
119 }
120
121 /**
122 * Gets the list of tables in the database. The result set is sorted by
123 * TABLE_TYPE, TABLE_SCHEM, and TABLE_NAME.
124 *
125 * <ol>
126 * <li>TABLE_CAT (String) table catalog</li>
127 * <li>TABLE_SCHEM (String) table schema</li>
128 * <li>TABLE_NAME (String) table name</li>
129 * <li>TABLE_TYPE (String) table type</li>
130 * <li>REMARKS (String) comment</li>
131 * <li>TYPE_CAT (String) always null</li>
132 * <li>TYPE_SCHEM (String) always null</li>
133 * <li>TYPE_NAME (String) always null</li>
134 * <li>SELF_REFERENCING_COL_NAME (String) always null</li>
135 * <li>REF_GENERATION (String) always null</li>
136 * <li>SQL (String) the create table statement or NULL for systems tables.</li>
137 * </ol>
138 *
139 * @param catalog null (to get all objects) or the catalog name
140 * @param schemaPattern null (to get all objects) or a schema name
141 * (uppercase for unquoted names)
142 * @param tableNamePattern null (to get all objects) or a table name
143 * (uppercase for unquoted names)
144 * @param types null or a list of table types
145 * @return the list of columns
146 * @throws SQLException if the connection is closed
147 */
148 @Override
149 public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
150 throws SQLException {
151 try {
152 if (isDebugEnabled()) {
153 debugCode("getTables(" + quote(catalog) + ", " + quote(schemaPattern) + ", " + quote(tableNamePattern)
154 + ", " + quoteArray(types) + ')');
155 }
156 return getResultSet(meta.getTables(catalog, schemaPattern, tableNamePattern, types));
157 } catch (Exception e) {
158 throw logAndConvert(e);
159 }
160 }
161
162 /**
163 * Gets the list of columns. The result set is sorted by TABLE_SCHEM,
164 * TABLE_NAME, and ORDINAL_POSITION.
165 *
166 * <ol>
167 * <li>TABLE_CAT (String) table catalog</li>
168 * <li>TABLE_SCHEM (String) table schema</li>
169 * <li>TABLE_NAME (String) table name</li>
170 * <li>COLUMN_NAME (String) column name</li>
171 * <li>DATA_TYPE (int) data type (see java.sql.Types)</li>
172 * <li>TYPE_NAME (String) data type name ("INTEGER", "VARCHAR",...)</li>
173 * <li>COLUMN_SIZE (int) precision
174 * (values larger than 2 GB are returned as 2 GB)</li>
175 * <li>BUFFER_LENGTH (int) unused</li>
176 * <li>DECIMAL_DIGITS (int) scale (0 for INTEGER and VARCHAR)</li>
177 * <li>NUM_PREC_RADIX (int) radix</li>
178 * <li>NULLABLE (int) columnNoNulls or columnNullable</li>
179 * <li>REMARKS (String) comment</li>
180 * <li>COLUMN_DEF (String) default value</li>
181 * <li>SQL_DATA_TYPE (int) unused</li>
182 * <li>SQL_DATETIME_SUB (int) unused</li>
183 * <li>CHAR_OCTET_LENGTH (int) unused</li>
184 * <li>ORDINAL_POSITION (int) the column index (1,2,...)</li>
185 * <li>IS_NULLABLE (String) "NO" or "YES"</li>
186 * <li>SCOPE_CATALOG (String) always null</li>
187 * <li>SCOPE_SCHEMA (String) always null</li>
188 * <li>SCOPE_TABLE (String) always null</li>
189 * <li>SOURCE_DATA_TYPE (short) null</li>
190 * <li>IS_AUTOINCREMENT (String) "NO" or "YES"</li>
191 * <li>IS_GENERATEDCOLUMN (String) "NO" or "YES"</li>
192 * </ol>
193 *
194 * @param catalog null (to get all objects) or the catalog name
195 * @param schemaPattern null (to get all objects) or a schema name
196 * (uppercase for unquoted names)
197 * @param tableNamePattern null (to get all objects) or a table name
198 * (uppercase for unquoted names)
199 * @param columnNamePattern null (to get all objects) or a column name
200 * (uppercase for unquoted names)
201 * @return the list of columns
202 * @throws SQLException if the connection is closed
203 */
204 @Override
205 public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern,
206 String columnNamePattern) throws SQLException {
207 try {
208 if (isDebugEnabled()) {
209 debugCode("getColumns(" + quote(catalog)+", "
210 +quote(schemaPattern)+", "
211 +quote(tableNamePattern)+", "
212 +quote(columnNamePattern)+')');
213 }
214 return getResultSet(meta.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern));
215 } catch (Exception e) {
216 throw logAndConvert(e);
217 }
218 }
219
220 /**
221 * Gets the list of indexes for this database. The primary key index (if
222 * there is one) is also listed, with the name PRIMARY_KEY. The result set
223 * is sorted by NON_UNIQUE ('false' first), TYPE, TABLE_SCHEM, INDEX_NAME,
224 * and ORDINAL_POSITION.
225 *
226 * <ol>
227 * <li>TABLE_CAT (String) table catalog</li>
228 * <li>TABLE_SCHEM (String) table schema</li>
229 * <li>TABLE_NAME (String) table name</li>
230 * <li>NON_UNIQUE (boolean) 'true' if non-unique</li>
231 * <li>INDEX_QUALIFIER (String) index catalog</li>
232 * <li>INDEX_NAME (String) index name</li>
233 * <li>TYPE (short) the index type (tableIndexOther or tableIndexHash for
234 * unique indexes on non-nullable columns, tableIndexStatistics for other
235 * indexes)</li>
236 * <li>ORDINAL_POSITION (short) column index (1, 2, ...)</li>
237 * <li>COLUMN_NAME (String) column name</li>
238 * <li>ASC_OR_DESC (String) ascending or descending (always 'A')</li>
239 * <li>CARDINALITY (long) number of rows or numbers of unique values for
240 * unique indexes on non-nullable columns</li>
241 * <li>PAGES (long) number of pages use</li>
242 * <li>FILTER_CONDITION (String) filter condition (always empty)</li>
243 * </ol>
244 *
245 * @param catalog null or the catalog name
246 * @param schema null (to get all objects) or a schema name
247 * (uppercase for unquoted names)
248 * @param table table name (must be specified)
249 * @param unique only unique indexes
250 * @param approximate if true, return fast, but approximate CARDINALITY
251 * @return the list of indexes and columns
252 * @throws SQLException if the connection is closed
253 */
254 @Override
255 public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate)
256 throws SQLException {
257 try {
258 if (isDebugEnabled()) {
259 debugCode("getIndexInfo(" + quote(catalog) + ", " + quote(schema) + ", " + quote(table) + ", " + unique
260 + ", " + approximate + ')');
261 }
262 return getResultSet(meta.getIndexInfo(catalog, schema, table, unique, approximate));
263 } catch (Exception e) {
264 throw logAndConvert(e);
265 }
266 }
267
268 /**
269 * Gets the primary key columns for a table. The result set is sorted by
270 * TABLE_SCHEM, and COLUMN_NAME (and not by KEY_SEQ).
271 *
272 * <ol>
273 * <li>TABLE_CAT (String) table catalog</li>
274 * <li>TABLE_SCHEM (String) table schema</li>
275 * <li>TABLE_NAME (String) table name</li>
276 * <li>COLUMN_NAME (String) column name</li>
277 * <li>KEY_SEQ (short) the column index of this column (1,2,...)</li>
278 * <li>PK_NAME (String) the name of the primary key index</li>
279 * </ol>
280 *
281 * @param catalog null or the catalog name
282 * @param schema null (to get all objects) or a schema name
283 * (uppercase for unquoted names)
284 * @param table table name (must be specified)
285 * @return the list of primary key columns
286 * @throws SQLException if the connection is closed
287 */
288 @Override
289 public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
290 try {
291 if (isDebugEnabled()) {
292 debugCode("getPrimaryKeys(" + quote(catalog) + ", " + quote(schema) + ", " + quote(table) + ')');
293 }
294 return getResultSet(meta.getPrimaryKeys(catalog, schema, table));
295 } catch (Exception e) {
296 throw logAndConvert(e);
297 }
298 }
299
300 /**
301 * Checks if all procedures callable.
302 *
303 * @return true
304 */
305 @Override
306 public boolean allProceduresAreCallable() {
307 debugCodeCall("allProceduresAreCallable");
308 return true;
309 }
310
311 /**
312 * Checks if it possible to query all tables returned by getTables.
313 *
314 * @return true
315 */
316 @Override
317 public boolean allTablesAreSelectable() {
318 debugCodeCall("allTablesAreSelectable");
319 return true;
320 }
321
322 /**
323 * Returns the database URL for this connection.
324 *
325 * @return the url
326 */
327 @Override
328 public String getURL() throws SQLException {
329 try {
330 debugCodeCall("getURL");
331 return conn.getURL();
332 } catch (Exception e) {
333 throw logAndConvert(e);
334 }
335 }
336
337 /**
338 * Returns the user name as passed to DriverManager.getConnection(url, user,
339 * password).
340 *
341 * @return the user name
342 */
343 @Override
344 public String getUserName() throws SQLException {
345 try {
346 debugCodeCall("getUserName");
347 return conn.getUser();
348 } catch (Exception e) {
349 throw logAndConvert(e);
350 }
351 }
352
353 /**
354 * Returns the same as Connection.isReadOnly().
355 *
356 * @return if read only optimization is switched on
357 */
358 @Override
359 public boolean isReadOnly() throws SQLException {
360 try {
361 debugCodeCall("isReadOnly");
362 return conn.isReadOnly();
363 } catch (Exception e) {
364 throw logAndConvert(e);
365 }
366 }
367
368 /**
369 * Checks if NULL values are sorted high (bigger than anything that is not
370 * null).
371 *
372 * @return if NULL values are sorted high
373 */
374 @Override
375 public boolean nullsAreSortedHigh() throws SQLException {
376 try {
377 debugCodeCall("nullsAreSortedHigh");
378 return meta.defaultNullOrdering() == DefaultNullOrdering.HIGH;
379 } catch (Exception e) {
380 throw logAndConvert(e);
381 }
382 }
383
384 /**
385 * Checks if NULL values are sorted low (smaller than anything that is not
386 * null).
387 *
388 * @return if NULL values are sorted low
389 */
390 @Override
391 public boolean nullsAreSortedLow() throws SQLException {
392 try {
393 debugCodeCall("nullsAreSortedLow");
394 return meta.defaultNullOrdering() == DefaultNullOrdering.LOW;
395 } catch (Exception e) {
396 throw logAndConvert(e);
397 }
398 }
399
400 /**
401 * Checks if NULL values are sorted at the beginning (no matter if ASC or
402 * DESC is used).
403 *
404 * @return if NULL values are sorted at the beginning
405 */
406 @Override
407 public boolean nullsAreSortedAtStart() throws SQLException {
408 try {
409 debugCodeCall("nullsAreSortedAtStart");
410 return meta.defaultNullOrdering() == DefaultNullOrdering.FIRST;
411 } catch (Exception e) {
412 throw logAndConvert(e);
413 }
414 }
415
416 /**
417 * Checks if NULL values are sorted at the end (no matter if ASC or DESC is
418 * used).
419 *
420 * @return if NULL values are sorted at the end
421 */
422 @Override
423 public boolean nullsAreSortedAtEnd() throws SQLException {
424 try {
425 debugCodeCall("nullsAreSortedAtEnd");
426 return meta.defaultNullOrdering() == DefaultNullOrdering.LAST;
427 } catch (Exception e) {
428 throw logAndConvert(e);
429 }
430 }
431
432 /**
433 * Returns the connection that created this object.
434 *
435 * @return the connection
436 */
437 @Override
438 public Connection getConnection() {
439 debugCodeCall("getConnection");
440 return conn;
441 }
442
443 /**
444 * Gets the list of procedures. The result set is sorted by PROCEDURE_SCHEM,
445 * PROCEDURE_NAME, and NUM_INPUT_PARAMS. There are potentially multiple
446 * procedures with the same name, each with a different number of input
447 * parameters.
448 *
449 * <ol>
450 * <li>PROCEDURE_CAT (String) catalog</li>
451 * <li>PROCEDURE_SCHEM (String) schema</li>
452 * <li>PROCEDURE_NAME (String) name</li>
453 * <li>reserved</li>
454 * <li>reserved</li>
455 * <li>reserved</li>
456 * <li>REMARKS (String) description</li>
457 * <li>PROCEDURE_TYPE (short) if this procedure returns a result
458 * (procedureNoResult or procedureReturnsResult)</li>
459 * <li>SPECIFIC_NAME (String) non-ambiguous name to distinguish
460 * overloads</li>
461 * </ol>
462 *
463 * @param catalog null or the catalog name
464 * @param schemaPattern null (to get all objects) or a schema name
465 * (uppercase for unquoted names)
466 * @param procedureNamePattern the procedure name pattern
467 * @return the procedures
468 * @throws SQLException if the connection is closed
469 */
470 @Override
471 public ResultSet getProcedures(String catalog, String schemaPattern,
472 String procedureNamePattern) throws SQLException {
473 try {
474 if (isDebugEnabled()) {
475 debugCode("getProcedures("
476 +quote(catalog)+", "
477 +quote(schemaPattern)+", "
478 +quote(procedureNamePattern)+')');
479 }
480 return getResultSet(meta.getProcedures(catalog, schemaPattern, procedureNamePattern));
481 } catch (Exception e) {
482 throw logAndConvert(e);
483 }
484 }
485
486 /**
487 * Gets the list of procedure columns. The result set is sorted by
488 * PROCEDURE_SCHEM, PROCEDURE_NAME, NUM_INPUT_PARAMS, and POS.
489 * There are potentially multiple procedures with the same name, each with a
490 * different number of input parameters.
491 *
492 * <ol>
493 * <li>PROCEDURE_CAT (String) catalog</li>
494 * <li>PROCEDURE_SCHEM (String) schema</li>
495 * <li>PROCEDURE_NAME (String) name</li>
496 * <li>COLUMN_NAME (String) column name</li>
497 * <li>COLUMN_TYPE (short) column type
498 * (always DatabaseMetaData.procedureColumnIn)</li>
499 * <li>DATA_TYPE (short) sql type</li>
500 * <li>TYPE_NAME (String) type name</li>
501 * <li>PRECISION (int) precision</li>
502 * <li>LENGTH (int) length</li>
503 * <li>SCALE (short) scale</li>
504 * <li>RADIX (int)</li>
505 * <li>NULLABLE (short) nullable
506 * (DatabaseMetaData.columnNoNulls for primitive data types,
507 * DatabaseMetaData.columnNullable otherwise)</li>
508 * <li>REMARKS (String) description</li>
509 * <li>COLUMN_DEF (String) always null</li>
510 * <li>SQL_DATA_TYPE (int) for future use</li>
511 * <li>SQL_DATETIME_SUB (int) for future use</li>
512 * <li>CHAR_OCTET_LENGTH (int)</li>
513 * <li>ORDINAL_POSITION (int) the parameter index
514 * starting from 1 (0 is the return value)</li>
515 * <li>IS_NULLABLE (String) always "YES"</li>
516 * <li>SPECIFIC_NAME (String) non-ambiguous procedure name to distinguish
517 * overloads</li>
518 * </ol>
519 *
520 * @param catalog null or the catalog name
521 * @param schemaPattern null (to get all objects) or a schema name
522 * (uppercase for unquoted names)
523 * @param procedureNamePattern the procedure name pattern
524 * @param columnNamePattern the procedure name pattern
525 * @return the procedure columns
526 * @throws SQLException if the connection is closed
527 */
528 @Override
529 public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern,
530 String columnNamePattern) throws SQLException {
531 try {
532 if (isDebugEnabled()) {
533 debugCode("getProcedureColumns(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
534 + quote(procedureNamePattern) + ", " + quote(columnNamePattern) + ')');
535 }
536 checkClosed();
537 return getResultSet(
538 meta.getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern));
539 } catch (Exception e) {
540 throw logAndConvert(e);
541 }
542 }
543
544 /**
545 * Gets the list of schemas.
546 * The result set is sorted by TABLE_SCHEM.
547 *
548 * <ol>
549 * <li>TABLE_SCHEM (String) schema name</li>
550 * <li>TABLE_CATALOG (String) catalog name</li>
551 * </ol>
552 *
553 * @return the schema list
554 * @throws SQLException if the connection is closed
555 */
556 @Override
557 public ResultSet getSchemas() throws SQLException {
558 try {
559 debugCodeCall("getSchemas");
560 return getResultSet(meta.getSchemas());
561 } catch (Exception e) {
562 throw logAndConvert(e);
563 }
564 }
565
566 /**
567 * Gets the list of catalogs.
568 * The result set is sorted by TABLE_CAT.
569 *
570 * <ol>
571 * <li>TABLE_CAT (String) catalog name</li>
572 * </ol>
573 *
574 * @return the catalog list
575 * @throws SQLException if the connection is closed
576 */
577 @Override
578 public ResultSet getCatalogs() throws SQLException {
579 try {
580 debugCodeCall("getCatalogs");
581 return getResultSet(meta.getCatalogs());
582 } catch (Exception e) {
583 throw logAndConvert(e);
584 }
585 }
586
587 /**
588 * Gets the list of table types. This call returns a result set with five
589 * records: "SYSTEM TABLE", "TABLE", "VIEW", "TABLE LINK" and "EXTERNAL".
590 * <ol>
591 * <li>TABLE_TYPE (String) table type</li>
592 * </ol>
593 *
594 * @return the table types
595 * @throws SQLException if the connection is closed
596 */
597 @Override
598 public ResultSet getTableTypes() throws SQLException {
599 try {
600 debugCodeCall("getTableTypes");
601 return getResultSet(meta.getTableTypes());
602 } catch (Exception e) {
603 throw logAndConvert(e);
604 }
605 }
606
607 /**
608 * Gets the list of column privileges. The result set is sorted by
609 * COLUMN_NAME and PRIVILEGE
610 *
611 * <ol>
612 * <li>TABLE_CAT (String) table catalog</li>
613 * <li>TABLE_SCHEM (String) table schema</li>
614 * <li>TABLE_NAME (String) table name</li>
615 * <li>COLUMN_NAME (String) column name</li>
616 * <li>GRANTOR (String) grantor of access</li>
617 * <li>GRANTEE (String) grantee of access</li>
618 * <li>PRIVILEGE (String) SELECT, INSERT, UPDATE, DELETE or REFERENCES
619 * (only one per row)</li>
620 * <li>IS_GRANTABLE (String) YES means the grantee can grant access to
621 * others</li>
622 * </ol>
623 *
624 * @param catalog null (to get all objects) or the catalog name
625 * @param schema null (to get all objects) or a schema name
626 * (uppercase for unquoted names)
627 * @param table a table name (uppercase for unquoted names)
628 * @param columnNamePattern null (to get all objects) or a column name
629 * (uppercase for unquoted names)
630 * @return the list of privileges
631 * @throws SQLException if the connection is closed
632 */
633 @Override
634 public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern)
635 throws SQLException {
636 try {
637 if (isDebugEnabled()) {
638 debugCode("getColumnPrivileges(" + quote(catalog) + ", " + quote(schema) + ", " + quote(table) + ", "
639 + quote(columnNamePattern) + ')');
640 }
641 return getResultSet(meta.getColumnPrivileges(catalog, schema, table, columnNamePattern));
642 } catch (Exception e) {
643 throw logAndConvert(e);
644 }
645 }
646
647 /**
648 * Gets the list of table privileges. The result set is sorted by
649 * TABLE_SCHEM, TABLE_NAME, and PRIVILEGE.
650 *
651 * <ol>
652 * <li>TABLE_CAT (String) table catalog</li>
653 * <li>TABLE_SCHEM (String) table schema</li>
654 * <li>TABLE_NAME (String) table name</li>
655 * <li>GRANTOR (String) grantor of access</li>
656 * <li>GRANTEE (String) grantee of access</li>
657 * <li>PRIVILEGE (String) SELECT, INSERT, UPDATE, DELETE or REFERENCES
658 * (only one per row)</li>
659 * <li>IS_GRANTABLE (String) YES means the grantee can grant access to
660 * others</li>
661 * </ol>
662 *
663 * @param catalog null (to get all objects) or the catalog name
664 * @param schemaPattern null (to get all objects) or a schema name
665 * (uppercase for unquoted names)
666 * @param tableNamePattern null (to get all objects) or a table name
667 * (uppercase for unquoted names)
668 * @return the list of privileges
669 * @throws SQLException if the connection is closed
670 */
671 @Override
672 public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern)
673 throws SQLException {
674 try {
675 if (isDebugEnabled()) {
676 debugCode("getTablePrivileges(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
677 + quote(tableNamePattern) + ')');
678 }
679 checkClosed();
680 return getResultSet(meta.getTablePrivileges(catalog, schemaPattern, tableNamePattern));
681 } catch (Exception e) {
682 throw logAndConvert(e);
683 }
684 }
685
686 /**
687 * Gets the list of columns that best identifier a row in a table.
688 * The list is ordered by SCOPE.
689 *
690 * <ol>
691 * <li>SCOPE (short) scope of result (always bestRowSession)</li>
692 * <li>COLUMN_NAME (String) column name</li>
693 * <li>DATA_TYPE (short) SQL data type, see also java.sql.Types</li>
694 * <li>TYPE_NAME (String) type name</li>
695 * <li>COLUMN_SIZE (int) precision
696 * (values larger than 2 GB are returned as 2 GB)</li>
697 * <li>BUFFER_LENGTH (int) unused</li>
698 * <li>DECIMAL_DIGITS (short) scale</li>
699 * <li>PSEUDO_COLUMN (short) (always bestRowNotPseudo)</li>
700 * </ol>
701 *
702 * @param catalog null (to get all objects) or the catalog name
703 * @param schema null (to get all objects) or a schema name
704 * (uppercase for unquoted names)
705 * @param table table name (must be specified)
706 * @param scope ignored
707 * @param nullable ignored
708 * @return the primary key index
709 * @throws SQLException if the connection is closed
710 */
711 @Override
712 public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable)
713 throws SQLException {
714 try {
715 if (isDebugEnabled()) {
716 debugCode("getBestRowIdentifier(" + quote(catalog) + ", " + quote(schema) + ", " + quote(table) + ", "
717 + scope + ", " + nullable + ')');
718 }
719 return getResultSet(meta.getBestRowIdentifier(catalog, schema, table, scope, nullable));
720 } catch (Exception e) {
721 throw logAndConvert(e);
722 }
723 }
724
725 /**
726 * Get the list of columns that are update when any value is updated.
727 * The result set is always empty.
728 *
729 * <ol>
730 * <li>1 SCOPE (int) not used</li>
731 * <li>2 COLUMN_NAME (String) column name</li>
732 * <li>3 DATA_TYPE (int) SQL data type - see also java.sql.Types</li>
733 * <li>4 TYPE_NAME (String) data type name</li>
734 * <li>5 COLUMN_SIZE (int) precision
735 * (values larger than 2 GB are returned as 2 GB)</li>
736 * <li>6 BUFFER_LENGTH (int) length (bytes)</li>
737 * <li>7 DECIMAL_DIGITS (int) scale</li>
738 * <li>8 PSEUDO_COLUMN (int) is this column a pseudo column</li>
739 * </ol>
740 *
741 * @param catalog null (to get all objects) or the catalog name
742 * @param schema null (to get all objects) or a schema name
743 * @param table table name (must be specified)
744 * @return an empty result set
745 * @throws SQLException if the connection is closed
746 */
747 @Override
748 public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException {
749 try {
750 if (isDebugEnabled()) {
751 debugCode("getVersionColumns(" + quote(catalog) + ", " + quote(schema) + ", " + quote(table) + ')');
752 }
753 return getResultSet(meta.getVersionColumns(catalog, schema, table));
754 } catch (Exception e) {
755 throw logAndConvert(e);
756 }
757 }
758
759 /**
760 * Gets the list of primary key columns that are referenced by a table. The
761 * result set is sorted by PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME,
762 * FK_NAME, KEY_SEQ.
763 *
764 * <ol>
765 * <li>PKTABLE_CAT (String) primary catalog</li>
766 * <li>PKTABLE_SCHEM (String) primary schema</li>
767 * <li>PKTABLE_NAME (String) primary table</li>
768 * <li>PKCOLUMN_NAME (String) primary column</li>
769 * <li>FKTABLE_CAT (String) foreign catalog</li>
770 * <li>FKTABLE_SCHEM (String) foreign schema</li>
771 * <li>FKTABLE_NAME (String) foreign table</li>
772 * <li>FKCOLUMN_NAME (String) foreign column</li>
773 * <li>KEY_SEQ (short) sequence number (1, 2, ...)</li>
774 * <li>UPDATE_RULE (short) action on update (see
775 * DatabaseMetaData.importedKey...)</li>
776 * <li>DELETE_RULE (short) action on delete (see
777 * DatabaseMetaData.importedKey...)</li>
778 * <li>FK_NAME (String) foreign key name</li>
779 * <li>PK_NAME (String) primary key name</li>
780 * <li>DEFERRABILITY (short) deferrable or not (always
781 * importedKeyNotDeferrable)</li>
782 * </ol>
783 *
784 * @param catalog null (to get all objects) or the catalog name
785 * @param schema the schema name of the foreign table
786 * @param table the name of the foreign table
787 * @return the result set
788 * @throws SQLException if the connection is closed
789 */
790 @Override
791 public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException {
792 try {
793 if (isDebugEnabled()) {
794 debugCode("getImportedKeys(" + quote(catalog) + ", " + quote(schema) + ", " + quote(table) + ')');
795 }
796 return getResultSet(meta.getImportedKeys(catalog, schema, table));
797 } catch (Exception e) {
798 throw logAndConvert(e);
799 }
800 }
801
802 /**
803 * Gets the list of foreign key columns that reference a table. The result
804 * set is sorted by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME,
805 * KEY_SEQ.
806 *
807 * <ol>
808 * <li>PKTABLE_CAT (String) primary catalog</li>
809 * <li>PKTABLE_SCHEM (String) primary schema</li>
810 * <li>PKTABLE_NAME (String) primary table</li>
811 * <li>PKCOLUMN_NAME (String) primary column</li>
812 * <li>FKTABLE_CAT (String) foreign catalog</li>
813 * <li>FKTABLE_SCHEM (String) foreign schema</li>
814 * <li>FKTABLE_NAME (String) foreign table</li>
815 * <li>FKCOLUMN_NAME (String) foreign column</li>
816 * <li>KEY_SEQ (short) sequence number (1,2,...)</li>
817 * <li>UPDATE_RULE (short) action on update (see
818 * DatabaseMetaData.importedKey...)</li>
819 * <li>DELETE_RULE (short) action on delete (see
820 * DatabaseMetaData.importedKey...)</li>
821 * <li>FK_NAME (String) foreign key name</li>
822 * <li>PK_NAME (String) primary key name</li>
823 * <li>DEFERRABILITY (short) deferrable or not (always
824 * importedKeyNotDeferrable)</li>
825 * </ol>
826 *
827 * @param catalog null or the catalog name
828 * @param schema the schema name of the primary table
829 * @param table the name of the primary table
830 * @return the result set
831 * @throws SQLException if the connection is closed
832 */
833 @Override
834 public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
835 try {
836 if (isDebugEnabled()) {
837 debugCode("getExportedKeys(" + quote(catalog) + ", " + quote(schema) + ", " + quote(table) + ')');
838 }
839 return getResultSet(meta.getExportedKeys(catalog, schema, table));
840 } catch (Exception e) {
841 throw logAndConvert(e);
842 }
843 }
844
845 /**
846 * Gets the list of foreign key columns that references a table, as well as
847 * the list of primary key columns that are references by a table. The
848 * result set is sorted by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME,
849 * FK_NAME, KEY_SEQ.
850 *
851 * <ol>
852 * <li>PKTABLE_CAT (String) primary catalog</li>
853 * <li>PKTABLE_SCHEM (String) primary schema</li>
854 * <li>PKTABLE_NAME (String) primary table</li>
855 * <li>PKCOLUMN_NAME (String) primary column</li>
856 * <li>FKTABLE_CAT (String) foreign catalog</li>
857 * <li>FKTABLE_SCHEM (String) foreign schema</li>
858 * <li>FKTABLE_NAME (String) foreign table</li>
859 * <li>FKCOLUMN_NAME (String) foreign column</li>
860 * <li>KEY_SEQ (short) sequence number (1,2,...)</li>
861 * <li>UPDATE_RULE (short) action on update (see
862 * DatabaseMetaData.importedKey...)</li>
863 * <li>DELETE_RULE (short) action on delete (see
864 * DatabaseMetaData.importedKey...)</li>
865 * <li>FK_NAME (String) foreign key name</li>
866 * <li>PK_NAME (String) primary key name</li>
867 * <li>DEFERRABILITY (short) deferrable or not (always
868 * importedKeyNotDeferrable)</li>
869 * </ol>
870 *
871 * @param primaryCatalog null or the catalog name
872 * @param primarySchema the schema name of the primary table
873 * (optional)
874 * @param primaryTable the name of the primary table (must be specified)
875 * @param foreignCatalog null or the catalog name
876 * @param foreignSchema the schema name of the foreign table
877 * (optional)
878 * @param foreignTable the name of the foreign table (must be specified)
879 * @return the result set
880 * @throws SQLException if the connection is closed
881 */
882 @Override
883 public ResultSet getCrossReference(String primaryCatalog, String primarySchema, String primaryTable,
884 String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException {
885 try {
886 if (isDebugEnabled()) {
887 debugCode("getCrossReference(" + quote(primaryCatalog) + ", " + quote(primarySchema) + ", "
888 + quote(primaryTable) + ", " + quote(foreignCatalog) + ", " + quote(foreignSchema) + ", "
889 + quote(foreignTable) + ')');
890 }
891 return getResultSet(meta.getCrossReference(primaryCatalog, primarySchema, primaryTable, foreignCatalog,
892 foreignSchema, foreignTable));
893 } catch (Exception e) {
894 throw logAndConvert(e);
895 }
896 }
897
898 /**
899 * Gets the list of user-defined data types.
900 * This call returns an empty result set.
901 *
902 * <ol>
903 * <li>TYPE_CAT (String) catalog</li>
904 * <li>TYPE_SCHEM (String) schema</li>
905 * <li>TYPE_NAME (String) type name</li>
906 * <li>CLASS_NAME (String) Java class</li>
907 * <li>DATA_TYPE (short) SQL Type - see also java.sql.Types</li>
908 * <li>REMARKS (String) description</li>
909 * <li>BASE_TYPE (short) base type - see also java.sql.Types</li>
910 * </ol>
911 *
912 * @param catalog ignored
913 * @param schemaPattern ignored
914 * @param typeNamePattern ignored
915 * @param types ignored
916 * @return an empty result set
917 * @throws SQLException if the connection is closed
918 */
919 @Override
920 public ResultSet getUDTs(String catalog, String schemaPattern,
921 String typeNamePattern, int[] types) throws SQLException {
922 try {
923 if (isDebugEnabled()) {
924 debugCode("getUDTs("
925 +quote(catalog)+", "
926 +quote(schemaPattern)+", "
927 +quote(typeNamePattern)+", "
928 +quoteIntArray(types)+')');
929 }
930 return getResultSet(meta.getUDTs(catalog, schemaPattern, typeNamePattern, types));
931 } catch (Exception e) {
932 throw logAndConvert(e);
933 }
934 }
935
936 /**
937 * Gets the list of data types. The result set is sorted by DATA_TYPE and
938 * afterwards by how closely the data type maps to the corresponding JDBC
939 * SQL type (best match first).
940 *
941 * <ol>
942 * <li>TYPE_NAME (String) type name</li>
943 * <li>DATA_TYPE (short) SQL data type - see also java.sql.Types</li>
944 * <li>PRECISION (int) maximum precision</li>
945 * <li>LITERAL_PREFIX (String) prefix used to quote a literal</li>
946 * <li>LITERAL_SUFFIX (String) suffix used to quote a literal</li>
947 * <li>CREATE_PARAMS (String) parameters used (may be null)</li>
948 * <li>NULLABLE (short) typeNoNulls (NULL not allowed) or typeNullable</li>
949 * <li>CASE_SENSITIVE (boolean) case sensitive</li>
950 * <li>SEARCHABLE (short) typeSearchable</li>
951 * <li>UNSIGNED_ATTRIBUTE (boolean) unsigned</li>
952 * <li>FIXED_PREC_SCALE (boolean) fixed precision</li>
953 * <li>AUTO_INCREMENT (boolean) auto increment</li>
954 * <li>LOCAL_TYPE_NAME (String) localized version of the data type</li>
955 * <li>MINIMUM_SCALE (short) minimum scale</li>
956 * <li>MAXIMUM_SCALE (short) maximum scale</li>
957 * <li>SQL_DATA_TYPE (int) unused</li>
958 * <li>SQL_DATETIME_SUB (int) unused</li>
959 * <li>NUM_PREC_RADIX (int) 2 for binary, 10 for decimal</li>
960 * </ol>
961 *
962 * @return the list of data types
963 * @throws SQLException if the connection is closed
964 */
965 @Override
966 public ResultSet getTypeInfo() throws SQLException {
967 try {
968 debugCodeCall("getTypeInfo");
969 return getResultSet(meta.getTypeInfo());
970 } catch (Exception e) {
971 throw logAndConvert(e);
972 }
973 }
974
975 /**
976 * Checks if this database store data in local files.
977 *
978 * @return true
979 */
980 @Override
981 public boolean usesLocalFiles() {
982 debugCodeCall("usesLocalFiles");
983 return true;
984 }
985
986 /**
987 * Checks if this database use one file per table.
988 *
989 * @return false
990 */
991 @Override
992 public boolean usesLocalFilePerTable() {
993 debugCodeCall("usesLocalFilePerTable");
994 return false;
995 }
996
997 /**
998 * Returns the string used to quote identifiers.
999 *
1000 * @return a double quote
1001 */
1002 @Override
1003 public String getIdentifierQuoteString() {
1004 debugCodeCall("getIdentifierQuoteString");
1005 return "\"";
1006 }
1007
1008 /**
1009 * Gets the comma-separated list of all SQL keywords that are not supported
1010 * as unquoted identifiers, in addition to the SQL:2003 reserved words.
1011 * <p>
1012 * List of keywords in H2 may depend on compatibility mode and other
1013 * settings.
1014 * </p>
1015 *
1016 * @return a list of additional keywords
1017 */
1018 @Override
1019 public String getSQLKeywords() throws SQLException {
1020 try {
1021 debugCodeCall("getSQLKeywords");
1022 return meta.getSQLKeywords();
1023 } catch (Exception e) {
1024 throw logAndConvert(e);
1025 }
1026 }
1027
1028 /**
1029 * Returns the list of numeric functions supported by this database.
1030 *
1031 * @return the list
1032 */
1033 @Override
1034 public String getNumericFunctions() throws SQLException {
1035 try {
1036 debugCodeCall("getNumericFunctions");
1037 return meta.getNumericFunctions();
1038 } catch (Exception e) {
1039 throw logAndConvert(e);
1040 }
1041 }
1042
1043 /**
1044 * Returns the list of string functions supported by this database.
1045 *
1046 * @return the list
1047 */
1048 @Override
1049 public String getStringFunctions() throws SQLException {
1050 try {
1051 debugCodeCall("getStringFunctions");
1052 return meta.getStringFunctions();
1053 } catch (Exception e) {
1054 throw logAndConvert(e);
1055 }
1056 }
1057
1058 /**
1059 * Returns the list of system functions supported by this database.
1060 *
1061 * @return the list
1062 */
1063 @Override
1064 public String getSystemFunctions() throws SQLException {
1065 try {
1066 debugCodeCall("getSystemFunctions");
1067 return meta.getSystemFunctions();
1068 } catch (Exception e) {
1069 throw logAndConvert(e);
1070 }
1071 }
1072
1073 /**
1074 * Returns the list of date and time functions supported by this database.
1075 *
1076 * @return the list
1077 */
1078 @Override
1079 public String getTimeDateFunctions() throws SQLException {
1080 try {
1081 debugCodeCall("getTimeDateFunctions");
1082 return meta.getTimeDateFunctions();
1083 } catch (Exception e) {
1084 throw logAndConvert(e);
1085 }
1086 }
1087
1088 /**
1089 * Returns the default escape character for DatabaseMetaData search
1090 * patterns.
1091 *
1092 * @return the default escape character (always '\', independent on the
1093 * mode)
1094 */
1095 @Override
1096 public String getSearchStringEscape() throws SQLException {
1097 try {
1098 debugCodeCall("getSearchStringEscape");
1099 return meta.getSearchStringEscape();
1100 } catch (Exception e) {
1101 throw logAndConvert(e);
1102 }
1103 }
1104
1105 /**
1106 * Returns the characters that are allowed for identifiers in addiction to
1107 * A-Z, a-z, 0-9 and '_'.
1108 *
1109 * @return an empty String ("")
1110 */
1111 @Override
1112 public String getExtraNameCharacters() {
1113 debugCodeCall("getExtraNameCharacters");
1114 return "";
1115 }
1116
1117 /**
1118 * Returns whether alter table with add column is supported.
1119 *
1120 * @return true
1121 */
1122 @Override
1123 public boolean supportsAlterTableWithAddColumn() {
1124 debugCodeCall("supportsAlterTableWithAddColumn");
1125 return true;
1126 }
1127
1128 /**
1129 * Returns whether alter table with drop column is supported.
1130 *
1131 * @return true
1132 */
1133 @Override
1134 public boolean supportsAlterTableWithDropColumn() {
1135 debugCodeCall("supportsAlterTableWithDropColumn");
1136 return true;
1137 }
1138
1139 /**
1140 * Returns whether column aliasing is supported.
1141 *
1142 * @return true
1143 */
1144 @Override
1145 public boolean supportsColumnAliasing() {
1146 debugCodeCall("supportsColumnAliasing");
1147 return true;
1148 }
1149
1150 /**
1151 * Returns whether NULL+1 is NULL or not.
1152 *
1153 * @return true
1154 */
1155 @Override
1156 public boolean nullPlusNonNullIsNull() {
1157 debugCodeCall("nullPlusNonNullIsNull");
1158 return true;
1159 }
1160
1161 /**
1162 * Returns whether CONVERT is supported.
1163 *
1164 * @return true
1165 */
1166 @Override
1167 public boolean supportsConvert() {
1168 debugCodeCall("supportsConvert");
1169 return true;
1170 }
1171
1172 /**
1173 * Returns whether CONVERT is supported for one datatype to another.
1174 *
1175 * @param fromType the source SQL type
1176 * @param toType the target SQL type
1177 * @return true
1178 */
1179 @Override
1180 public boolean supportsConvert(int fromType, int toType) {
1181 if (isDebugEnabled()) {
1182 debugCode("supportsConvert(" + fromType + ", " + toType + ')');
1183 }
1184 return true;
1185 }
1186
1187 /**
1188 * Returns whether table correlation names (table alias) are supported.
1189 *
1190 * @return true
1191 */
1192 @Override
1193 public boolean supportsTableCorrelationNames() {
1194 debugCodeCall("supportsTableCorrelationNames");
1195 return true;
1196 }
1197
1198 /**
1199 * Returns whether table correlation names (table alias) are restricted to
1200 * be different than table names.
1201 *
1202 * @return false
1203 */
1204 @Override
1205 public boolean supportsDifferentTableCorrelationNames() {
1206 debugCodeCall("supportsDifferentTableCorrelationNames");
1207 return false;
1208 }
1209
1210 /**
1211 * Returns whether expression in ORDER BY are supported.
1212 *
1213 * @return true
1214 */
1215 @Override
1216 public boolean supportsExpressionsInOrderBy() {
1217 debugCodeCall("supportsExpressionsInOrderBy");
1218 return true;
1219 }
1220
1221 /**
1222 * Returns whether ORDER BY is supported if the column is not in the SELECT
1223 * list.
1224 *
1225 * @return true
1226 */
1227 @Override
1228 public boolean supportsOrderByUnrelated() {
1229 debugCodeCall("supportsOrderByUnrelated");
1230 return true;
1231 }
1232
1233 /**
1234 * Returns whether GROUP BY is supported.
1235 *
1236 * @return true
1237 */
1238 @Override
1239 public boolean supportsGroupBy() {
1240 debugCodeCall("supportsGroupBy");
1241 return true;
1242 }
1243
1244 /**
1245 * Returns whether GROUP BY is supported if the column is not in the SELECT
1246 * list.
1247 *
1248 * @return true
1249 */
1250 @Override
1251 public boolean supportsGroupByUnrelated() {
1252 debugCodeCall("supportsGroupByUnrelated");
1253 return true;
1254 }
1255
1256 /**
1257 * Checks whether a GROUP BY clause can use columns that are not in the
1258 * SELECT clause, provided that it specifies all the columns in the SELECT
1259 * clause.
1260 *
1261 * @return true
1262 */
1263 @Override
1264 public boolean supportsGroupByBeyondSelect() {
1265 debugCodeCall("supportsGroupByBeyondSelect");
1266 return true;
1267 }
1268
1269 /**
1270 * Returns whether LIKE... ESCAPE is supported.
1271 *
1272 * @return true
1273 */
1274 @Override
1275 public boolean supportsLikeEscapeClause() {
1276 debugCodeCall("supportsLikeEscapeClause");
1277 return true;
1278 }
1279
1280 /**
1281 * Returns whether multiple result sets are supported.
1282 *
1283 * @return false
1284 */
1285 @Override
1286 public boolean supportsMultipleResultSets() {
1287 debugCodeCall("supportsMultipleResultSets");
1288 return false;
1289 }
1290
1291 /**
1292 * Returns whether multiple transactions (on different connections) are
1293 * supported.
1294 *
1295 * @return true
1296 */
1297 @Override
1298 public boolean supportsMultipleTransactions() {
1299 debugCodeCall("supportsMultipleTransactions");
1300 return true;
1301 }
1302
1303 /**
1304 * Returns whether columns with NOT NULL are supported.
1305 *
1306 * @return true
1307 */
1308 @Override
1309 public boolean supportsNonNullableColumns() {
1310 debugCodeCall("supportsNonNullableColumns");
1311 return true;
1312 }
1313
1314 /**
1315 * Returns whether ODBC Minimum SQL grammar is supported.
1316 *
1317 * @return true
1318 */
1319 @Override
1320 public boolean supportsMinimumSQLGrammar() {
1321 debugCodeCall("supportsMinimumSQLGrammar");
1322 return true;
1323 }
1324
1325 /**
1326 * Returns whether ODBC Core SQL grammar is supported.
1327 *
1328 * @return true
1329 */
1330 @Override
1331 public boolean supportsCoreSQLGrammar() {
1332 debugCodeCall("supportsCoreSQLGrammar");
1333 return true;
1334 }
1335
1336 /**
1337 * Returns whether ODBC Extended SQL grammar is supported.
1338 *
1339 * @return false
1340 */
1341 @Override
1342 public boolean supportsExtendedSQLGrammar() {
1343 debugCodeCall("supportsExtendedSQLGrammar");
1344 return false;
1345 }
1346
1347 /**
1348 * Returns whether SQL-92 entry level grammar is supported.
1349 *
1350 * @return true
1351 */
1352 @Override
1353 public boolean supportsANSI92EntryLevelSQL() {
1354 debugCodeCall("supportsANSI92EntryLevelSQL");
1355 return true;
1356 }
1357
1358 /**
1359 * Returns whether SQL-92 intermediate level grammar is supported.
1360 *
1361 * @return false
1362 */
1363 @Override
1364 public boolean supportsANSI92IntermediateSQL() {
1365 debugCodeCall("supportsANSI92IntermediateSQL");
1366 return false;
1367 }
1368
1369 /**
1370 * Returns whether SQL-92 full level grammar is supported.
1371 *
1372 * @return false
1373 */
1374 @Override
1375 public boolean supportsANSI92FullSQL() {
1376 debugCodeCall("supportsANSI92FullSQL");
1377 return false;
1378 }
1379
1380 /**
1381 * Returns whether referential integrity is supported.
1382 *
1383 * @return true
1384 */
1385 @Override
1386 public boolean supportsIntegrityEnhancementFacility() {
1387 debugCodeCall("supportsIntegrityEnhancementFacility");
1388 return true;
1389 }
1390
1391 /**
1392 * Returns whether outer joins are supported.
1393 *
1394 * @return true
1395 */
1396 @Override
1397 public boolean supportsOuterJoins() {
1398 debugCodeCall("supportsOuterJoins");
1399 return true;
1400 }
1401
1402 /**
1403 * Returns whether full outer joins are supported.
1404 *
1405 * @return false
1406 */
1407 @Override
1408 public boolean supportsFullOuterJoins() {
1409 debugCodeCall("supportsFullOuterJoins");
1410 return false;
1411 }
1412
1413 /**
1414 * Returns whether limited outer joins are supported.
1415 *
1416 * @return true
1417 */
1418 @Override
1419 public boolean supportsLimitedOuterJoins() {
1420 debugCodeCall("supportsLimitedOuterJoins");
1421 return true;
1422 }
1423
1424 /**
1425 * Returns the term for "schema".
1426 *
1427 * @return "schema"
1428 */
1429 @Override
1430 public String getSchemaTerm() {
1431 debugCodeCall("getSchemaTerm");
1432 return "schema";
1433 }
1434
1435 /**
1436 * Returns the term for "procedure".
1437 *
1438 * @return "procedure"
1439 */
1440 @Override
1441 public String getProcedureTerm() {
1442 debugCodeCall("getProcedureTerm");
1443 return "procedure";
1444 }
1445
1446 /**
1447 * Returns the term for "catalog".
1448 *
1449 * @return "catalog"
1450 */
1451 @Override
1452 public String getCatalogTerm() {
1453 debugCodeCall("getCatalogTerm");
1454 return "catalog";
1455 }
1456
1457 /**
1458 * Returns whether the catalog is at the beginning.
1459 *
1460 * @return true
1461 */
1462 @Override
1463 public boolean isCatalogAtStart() {
1464 debugCodeCall("isCatalogAtStart");
1465 return true;
1466 }
1467
1468 /**
1469 * Returns the catalog separator.
1470 *
1471 * @return "."
1472 */
1473 @Override
1474 public String getCatalogSeparator() {
1475 debugCodeCall("getCatalogSeparator");
1476 return ".";
1477 }
1478
1479 /**
1480 * Returns whether the schema name in INSERT, UPDATE, DELETE is supported.
1481 *
1482 * @return true
1483 */
1484 @Override
1485 public boolean supportsSchemasInDataManipulation() {
1486 debugCodeCall("supportsSchemasInDataManipulation");
1487 return true;
1488 }
1489
1490 /**
1491 * Returns whether the schema name in procedure calls is supported.
1492 *
1493 * @return true
1494 */
1495 @Override
1496 public boolean supportsSchemasInProcedureCalls() {
1497 debugCodeCall("supportsSchemasInProcedureCalls");
1498 return true;
1499 }
1500
1501 /**
1502 * Returns whether the schema name in CREATE TABLE is supported.
1503 *
1504 * @return true
1505 */
1506 @Override
1507 public boolean supportsSchemasInTableDefinitions() {
1508 debugCodeCall("supportsSchemasInTableDefinitions");
1509 return true;
1510 }
1511
1512 /**
1513 * Returns whether the schema name in CREATE INDEX is supported.
1514 *
1515 * @return true
1516 */
1517 @Override
1518 public boolean supportsSchemasInIndexDefinitions() {
1519 debugCodeCall("supportsSchemasInIndexDefinitions");
1520 return true;
1521 }
1522
1523 /**
1524 * Returns whether the schema name in GRANT is supported.
1525 *
1526 * @return true
1527 */
1528 @Override
1529 public boolean supportsSchemasInPrivilegeDefinitions() {
1530 debugCodeCall("supportsSchemasInPrivilegeDefinitions");
1531 return true;
1532 }
1533
1534 /**
1535 * Returns whether the catalog name in INSERT, UPDATE, DELETE is supported.
1536 *
1537 * @return true
1538 */
1539 @Override
1540 public boolean supportsCatalogsInDataManipulation() {
1541 debugCodeCall("supportsCatalogsInDataManipulation");
1542 return true;
1543 }
1544
1545 /**
1546 * Returns whether the catalog name in procedure calls is supported.
1547 *
1548 * @return false
1549 */
1550 @Override
1551 public boolean supportsCatalogsInProcedureCalls() {
1552 debugCodeCall("supportsCatalogsInProcedureCalls");
1553 return false;
1554 }
1555
1556 /**
1557 * Returns whether the catalog name in CREATE TABLE is supported.
1558 *
1559 * @return true
1560 */
1561 @Override
1562 public boolean supportsCatalogsInTableDefinitions() {
1563 debugCodeCall("supportsCatalogsInTableDefinitions");
1564 return true;
1565 }
1566
1567 /**
1568 * Returns whether the catalog name in CREATE INDEX is supported.
1569 *
1570 * @return true
1571 */
1572 @Override
1573 public boolean supportsCatalogsInIndexDefinitions() {
1574 debugCodeCall("supportsCatalogsInIndexDefinitions");
1575 return true;
1576 }
1577
1578 /**
1579 * Returns whether the catalog name in GRANT is supported.
1580 *
1581 * @return true
1582 */
1583 @Override
1584 public boolean supportsCatalogsInPrivilegeDefinitions() {
1585 debugCodeCall("supportsCatalogsInPrivilegeDefinitions");
1586 return true;
1587 }
1588
1589 /**
1590 * Returns whether positioned deletes are supported.
1591 *
1592 * @return false
1593 */
1594 @Override
1595 public boolean supportsPositionedDelete() {
1596 debugCodeCall("supportsPositionedDelete");
1597 return false;
1598 }
1599
1600 /**
1601 * Returns whether positioned updates are supported.
1602 *
1603 * @return false
1604 */
1605 @Override
1606 public boolean supportsPositionedUpdate() {
1607 debugCodeCall("supportsPositionedUpdate");
1608 return false;
1609 }
1610
1611 /**
1612 * Returns whether SELECT ... FOR UPDATE is supported.
1613 *
1614 * @return true
1615 */
1616 @Override
1617 public boolean supportsSelectForUpdate() {
1618 debugCodeCall("supportsSelectForUpdate");
1619 return true;
1620 }
1621
1622 /**
1623 * Returns whether stored procedures are supported.
1624 *
1625 * @return false
1626 */
1627 @Override
1628 public boolean supportsStoredProcedures() {
1629 debugCodeCall("supportsStoredProcedures");
1630 return false;
1631 }
1632
1633 /**
1634 * Returns whether subqueries (SELECT) in comparisons are supported.
1635 *
1636 * @return true
1637 */
1638 @Override
1639 public boolean supportsSubqueriesInComparisons() {
1640 debugCodeCall("supportsSubqueriesInComparisons");
1641 return true;
1642 }
1643
1644 /**
1645 * Returns whether SELECT in EXISTS is supported.
1646 *
1647 * @return true
1648 */
1649 @Override
1650 public boolean supportsSubqueriesInExists() {
1651 debugCodeCall("supportsSubqueriesInExists");
1652 return true;
1653 }
1654
1655 /**
1656 * Returns whether IN(SELECT...) is supported.
1657 *
1658 * @return true
1659 */
1660 @Override
1661 public boolean supportsSubqueriesInIns() {
1662 debugCodeCall("supportsSubqueriesInIns");
1663 return true;
1664 }
1665
1666 /**
1667 * Returns whether subqueries in quantified expression are supported.
1668 *
1669 * @return true
1670 */
1671 @Override
1672 public boolean supportsSubqueriesInQuantifieds() {
1673 debugCodeCall("supportsSubqueriesInQuantifieds");
1674 return true;
1675 }
1676
1677 /**
1678 * Returns whether correlated subqueries are supported.
1679 *
1680 * @return true
1681 */
1682 @Override
1683 public boolean supportsCorrelatedSubqueries() {
1684 debugCodeCall("supportsCorrelatedSubqueries");
1685 return true;
1686 }
1687
1688 /**
1689 * Returns whether UNION SELECT is supported.
1690 *
1691 * @return true
1692 */
1693 @Override
1694 public boolean supportsUnion() {
1695 debugCodeCall("supportsUnion");
1696 return true;
1697 }
1698
1699 /**
1700 * Returns whether UNION ALL SELECT is supported.
1701 *
1702 * @return true
1703 */
1704 @Override
1705 public boolean supportsUnionAll() {
1706 debugCodeCall("supportsUnionAll");
1707 return true;
1708 }
1709
1710 /**
1711 * Returns whether open result sets across commits are supported.
1712 *
1713 * @return false
1714 */
1715 @Override
1716 public boolean supportsOpenCursorsAcrossCommit() {
1717 debugCodeCall("supportsOpenCursorsAcrossCommit");
1718 return false;
1719 }
1720
1721 /**
1722 * Returns whether open result sets across rollback are supported.
1723 *
1724 * @return false
1725 */
1726 @Override
1727 public boolean supportsOpenCursorsAcrossRollback() {
1728 debugCodeCall("supportsOpenCursorsAcrossRollback");
1729 return false;
1730 }
1731
1732 /**
1733 * Returns whether open statements across commit are supported.
1734 *
1735 * @return true
1736 */
1737 @Override
1738 public boolean supportsOpenStatementsAcrossCommit() {
1739 debugCodeCall("supportsOpenStatementsAcrossCommit");
1740 return true;
1741 }
1742
1743 /**
1744 * Returns whether open statements across rollback are supported.
1745 *
1746 * @return true
1747 */
1748 @Override
1749 public boolean supportsOpenStatementsAcrossRollback() {
1750 debugCodeCall("supportsOpenStatementsAcrossRollback");
1751 return true;
1752 }
1753
1754 /**
1755 * Returns whether transactions are supported.
1756 *
1757 * @return true
1758 */
1759 @Override
1760 public boolean supportsTransactions() {
1761 debugCodeCall("supportsTransactions");
1762 return true;
1763 }
1764
1765 /**
1766 * Returns whether a specific transaction isolation level is supported.
1767 *
1768 * @param level the transaction isolation level (Connection.TRANSACTION_*)
1769 * @return true
1770 */
1771 @Override
1772 public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
1773 debugCodeCall("supportsTransactionIsolationLevel");
1774 switch (level) {
1775 case Connection.TRANSACTION_READ_UNCOMMITTED:
1776 case Connection.TRANSACTION_READ_COMMITTED:
1777 case Connection.TRANSACTION_REPEATABLE_READ:
1778 case Constants.TRANSACTION_SNAPSHOT:
1779 case Connection.TRANSACTION_SERIALIZABLE:
1780 return true;
1781 default:
1782 return false;
1783 }
1784 }
1785
1786 /**
1787 * Returns whether data manipulation and CREATE/DROP is supported in
1788 * transactions.
1789 *
1790 * @return false
1791 */
1792 @Override
1793 public boolean supportsDataDefinitionAndDataManipulationTransactions() {
1794 debugCodeCall("supportsDataDefinitionAndDataManipulationTransactions");
1795 return false;
1796 }
1797
1798 /**
1799 * Returns whether only data manipulations are supported in transactions.
1800 *
1801 * @return true
1802 */
1803 @Override
1804 public boolean supportsDataManipulationTransactionsOnly() {
1805 debugCodeCall("supportsDataManipulationTransactionsOnly");
1806 return true;
1807 }
1808
1809 /**
1810 * Returns whether CREATE/DROP commit an open transaction.
1811 *
1812 * @return true
1813 */
1814 @Override
1815 public boolean dataDefinitionCausesTransactionCommit() {
1816 debugCodeCall("dataDefinitionCausesTransactionCommit");
1817 return true;
1818 }
1819
1820 /**
1821 * Returns whether CREATE/DROP do not affect transactions.
1822 *
1823 * @return false
1824 */
1825 @Override
1826 public boolean dataDefinitionIgnoredInTransactions() {
1827 debugCodeCall("dataDefinitionIgnoredInTransactions");
1828 return false;
1829 }
1830
1831 /**
1832 * Returns whether a specific result set type is supported.
1833 * ResultSet.TYPE_SCROLL_SENSITIVE is not supported.
1834 *
1835 * @param type the result set type
1836 * @return true for all types except ResultSet.TYPE_SCROLL_SENSITIVE
1837 */
1838 @Override
1839 public boolean supportsResultSetType(int type) {
1840 debugCodeCall("supportsResultSetType", type);
1841 return type != ResultSet.TYPE_SCROLL_SENSITIVE;
1842 }
1843
1844 /**
1845 * Returns whether a specific result set concurrency is supported.
1846 * ResultSet.TYPE_SCROLL_SENSITIVE is not supported.
1847 *
1848 * @param type the result set type
1849 * @param concurrency the result set concurrency
1850 * @return true if the type is not ResultSet.TYPE_SCROLL_SENSITIVE
1851 */
1852 @Override
1853 public boolean supportsResultSetConcurrency(int type, int concurrency) {
1854 if (isDebugEnabled()) {
1855 debugCode("supportsResultSetConcurrency(" + type + ", " + concurrency + ')');
1856 }
1857 return type != ResultSet.TYPE_SCROLL_SENSITIVE;
1858 }
1859
1860 /**
1861 * Returns whether own updates are visible.
1862 *
1863 * @param type the result set type
1864 * @return true
1865 */
1866 @Override
1867 public boolean ownUpdatesAreVisible(int type) {
1868 debugCodeCall("ownUpdatesAreVisible", type);
1869 return true;
1870 }
1871
1872 /**
1873 * Returns whether own deletes are visible.
1874 *
1875 * @param type the result set type
1876 * @return false
1877 */
1878 @Override
1879 public boolean ownDeletesAreVisible(int type) {
1880 debugCodeCall("ownDeletesAreVisible", type);
1881 return false;
1882 }
1883
1884 /**
1885 * Returns whether own inserts are visible.
1886 *
1887 * @param type the result set type
1888 * @return false
1889 */
1890 @Override
1891 public boolean ownInsertsAreVisible(int type) {
1892 debugCodeCall("ownInsertsAreVisible", type);
1893 return false;
1894 }
1895
1896 /**
1897 * Returns whether other updates are visible.
1898 *
1899 * @param type the result set type
1900 * @return false
1901 */
1902 @Override
1903 public boolean othersUpdatesAreVisible(int type) {
1904 debugCodeCall("othersUpdatesAreVisible", type);
1905 return false;
1906 }
1907
1908 /**
1909 * Returns whether other deletes are visible.
1910 *
1911 * @param type the result set type
1912 * @return false
1913 */
1914 @Override
1915 public boolean othersDeletesAreVisible(int type) {
1916 debugCodeCall("othersDeletesAreVisible", type);
1917 return false;
1918 }
1919
1920 /**
1921 * Returns whether other inserts are visible.
1922 *
1923 * @param type the result set type
1924 * @return false
1925 */
1926 @Override
1927 public boolean othersInsertsAreVisible(int type) {
1928 debugCodeCall("othersInsertsAreVisible", type);
1929 return false;
1930 }
1931
1932 /**
1933 * Returns whether updates are detected.
1934 *
1935 * @param type the result set type
1936 * @return false
1937 */
1938 @Override
1939 public boolean updatesAreDetected(int type) {
1940 debugCodeCall("updatesAreDetected", type);
1941 return false;
1942 }
1943
1944 /**
1945 * Returns whether deletes are detected.
1946 *
1947 * @param type the result set type
1948 * @return false
1949 */
1950 @Override
1951 public boolean deletesAreDetected(int type) {
1952 debugCodeCall("deletesAreDetected", type);
1953 return false;
1954 }
1955
1956 /**
1957 * Returns whether inserts are detected.
1958 *
1959 * @param type the result set type
1960 * @return false
1961 */
1962 @Override
1963 public boolean insertsAreDetected(int type) {
1964 debugCodeCall("insertsAreDetected", type);
1965 return false;
1966 }
1967
1968 /**
1969 * Returns whether batch updates are supported.
1970 *
1971 * @return true
1972 */
1973 @Override
1974 public boolean supportsBatchUpdates() {
1975 debugCodeCall("supportsBatchUpdates");
1976 return true;
1977 }
1978
1979 /**
1980 * Returns whether the maximum row size includes blobs.
1981 *
1982 * @return false
1983 */
1984 @Override
1985 public boolean doesMaxRowSizeIncludeBlobs() {
1986 debugCodeCall("doesMaxRowSizeIncludeBlobs");
1987 return false;
1988 }
1989
1990 /**
1991 * Returns the default transaction isolation level.
1992 *
1993 * @return Connection.TRANSACTION_READ_COMMITTED
1994 */
1995 @Override
1996 public int getDefaultTransactionIsolation() {
1997 debugCodeCall("getDefaultTransactionIsolation");
1998 return Connection.TRANSACTION_READ_COMMITTED;
1999 }
2000
2001 /**
2002 * Checks if for CREATE TABLE Test(ID INT), getTables returns Test as the
2003 * table name and identifiers are case sensitive.
2004 *
2005 * @return true is so, false otherwise
2006 */
2007 @Override
2008 public boolean supportsMixedCaseIdentifiers() throws SQLException {
2009 debugCodeCall("supportsMixedCaseIdentifiers");
2010 Session.StaticSettings settings = conn.getStaticSettings();
2011 return !settings.databaseToUpper && !settings.databaseToLower && !settings.caseInsensitiveIdentifiers;
2012 }
2013
2014 /**
2015 * Checks if for CREATE TABLE Test(ID INT), getTables returns TEST as the
2016 * table name.
2017 *
2018 * @return true is so, false otherwise
2019 */
2020 @Override
2021 public boolean storesUpperCaseIdentifiers() throws SQLException {
2022 debugCodeCall("storesUpperCaseIdentifiers");
2023 return conn.getStaticSettings().databaseToUpper;
2024 }
2025
2026 /**
2027 * Checks if for CREATE TABLE Test(ID INT), getTables returns test as the
2028 * table name.
2029 *
2030 * @return true is so, false otherwise
2031 */
2032 @Override
2033 public boolean storesLowerCaseIdentifiers() throws SQLException {
2034 debugCodeCall("storesLowerCaseIdentifiers");
2035 return conn.getStaticSettings().databaseToLower;
2036 }
2037
2038 /**
2039 * Checks if for CREATE TABLE Test(ID INT), getTables returns Test as the
2040 * table name and identifiers are not case sensitive.
2041 *
2042 * @return true is so, false otherwise
2043 */
2044 @Override
2045 public boolean storesMixedCaseIdentifiers() throws SQLException {
2046 debugCodeCall("storesMixedCaseIdentifiers");
2047 Session.StaticSettings settings = conn.getStaticSettings();
2048 return !settings.databaseToUpper && !settings.databaseToLower && settings.caseInsensitiveIdentifiers;
2049 }
2050
2051 /**
2052 * Checks if a table created with CREATE TABLE "Test"(ID INT) is a different
2053 * table than a table created with CREATE TABLE "TEST"(ID INT).
2054 *
2055 * @return true is so, false otherwise
2056 */
2057 @Override
2058 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
2059 debugCodeCall("supportsMixedCaseQuotedIdentifiers");
2060 return !conn.getStaticSettings().caseInsensitiveIdentifiers;
2061 }
2062
2063 /**
2064 * Checks if for CREATE TABLE "Test"(ID INT), getTables returns TEST as the
2065 * table name.
2066 *
2067 * @return false
2068 */
2069 @Override
2070 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
2071 debugCodeCall("storesUpperCaseQuotedIdentifiers");
2072 return false;
2073 }
2074
2075 /**
2076 * Checks if for CREATE TABLE "Test"(ID INT), getTables returns test as the
2077 * table name.
2078 *
2079 * @return false
2080 */
2081 @Override
2082 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
2083 debugCodeCall("storesLowerCaseQuotedIdentifiers");
2084 return false;
2085 }
2086
2087 /**
2088 * Checks if for CREATE TABLE "Test"(ID INT), getTables returns Test as the
2089 * table name and identifiers are case insensitive.
2090 *
2091 * @return true is so, false otherwise
2092 */
2093 @Override
2094 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
2095 debugCodeCall("storesMixedCaseQuotedIdentifiers");
2096 return conn.getStaticSettings().caseInsensitiveIdentifiers;
2097 }
2098
2099 /**
2100 * Returns the maximum length for hex values (characters).
2101 *
2102 * @return 0 for limit is unknown
2103 */
2104 @Override
2105 public int getMaxBinaryLiteralLength() {
2106 debugCodeCall("getMaxBinaryLiteralLength");
2107 return 0;
2108 }
2109
2110 /**
2111 * Returns the maximum length for literals.
2112 *
2113 * @return 0 for limit is unknown
2114 */
2115 @Override
2116 public int getMaxCharLiteralLength() {
2117 debugCodeCall("getMaxCharLiteralLength");
2118 return 0;
2119 }
2120
2121 /**
2122 * Returns the maximum length for column names.
2123 *
2124 * @return 0 for limit is unknown
2125 */
2126 @Override
2127 public int getMaxColumnNameLength() {
2128 debugCodeCall("getMaxColumnNameLength");
2129 return 0;
2130 }
2131
2132 /**
2133 * Returns the maximum number of columns in GROUP BY.
2134 *
2135 * @return 0 for limit is unknown
2136 */
2137 @Override
2138 public int getMaxColumnsInGroupBy() {
2139 debugCodeCall("getMaxColumnsInGroupBy");
2140 return 0;
2141 }
2142
2143 /**
2144 * Returns the maximum number of columns in CREATE INDEX.
2145 *
2146 * @return 0 for limit is unknown
2147 */
2148 @Override
2149 public int getMaxColumnsInIndex() {
2150 debugCodeCall("getMaxColumnsInIndex");
2151 return 0;
2152 }
2153
2154 /**
2155 * Returns the maximum number of columns in ORDER BY.
2156 *
2157 * @return 0 for limit is unknown
2158 */
2159 @Override
2160 public int getMaxColumnsInOrderBy() {
2161 debugCodeCall("getMaxColumnsInOrderBy");
2162 return 0;
2163 }
2164
2165 /**
2166 * Returns the maximum number of columns in SELECT.
2167 *
2168 * @return 0 for limit is unknown
2169 */
2170 @Override
2171 public int getMaxColumnsInSelect() {
2172 debugCodeCall("getMaxColumnsInSelect");
2173 return 0;
2174 }
2175
2176 /**
2177 * Returns the maximum number of columns in CREATE TABLE.
2178 *
2179 * @return 0 for limit is unknown
2180 */
2181 @Override
2182 public int getMaxColumnsInTable() {
2183 debugCodeCall("getMaxColumnsInTable");
2184 return 0;
2185 }
2186
2187 /**
2188 * Returns the maximum number of open connection.
2189 *
2190 * @return 0 for limit is unknown
2191 */
2192 @Override
2193 public int getMaxConnections() {
2194 debugCodeCall("getMaxConnections");
2195 return 0;
2196 }
2197
2198 /**
2199 * Returns the maximum length for a cursor name.
2200 *
2201 * @return 0 for limit is unknown
2202 */
2203 @Override
2204 public int getMaxCursorNameLength() {
2205 debugCodeCall("getMaxCursorNameLength");
2206 return 0;
2207 }
2208
2209 /**
2210 * Returns the maximum length for an index (in bytes).
2211 *
2212 * @return 0 for limit is unknown
2213 */
2214 @Override
2215 public int getMaxIndexLength() {
2216 debugCodeCall("getMaxIndexLength");
2217 return 0;
2218 }
2219
2220 /**
2221 * Returns the maximum length for a schema name.
2222 *
2223 * @return 0 for limit is unknown
2224 */
2225 @Override
2226 public int getMaxSchemaNameLength() {
2227 debugCodeCall("getMaxSchemaNameLength");
2228 return 0;
2229 }
2230
2231 /**
2232 * Returns the maximum length for a procedure name.
2233 *
2234 * @return 0 for limit is unknown
2235 */
2236 @Override
2237 public int getMaxProcedureNameLength() {
2238 debugCodeCall("getMaxProcedureNameLength");
2239 return 0;
2240 }
2241
2242 /**
2243 * Returns the maximum length for a catalog name.
2244 *
2245 * @return 0 for limit is unknown
2246 */
2247 @Override
2248 public int getMaxCatalogNameLength() {
2249 debugCodeCall("getMaxCatalogNameLength");
2250 return 0;
2251 }
2252
2253 /**
2254 * Returns the maximum size of a row (in bytes).
2255 *
2256 * @return 0 for limit is unknown
2257 */
2258 @Override
2259 public int getMaxRowSize() {
2260 debugCodeCall("getMaxRowSize");
2261 return 0;
2262 }
2263
2264 /**
2265 * Returns the maximum length of a statement.
2266 *
2267 * @return 0 for limit is unknown
2268 */
2269 @Override
2270 public int getMaxStatementLength() {
2271 debugCodeCall("getMaxStatementLength");
2272 return 0;
2273 }
2274
2275 /**
2276 * Returns the maximum number of open statements.
2277 *
2278 * @return 0 for limit is unknown
2279 */
2280 @Override
2281 public int getMaxStatements() {
2282 debugCodeCall("getMaxStatements");
2283 return 0;
2284 }
2285
2286 /**
2287 * Returns the maximum length for a table name.
2288 *
2289 * @return 0 for limit is unknown
2290 */
2291 @Override
2292 public int getMaxTableNameLength() {
2293 debugCodeCall("getMaxTableNameLength");
2294 return 0;
2295 }
2296
2297 /**
2298 * Returns the maximum number of tables in a SELECT.
2299 *
2300 * @return 0 for limit is unknown
2301 */
2302 @Override
2303 public int getMaxTablesInSelect() {
2304 debugCodeCall("getMaxTablesInSelect");
2305 return 0;
2306 }
2307
2308 /**
2309 * Returns the maximum length for a user name.
2310 *
2311 * @return 0 for limit is unknown
2312 */
2313 @Override
2314 public int getMaxUserNameLength() {
2315 debugCodeCall("getMaxUserNameLength");
2316 return 0;
2317 }
2318
2319 /**
2320 * Does the database support savepoints.
2321 *
2322 * @return true
2323 */
2324 @Override
2325 public boolean supportsSavepoints() {
2326 debugCodeCall("supportsSavepoints");
2327 return true;
2328 }
2329
2330 /**
2331 * Does the database support named parameters.
2332 *
2333 * @return false
2334 */
2335 @Override
2336 public boolean supportsNamedParameters() {
2337 debugCodeCall("supportsNamedParameters");
2338 return false;
2339 }
2340
2341 /**
2342 * Does the database support multiple open result sets returned from a
2343 * <code>CallableStatement</code>.
2344 *
2345 * @return false
2346 */
2347 @Override
2348 public boolean supportsMultipleOpenResults() {
2349 debugCodeCall("supportsMultipleOpenResults");
2350 return false;
2351 }
2352
2353 /**
2354 * Does the database support getGeneratedKeys.
2355 *
2356 * @return true
2357 */
2358 @Override
2359 public boolean supportsGetGeneratedKeys() {
2360 debugCodeCall("supportsGetGeneratedKeys");
2361 return true;
2362 }
2363
2364 /**
2365 * [Not supported]
2366 */
2367 @Override
2368 public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException {
2369 try {
2370 if (isDebugEnabled()) {
2371 debugCode("getSuperTypes(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
2372 + quote(typeNamePattern) + ')');
2373 }
2374 return getResultSet(meta.getSuperTypes(catalog, schemaPattern, typeNamePattern));
2375 } catch (Exception e) {
2376 throw logAndConvert(e);
2377 }
2378 }
2379
2380 /**
2381 * Get the list of super tables of a table. This method currently returns an
2382 * empty result set.
2383 * <ol>
2384 * <li>TABLE_CAT (String) table catalog</li>
2385 * <li>TABLE_SCHEM (String) table schema</li>
2386 * <li>TABLE_NAME (String) table name</li>
2387 * <li>SUPERTABLE_NAME (String) the name of the super table</li>
2388 * </ol>
2389 *
2390 * @param catalog null (to get all objects) or the catalog name
2391 * @param schemaPattern null (to get all objects) or a schema name
2392 * (uppercase for unquoted names)
2393 * @param tableNamePattern null (to get all objects) or a table name pattern
2394 * (uppercase for unquoted names)
2395 * @return an empty result set
2396 */
2397 @Override
2398 public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) //
2399 throws SQLException {
2400 try {
2401 if (isDebugEnabled()) {
2402 debugCode("getSuperTables(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
2403 + quote(tableNamePattern) + ')');
2404 }
2405 return getResultSet(meta.getSuperTables(catalog, schemaPattern, tableNamePattern));
2406 } catch (Exception e) {
2407 throw logAndConvert(e);
2408 }
2409 }
2410
2411 /**
2412 * [Not supported]
2413 */
2414 @Override
2415 public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern,
2416 String attributeNamePattern) throws SQLException {
2417 try {
2418 if (isDebugEnabled()) {
2419 debugCode("getAttributes(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
2420 + quote(typeNamePattern) + ", " + quote(attributeNamePattern) + ')');
2421 }
2422 return getResultSet(meta.getAttributes(catalog, schemaPattern, typeNamePattern, attributeNamePattern));
2423 } catch (Exception e) {
2424 throw logAndConvert(e);
2425 }
2426 }
2427
2428 /**
2429 * Does this database supports a result set holdability.
2430 *
2431 * @param holdability ResultSet.HOLD_CURSORS_OVER_COMMIT or
2432 * CLOSE_CURSORS_AT_COMMIT
2433 * @return true if the holdability is ResultSet.CLOSE_CURSORS_AT_COMMIT
2434 */
2435 @Override
2436 public boolean supportsResultSetHoldability(int holdability) {
2437 debugCodeCall("supportsResultSetHoldability", holdability);
2438 return holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT;
2439 }
2440
2441 /**
2442 * Gets the result set holdability.
2443 *
2444 * @return ResultSet.CLOSE_CURSORS_AT_COMMIT
2445 */
2446 @Override
2447 public int getResultSetHoldability() {
2448 debugCodeCall("getResultSetHoldability");
2449 return ResultSet.CLOSE_CURSORS_AT_COMMIT;
2450 }
2451
2452 /**
2453 * Gets the major version of the database.
2454 *
2455 * @return the major version
2456 */
2457 @Override
2458 public int getDatabaseMajorVersion() throws SQLException {
2459 try {
2460 debugCodeCall("getDatabaseMajorVersion");
2461 return meta.getDatabaseMajorVersion();
2462 } catch (Exception e) {
2463 throw logAndConvert(e);
2464 }
2465 }
2466
2467 /**
2468 * Gets the minor version of the database.
2469 *
2470 * @return the minor version
2471 */
2472 @Override
2473 public int getDatabaseMinorVersion() throws SQLException {
2474 try {
2475 debugCodeCall("getDatabaseMinorVersion");
2476 return meta.getDatabaseMinorVersion();
2477 } catch (Exception e) {
2478 throw logAndConvert(e);
2479 }
2480 }
2481
2482 /**
2483 * Gets the major version of the supported JDBC API.
2484 *
2485 * @return the major version (4)
2486 */
2487 @Override
2488 public int getJDBCMajorVersion() {
2489 debugCodeCall("getJDBCMajorVersion");
2490 return 4;
2491 }
2492
2493 /**
2494 * Gets the minor version of the supported JDBC API.
2495 *
2496 * @return the minor version (2)
2497 */
2498 @Override
2499 public int getJDBCMinorVersion() {
2500 debugCodeCall("getJDBCMinorVersion");
2501 return 2;
2502 }
2503
2504 /**
2505 * Gets the SQL State type.
2506 *
2507 * @return {@link DatabaseMetaData#sqlStateSQL}
2508 */
2509 @Override
2510 public int getSQLStateType() {
2511 debugCodeCall("getSQLStateType");
2512 return DatabaseMetaData.sqlStateSQL;
2513 }
2514
2515 /**
2516 * Does the database make a copy before updating.
2517 *
2518 * @return false
2519 */
2520 @Override
2521 public boolean locatorsUpdateCopy() {
2522 debugCodeCall("locatorsUpdateCopy");
2523 return false;
2524 }
2525
2526 /**
2527 * Does the database support statement pooling.
2528 *
2529 * @return false
2530 */
2531 @Override
2532 public boolean supportsStatementPooling() {
2533 debugCodeCall("supportsStatementPooling");
2534 return false;
2535 }
2536
2537 // =============================================================
2538
2539 private void checkClosed() {
2540 conn.checkClosed();
2541 }
2542
2543 /**
2544 * Get the lifetime of a rowid.
2545 *
2546 * @return ROWID_UNSUPPORTED
2547 */
2548 @Override
2549 public RowIdLifetime getRowIdLifetime() {
2550 debugCodeCall("getRowIdLifetime");
2551 return RowIdLifetime.ROWID_UNSUPPORTED;
2552 }
2553
2554 /**
2555 * Gets the list of schemas in the database.
2556 * The result set is sorted by TABLE_SCHEM.
2557 *
2558 * <ol>
2559 * <li>TABLE_SCHEM (String) schema name</li>
2560 * <li>TABLE_CATALOG (String) catalog name</li>
2561 * </ol>
2562 *
2563 * @param catalogPattern null (to get all objects) or the catalog name
2564 * @param schemaPattern null (to get all objects) or a schema name
2565 * (uppercase for unquoted names)
2566 * @return the schema list
2567 * @throws SQLException if the connection is closed
2568 */
2569 @Override
2570 public ResultSet getSchemas(String catalogPattern, String schemaPattern)
2571 throws SQLException {
2572 try {
2573 debugCodeCall("getSchemas(String,String)");
2574 return getResultSet(meta.getSchemas(catalogPattern, schemaPattern));
2575 } catch (Exception e) {
2576 throw logAndConvert(e);
2577 }
2578 }
2579
2580 /**
2581 * Returns whether the database supports calling functions using the call
2582 * syntax.
2583 *
2584 * @return true
2585 */
2586 @Override
2587 public boolean supportsStoredFunctionsUsingCallSyntax() {
2588 debugCodeCall("supportsStoredFunctionsUsingCallSyntax");
2589 return true;
2590 }
2591
2592 /**
2593 * Returns whether an exception while auto commit is on closes all result
2594 * sets.
2595 *
2596 * @return false
2597 */
2598 @Override
2599 public boolean autoCommitFailureClosesAllResultSets() {
2600 debugCodeCall("autoCommitFailureClosesAllResultSets");
2601 return false;
2602 }
2603
2604 @Override
2605 public ResultSet getClientInfoProperties() throws SQLException {
2606 Properties clientInfo = conn.getClientInfo();
2607 SimpleResult result = new SimpleResult();
2608 result.addColumn("NAME", TypeInfo.TYPE_VARCHAR);
2609 result.addColumn("MAX_LEN", TypeInfo.TYPE_INTEGER);
2610 result.addColumn("DEFAULT_VALUE", TypeInfo.TYPE_VARCHAR);
2611 result.addColumn("DESCRIPTION", TypeInfo.TYPE_VARCHAR);
2612 // Non-standard column
2613 result.addColumn("VALUE", TypeInfo.TYPE_VARCHAR);
2614 for (Entry<Object, Object> entry : clientInfo.entrySet()) {
2615 result.addRow(ValueVarchar.get((String) entry.getKey()), ValueInteger.get(Integer.MAX_VALUE),
2616 ValueVarchar.EMPTY, ValueVarchar.EMPTY, ValueVarchar.get((String) entry.getValue()));
2617 }
2618 int id = getNextId(TraceObject.RESULT_SET);
2619 debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getClientInfoProperties()");
2620 return new JdbcResultSet(conn, null, null, result, id, true, false, false);
2621 }
2622
2623 /**
2624 * Return an object of this class if possible.
2625 *
2626 * @param iface the class
2627 * @return this
2628 */
2629 @Override
2630 @SuppressWarnings("unchecked")
2631 public <T> T unwrap(Class<T> iface) throws SQLException {
2632 try {
2633 if (isWrapperFor(iface)) {
2634 return (T) this;
2635 }
2636 throw DbException.getInvalidValueException("iface", iface);
2637 } catch (Exception e) {
2638 throw logAndConvert(e);
2639 }
2640 }
2641
2642 /**
2643 * Checks if unwrap can return an object of this class.
2644 *
2645 * @param iface the class
2646 * @return whether or not the interface is assignable from this class
2647 */
2648 @Override
2649 public boolean isWrapperFor(Class<?> iface) throws SQLException {
2650 return iface != null && iface.isAssignableFrom(getClass());
2651 }
2652
2653 /**
2654 * [Not supported] Gets the list of function columns.
2655 */
2656 @Override
2657 public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern,
2658 String columnNamePattern) throws SQLException {
2659 try {
2660 if (isDebugEnabled()) {
2661 debugCode("getFunctionColumns(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
2662 + quote(functionNamePattern) + ", " + quote(columnNamePattern) + ')');
2663 }
2664 return getResultSet(
2665 meta.getFunctionColumns(catalog, schemaPattern, functionNamePattern, columnNamePattern));
2666 } catch (Exception e) {
2667 throw logAndConvert(e);
2668 }
2669 }
2670
2671 /**
2672 * [Not supported] Gets the list of functions.
2673 */
2674 @Override
2675 public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern)
2676 throws SQLException {
2677 try {
2678 if (isDebugEnabled()) {
2679 debugCode("getFunctions(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
2680 + quote(functionNamePattern) + ')');
2681 }
2682 return getResultSet(meta.getFunctions(catalog, schemaPattern, functionNamePattern));
2683 } catch (Exception e) {
2684 throw logAndConvert(e);
2685 }
2686 }
2687
2688 /**
2689 * Returns whether database always returns generated keys if valid names or
2690 * indexes of columns were specified and command was completed successfully.
2691 *
2692 * @return true
2693 */
2694 @Override
2695 public boolean generatedKeyAlwaysReturned() {
2696 return true;
2697 }
2698
2699 /**
2700 * Gets the list of pseudo and invisible columns. The result set is sorted
2701 * by TABLE_SCHEM, TABLE_NAME, and COLUMN_NAME.
2702 *
2703 * <ol>
2704 * <li>TABLE_CAT (String) table catalog</li>
2705 * <li>TABLE_SCHEM (String) table schema</li>
2706 * <li>TABLE_NAME (String) table name</li>
2707 * <li>COLUMN_NAME (String) column name</li>
2708 * <li>DATA_TYPE (int) data type (see java.sql.Types)</li>
2709 * <li>COLUMN_SIZE (int) precision
2710 * (values larger than 2 GB are returned as 2 GB)</li>
2711 * <li>DECIMAL_DIGITS (int) scale (0 for INTEGER and VARCHAR)</li>
2712 * <li>NUM_PREC_RADIX (int) radix</li>
2713 * <li>COLUMN_USAGE (String) he allowed usage for the column,
2714 * see {@link java.sql.PseudoColumnUsage}</li>
2715 * <li>REMARKS (String) comment</li>
2716 * <li>CHAR_OCTET_LENGTH (int) for char types the
2717 * maximum number of bytes in the column</li>
2718 * <li>IS_NULLABLE (String) "NO" or "YES"</li>
2719 * </ol>
2720 *
2721 * @param catalog null (to get all objects) or the catalog name
2722 * @param schemaPattern null (to get all objects) or a schema name
2723 * (uppercase for unquoted names)
2724 * @param tableNamePattern null (to get all objects) or a table name
2725 * (uppercase for unquoted names)
2726 * @param columnNamePattern null (to get all objects) or a column name
2727 * (uppercase for unquoted names)
2728 * @return the list of pseudo and invisible columns
2729 */
2730 @Override
2731 public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern,
2732 String columnNamePattern) throws SQLException {
2733 try {
2734 if (isDebugEnabled()) {
2735 debugCode("getPseudoColumns(" + quote(catalog) + ", " + quote(schemaPattern) + ", "
2736 + quote(tableNamePattern) + ", " + quote(columnNamePattern) + ')');
2737 }
2738 return getResultSet(meta.getPseudoColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern));
2739 } catch (Exception e) {
2740 throw logAndConvert(e);
2741 }
2742 }
2743
2744 /**
2745 * INTERNAL
2746 */
2747 @Override
2748 public String toString() {
2749 return getTraceObjectName() + ": " + conn;
2750 }
2751
2752 private JdbcResultSet getResultSet(ResultInterface result) {
2753 return new JdbcResultSet(conn, null, null, result, getNextId(TraceObject.RESULT_SET), true, false, false);
2754 }
2755
2756 }