Source Code Cross Referenced for JdbcDatabaseMetaData.java in  » Database-DBMS » h2database » org » h2 » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » h2database » org.h2.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
0003:         * (http://h2database.com/html/license.html).
0004:         * Initial Developer: H2 Group
0005:         */
0006:        package org.h2.jdbc;
0007:
0008:        import java.sql.Connection;
0009:        import java.sql.DatabaseMetaData;
0010:        import java.sql.PreparedStatement;
0011:        import java.sql.ResultSet; //#ifdef JDK16
0012:        /*
0013:         import java.sql.RowIdLifetime;
0014:         */
0015:
0016:        //#endif
0017:        import java.sql.SQLException;
0018:
0019:        import org.h2.engine.Constants;
0020:        import org.h2.message.Message;
0021:        import org.h2.message.Trace;
0022:        import org.h2.message.TraceObject;
0023:        import org.h2.util.StringUtils;
0024:
0025:        /**
0026:         * Represents the meta data for a database.
0027:         */
0028:        public class JdbcDatabaseMetaData extends TraceObject implements 
0029:                DatabaseMetaData {
0030:
0031:            private JdbcConnection conn;
0032:
0033:            /**
0034:             * Returns the major version of this driver.
0035:             *
0036:             * @return the major version number
0037:             */
0038:            public int getDriverMajorVersion() {
0039:                debugCodeCall("getDriverMajorVersion");
0040:                return Constants.VERSION_MAJOR;
0041:            }
0042:
0043:            /**
0044:             * Returns the minor version of this driver.
0045:             *
0046:             * @return the minor version number
0047:             */
0048:            public int getDriverMinorVersion() {
0049:                debugCodeCall("getDriverMinorVersion");
0050:                return Constants.VERSION_MINOR;
0051:            }
0052:
0053:            /**
0054:             * Gets the database product name.
0055:             *
0056:             * @return the product name
0057:             */
0058:            public String getDatabaseProductName() {
0059:                debugCodeCall("getDatabaseProductName");
0060:                return Constants.PRODUCT_NAME;
0061:            }
0062:
0063:            /**
0064:             * Gets the product version of the database.
0065:             *
0066:             * @return the product version
0067:             */
0068:            public String getDatabaseProductVersion() {
0069:                debugCodeCall("getDatabaseProductVersion");
0070:                return Constants.getVersion();
0071:            }
0072:
0073:            /**
0074:             * Gets the name of the JDBC driver.
0075:             *
0076:             * @return the driver name
0077:             */
0078:            public String getDriverName() {
0079:                debugCodeCall("getDriverName");
0080:                return Constants.DRIVER_NAME;
0081:            }
0082:
0083:            /**
0084:             * Gets the version number of the driver in the format
0085:             * [MajorVersion].[MinorVersion].
0086:             *
0087:             * @return the version number
0088:             */
0089:            public String getDriverVersion() {
0090:                debugCodeCall("getDriverVersion");
0091:                return Constants.getVersion();
0092:            }
0093:
0094:            /**
0095:             * Gets the list of tables in the database. The result set is sorted by
0096:             * TABLE_TYPE, TABLE_SCHEM, and TABLE_NAME.
0097:             * 
0098:             * <ul>
0099:             * <li>1 TABLE_CAT (String) table catalog </li>
0100:             * <li>2 TABLE_SCHEM (String) table schema </li>
0101:             * <li>3 TABLE_NAME (String) table name </li>
0102:             * <li>4 TABLE_TYPE (String) table type </li>
0103:             * <li>5 REMARKS (String) comment </li>
0104:             * <li>6 SQL (String) the create table statement or NULL for systems tables
0105:             * </li>
0106:             * </ul>
0107:             * 
0108:             * @param catalog null (to get all objects) or the catalog name
0109:             * @param schemaPattern null (to get all objects) or a schema name
0110:             *            (uppercase for unquoted names)
0111:             * @param tableNamePattern null (to get all objects) or a table name
0112:             *            (uppercase for unquoted names)
0113:             * @param types null or a list of table types
0114:             * @return the list of columns
0115:             * @throws SQLException if the connection is closed
0116:             */
0117:            public ResultSet getTables(String catalog, String schemaPattern,
0118:                    String tableNamePattern, String[] types)
0119:                    throws SQLException {
0120:                try {
0121:                    if (debug()) {
0122:                        debugCode("getTables(" + quote(catalog) + ", "
0123:                                + quote(schemaPattern) + ", "
0124:                                + quote(tableNamePattern) + ", "
0125:                                + quoteArray(types) + ");");
0126:                    }
0127:                    checkClosed();
0128:                    String tableType;
0129:                    if (types != null && types.length > 0) {
0130:                        StringBuffer buff = new StringBuffer("TABLE_TYPE IN(");
0131:                        for (int i = 0; i < types.length; i++) {
0132:                            if (i > 0) {
0133:                                buff.append(", ");
0134:                            }
0135:                            buff.append("?");
0136:                        }
0137:                        buff.append(")");
0138:                        tableType = buff.toString();
0139:                    } else {
0140:                        tableType = "TRUE";
0141:                    }
0142:                    PreparedStatement prep = conn
0143:                            .prepareAutoCloseStatement("SELECT "
0144:                                    + "TABLE_CATALOG TABLE_CAT, "
0145:                                    + "TABLE_SCHEMA TABLE_SCHEM, "
0146:                                    + "TABLE_NAME, "
0147:                                    + "TABLE_TYPE, "
0148:                                    + "REMARKS, "
0149:                                    + "SQL "
0150:                                    + "FROM INFORMATION_SCHEMA.TABLES "
0151:                                    + "WHERE TABLE_CATALOG LIKE ? "
0152:                                    + "AND TABLE_SCHEMA LIKE ? "
0153:                                    + "AND TABLE_NAME LIKE ? "
0154:                                    + "AND ("
0155:                                    + tableType
0156:                                    + ") "
0157:                                    + "ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME");
0158:                    prep.setString(1, getCatalogPattern(catalog));
0159:                    prep.setString(2, getSchemaPattern(schemaPattern));
0160:                    prep.setString(3, getPattern(tableNamePattern));
0161:                    for (int i = 0; types != null && i < types.length; i++) {
0162:                        prep.setString(4 + i, types[i]);
0163:                    }
0164:                    return prep.executeQuery();
0165:                } catch (Throwable e) {
0166:                    throw logAndConvert(e);
0167:                }
0168:            }
0169:
0170:            /**
0171:             * Gets the list of columns. The result set is sorted by TABLE_SCHEM,
0172:             * TABLE_NAME, and ORDINAL_POSITION.
0173:             * 
0174:             * <ul>
0175:             * <li>1 TABLE_CAT (String) table catalog </li>
0176:             * <li>2 TABLE_SCHEM (String) table schema </li>
0177:             * <li>3 TABLE_NAME (String) table name </li>
0178:             * <li>4 COLUMN_NAME (String) column name </li>
0179:             * <li>5 DATA_TYPE (short) data type (see java.sql.Types) </li>
0180:             * <li>6 TYPE_NAME (String) data type name ("INTEGER", "VARCHAR",...) </li>
0181:             * <li>7 COLUMN_SIZE (int) precision </li>
0182:             * <li>8 BUFFER_LENGTH (int) unused </li>
0183:             * <li>9 DECIMAL_DIGITS (int) scale (0 for INTEGER and VARCHAR) </li>
0184:             * <li>10 NUM_PREC_RADIX (int) radix (always 10) </li>
0185:             * <li>11 NULLABLE (int) nullable or not. columnNoNulls or columnNullable
0186:             * </li>
0187:             * <li>12 REMARKS (String) comment (always empty) </li>
0188:             * <li>13 COLUMN_DEF (String) default value </li>
0189:             * <li>14 SQL_DATA_TYPE (int) unused </li>
0190:             * <li>15 SQL_DATETIME_SUB (int) unused </li>
0191:             * <li>16 CHAR_OCTET_LENGTH (int) unused </li>
0192:             * <li>17 ORDINAL_POSITION (int) the column index (1,2,...) </li>
0193:             * <li>18 IS_NULLABLE (String) "NO" or "YES" </li>
0194:             * </ul>
0195:             * 
0196:             * @param catalog null (to get all objects) or the catalog name
0197:             * @param schemaPattern null (to get all objects) or a schema name
0198:             *            (uppercase for unquoted names)
0199:             * @param tableNamePattern null (to get all objects) or a table name
0200:             *            (uppercase for unquoted names)
0201:             * @param columnNamePattern null (to get all objects) or a column name
0202:             *            (uppercase for unquoted names)
0203:             * @return the list of columns
0204:             * @throws SQLException if the connection is closed
0205:             */
0206:            public ResultSet getColumns(String catalog, String schemaPattern,
0207:                    String tableNamePattern, String columnNamePattern)
0208:                    throws SQLException {
0209:                try {
0210:                    if (debug()) {
0211:                        debugCode("getColumns(" + quote(catalog) + ", "
0212:                                + quote(schemaPattern) + ", "
0213:                                + quote(tableNamePattern) + ", "
0214:                                + quote(columnNamePattern) + ");");
0215:                    }
0216:                    checkClosed();
0217:                    PreparedStatement prep = conn
0218:                            .prepareAutoCloseStatement("SELECT "
0219:                                    + "TABLE_CATALOG TABLE_CAT, "
0220:                                    + "TABLE_SCHEMA TABLE_SCHEM, "
0221:                                    + "TABLE_NAME, "
0222:                                    + "COLUMN_NAME, "
0223:                                    + "DATA_TYPE, "
0224:                                    + "TYPE_NAME, "
0225:                                    + "CHARACTER_MAXIMUM_LENGTH COLUMN_SIZE, "
0226:                                    + "CHARACTER_MAXIMUM_LENGTH BUFFER_LENGTH, "
0227:                                    + "NUMERIC_SCALE DECIMAL_DIGITS, "
0228:                                    + "NUMERIC_PRECISION_RADIX NUM_PREC_RADIX, "
0229:                                    + "NULLABLE, "
0230:                                    + "REMARKS, "
0231:                                    + "COLUMN_DEFAULT COLUMN_DEF, "
0232:                                    + "DATA_TYPE SQL_DATA_TYPE, "
0233:                                    + "ZERO() SQL_DATETIME_SUB, "
0234:                                    + "CHARACTER_OCTET_LENGTH CHAR_OCTET_LENGTH, "
0235:                                    + "ORDINAL_POSITION, "
0236:                                    + "IS_NULLABLE IS_NULLABLE "
0237:                                    + "FROM INFORMATION_SCHEMA.COLUMNS "
0238:                                    + "WHERE TABLE_CATALOG LIKE ? "
0239:                                    + "AND TABLE_SCHEMA LIKE ? "
0240:                                    + "AND TABLE_NAME LIKE ? "
0241:                                    + "AND COLUMN_NAME LIKE ? "
0242:                                    + "ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION");
0243:                    prep.setString(1, getCatalogPattern(catalog));
0244:                    prep.setString(2, getSchemaPattern(schemaPattern));
0245:                    prep.setString(3, getPattern(tableNamePattern));
0246:                    prep.setString(4, getPattern(columnNamePattern));
0247:                    return prep.executeQuery();
0248:                } catch (Throwable e) {
0249:                    throw logAndConvert(e);
0250:                }
0251:            }
0252:
0253:            /**
0254:             * Gets the list of indexes for this database. The primary key index (if
0255:             * there is one) is also listed, with the name PRIMARY_KEY. The result set
0256:             * is sorted by NON_UNIQUE ('false' first), TYPE, TABLE_SCHEM, INDEX_NAME,
0257:             * and ORDINAL_POSITION.
0258:             * 
0259:             * <ul>
0260:             * <li>1 TABLE_CAT (String) table catalog </li>
0261:             * <li>2 TABLE_SCHEM (String) table schema </li>
0262:             * <li>3 TABLE_NAME (String) table name </li>
0263:             * <li>4 NON_UNIQUE (boolean) 'false' for unique, 'true' for non-unique
0264:             * </li>
0265:             * <li>5 INDEX_QUALIFIER (String) index catalog </li>
0266:             * <li>6 INDEX_NAME (String) index name </li>
0267:             * <li>7 TYPE (short) the index type (always tableIndexOther) </li>
0268:             * <li>8 ORDINAL_POSITION (short) column index (1, 2, ...) </li>
0269:             * <li>9 COLUMN_NAME (String) column name </li>
0270:             * <li>10 ASC_OR_DESC (String) ascending or descending (always 'A') </li>
0271:             * <li>11 CARDINALITY (int) numbers of unique values </li>
0272:             * <li>12 PAGES (int) number of pages use (always 0) </li>
0273:             * <li>13 FILTER_CONDITION (String) filter condition (always empty) </li>
0274:             * <li>14 SORT_TYPE (int) the sort type bit map: 1=DESCENDING,
0275:             * 2=NULLS_FIRST, 4=NULLS_LAST </li>
0276:             * </ul>
0277:             * 
0278:             * @param catalog null (to get all objects) or the catalog name
0279:             * @param schema schema name (must be specified)
0280:             * @param tableName table name (must be specified)
0281:             * @param unique only unique indexes
0282:             * @param approximate is ignored
0283:             * @return the list of indexes and columns
0284:             * @throws SQLException if the connection is closed
0285:             */
0286:            public ResultSet getIndexInfo(String catalog, String schema,
0287:                    String tableName, boolean unique, boolean approximate)
0288:                    throws SQLException {
0289:                try {
0290:                    if (debug()) {
0291:                        debugCode("getIndexInfo(" + quote(catalog) + ", "
0292:                                + quote(schema) + ", " + quote(tableName)
0293:                                + ", " + unique + ", " + approximate + ");");
0294:                    }
0295:                    String uniqueCondition;
0296:                    if (unique) {
0297:                        uniqueCondition = "NON_UNIQUE=FALSE";
0298:                    } else {
0299:                        uniqueCondition = "TRUE";
0300:                    }
0301:                    checkClosed();
0302:                    PreparedStatement prep = conn
0303:                            .prepareAutoCloseStatement("SELECT "
0304:                                    + "TABLE_CATALOG TABLE_CAT, "
0305:                                    + "TABLE_SCHEMA TABLE_SCHEM, "
0306:                                    + "TABLE_NAME, "
0307:                                    + "NON_UNIQUE, "
0308:                                    + "TABLE_CATALOG INDEX_QUALIFIER, "
0309:                                    + "INDEX_NAME, "
0310:                                    + "INDEX_TYPE TYPE, "
0311:                                    + "ORDINAL_POSITION, "
0312:                                    + "COLUMN_NAME, "
0313:                                    + "ASC_OR_DESC, "
0314:                                    + "CARDINALITY, " // TODO meta data for number of unique values in an index
0315:                                    + "PAGES, "
0316:                                    + "FILTER_CONDITION, "
0317:                                    + "SORT_TYPE "
0318:                                    + "FROM INFORMATION_SCHEMA.INDEXES "
0319:                                    + "WHERE TABLE_CATALOG LIKE ? "
0320:                                    + "AND TABLE_SCHEMA LIKE ? "
0321:                                    + "AND ("
0322:                                    + uniqueCondition
0323:                                    + ") "
0324:                                    + "AND TABLE_NAME = ? "
0325:                                    + "ORDER BY NON_UNIQUE, TYPE, TABLE_SCHEM, INDEX_NAME, ORDINAL_POSITION");
0326:                    prep.setString(1, getCatalogPattern(catalog));
0327:                    prep.setString(2, getSchemaPattern(schema));
0328:                    prep.setString(3, tableName);
0329:                    return prep.executeQuery();
0330:                } catch (Throwable e) {
0331:                    throw logAndConvert(e);
0332:                }
0333:            }
0334:
0335:            /**
0336:             * Gets the primary key columns for a table. The result set is sorted by
0337:             * TABLE_SCHEM, and COLUMN_NAME (and not by KEY_SEQ).
0338:             * 
0339:             * <ul>
0340:             * <li>1 TABLE_CAT (String) table catalog </li>
0341:             * <li>2 TABLE_SCHEM (String) table schema </li>
0342:             * <li>3 TABLE_NAME (String) table name </li>
0343:             * <li>4 COLUMN_NAME (String) column name </li>
0344:             * <li>5 KEY_SEQ (short) the column index of this column (1,2,...) </li>
0345:             * <li>6 PK_NAME (String) always 'PRIMARY_KEY' </li>
0346:             * </ul>
0347:             * 
0348:             * @param catalog null (to get all objects) or the catalog name
0349:             * @param schema schema name (must be specified)
0350:             * @param tableName table name (must be specified)
0351:             * @return the list of primary key columns
0352:             * @throws SQLException if the connection is closed
0353:             */
0354:            public ResultSet getPrimaryKeys(String catalog, String schema,
0355:                    String tableName) throws SQLException {
0356:                try {
0357:                    if (debug()) {
0358:                        debugCode("getPrimaryKeys(" + quote(catalog) + ", "
0359:                                + quote(schema) + ", " + quote(tableName)
0360:                                + ");");
0361:                    }
0362:                    checkClosed();
0363:                    PreparedStatement prep = conn
0364:                            .prepareAutoCloseStatement("SELECT "
0365:                                    + "TABLE_CATALOG TABLE_CAT, "
0366:                                    + "TABLE_SCHEMA TABLE_SCHEM, "
0367:                                    + "TABLE_NAME, " + "COLUMN_NAME, "
0368:                                    + "ORDINAL_POSITION KEY_SEQ, "
0369:                                    + "INDEX_NAME PK_NAME "
0370:                                    + "FROM INFORMATION_SCHEMA.INDEXES "
0371:                                    + "WHERE TABLE_CATALOG LIKE ? "
0372:                                    + "AND TABLE_SCHEMA LIKE ? "
0373:                                    + "AND TABLE_NAME = ? "
0374:                                    + "AND PRIMARY_KEY = TRUE "
0375:                                    + "ORDER BY COLUMN_NAME");
0376:                    prep.setString(1, getCatalogPattern(catalog));
0377:                    prep.setString(2, getSchemaPattern(schema));
0378:                    prep.setString(3, tableName);
0379:                    return prep.executeQuery();
0380:                } catch (Throwable e) {
0381:                    throw logAndConvert(e);
0382:                }
0383:            }
0384:
0385:            /**
0386:             * Checks if all procedures callable.
0387:             *
0388:             * @return true
0389:             */
0390:            public boolean allProceduresAreCallable() {
0391:                debugCodeCall("allProceduresAreCallable");
0392:                return true;
0393:            }
0394:
0395:            /**
0396:             * Checks if it possible to query all tables returned by getTables.
0397:             *
0398:             * @return true
0399:             */
0400:            public boolean allTablesAreSelectable() {
0401:                debugCodeCall("allTablesAreSelectable");
0402:                return true;
0403:            }
0404:
0405:            /**
0406:             * Returns the database URL for this connection.
0407:             *
0408:             * @return the url
0409:             */
0410:            public String getURL() throws SQLException {
0411:                try {
0412:                    debugCodeCall("getURL");
0413:                    return conn.getURL();
0414:                } catch (Throwable e) {
0415:                    throw logAndConvert(e);
0416:                }
0417:            }
0418:
0419:            /**
0420:             * Returns the user name as passed to DriverManager.getConnection(url, user,
0421:             * password).
0422:             * 
0423:             * @return the user name
0424:             */
0425:            public String getUserName() throws SQLException {
0426:                try {
0427:                    debugCodeCall("getUserName");
0428:                    return conn.getUser();
0429:                } catch (Throwable e) {
0430:                    throw logAndConvert(e);
0431:                }
0432:            }
0433:
0434:            /**
0435:             * Returns the same as Connection.isReadOnly().
0436:             *
0437:             * @return if read only optimization is switched on
0438:             */
0439:            public boolean isReadOnly() throws SQLException {
0440:                try {
0441:                    debugCodeCall("isReadOnly");
0442:                    return conn.isReadOnly();
0443:                } catch (Throwable e) {
0444:                    throw logAndConvert(e);
0445:                }
0446:            }
0447:
0448:            /**
0449:             * Checks is NULL values are sorted high (bigger than any non-null values).
0450:             * 
0451:             * @return false
0452:             */
0453:            public boolean nullsAreSortedHigh() {
0454:                debugCodeCall("nullsAreSortedHigh");
0455:                return false;
0456:            }
0457:
0458:            /**
0459:             * Checks is NULL values are sorted low (smaller than any non-null values).
0460:             *
0461:             * @return true
0462:             */
0463:            public boolean nullsAreSortedLow() {
0464:                debugCodeCall("nullsAreSortedLow");
0465:                return true;
0466:            }
0467:
0468:            /**
0469:             * Checks is NULL values are sorted at the beginning (no matter if ASC or
0470:             * DESC is used).
0471:             * 
0472:             * @return false
0473:             */
0474:            public boolean nullsAreSortedAtStart() {
0475:                debugCodeCall("nullsAreSortedAtStart");
0476:                return false;
0477:            }
0478:
0479:            /**
0480:             * Checks is NULL values are sorted at the end (no matter if ASC or DESC is
0481:             * used).
0482:             * 
0483:             * @return false
0484:             */
0485:            public boolean nullsAreSortedAtEnd() {
0486:                debugCodeCall("nullsAreSortedAtEnd");
0487:                return false;
0488:            }
0489:
0490:            /**
0491:             * Returns the connection that created this object.
0492:             *
0493:             * @return the connection
0494:             */
0495:            public Connection getConnection() {
0496:                debugCodeCall("getConnection");
0497:                return conn;
0498:            }
0499:
0500:            /**
0501:             * Gets the list of procedures. The result set is sorted by PROCEDURE_SCHEM,
0502:             * and PROCEDURE_NAME.
0503:             * 
0504:             * <ul>
0505:             * <li>1 PROCEDURE_CAT (String) catalog </li>
0506:             * <li>2 PROCEDURE_SCHEM (String) schema </li>
0507:             * <li>3 PROCEDURE_NAME (String) name </li>
0508:             * <li>4 NUM_INPUT_PARAMS (int) for future use, always 0 </li>
0509:             * <li>5 NUM_OUTPUT_PARAMS (int) for future use, always 0 </li>
0510:             * <li>6 NUM_RESULT_SETS (int) for future use, always 0 </li>
0511:             * <li>7 REMARKS (String) description </li>
0512:             * <li>8 PROCEDURE_TYPE (short) if this procedure returns a result
0513:             * (procedureNoResult or procedureReturnsResult) </li>
0514:             * </ul>
0515:             * 
0516:             * @return an empty result set
0517:             * @throws SQLException if the connection is closed
0518:             */
0519:            public ResultSet getProcedures(String catalog,
0520:                    String schemaPattern, String procedureNamePattern)
0521:                    throws SQLException {
0522:                try {
0523:                    if (debug()) {
0524:                        debugCode("getProcedures(" + quote(catalog) + ", "
0525:                                + quote(schemaPattern) + ", "
0526:                                + quote(procedureNamePattern) + ");");
0527:                    }
0528:                    checkClosed();
0529:                    PreparedStatement prep = conn
0530:                            .prepareAutoCloseStatement("SELECT "
0531:                                    + "ALIAS_CATALOG PROCEDURE_CAT, "
0532:                                    + "ALIAS_SCHEMA PROCEDURE_SCHEM, "
0533:                                    + "ALIAS_NAME PROCEDURE_NAME, "
0534:                                    + "ZERO() NUM_INPUT_PARAMS, "
0535:                                    + "ZERO() NUM_OUTPUT_PARAMS, "
0536:                                    + "ZERO() NUM_RESULT_SETS, "
0537:                                    + "REMARKS, "
0538:                                    + "RETURNS_RESULT PROCEDURE_TYPE "
0539:                                    + "FROM INFORMATION_SCHEMA.FUNCTION_ALIASES "
0540:                                    + "WHERE ALIAS_CATALOG LIKE ? "
0541:                                    + "AND ALIAS_SCHEMA LIKE ? "
0542:                                    + "AND ALIAS_NAME LIKE ? "
0543:                                    + "ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME");
0544:                    prep.setString(1, getCatalogPattern(catalog));
0545:                    prep.setString(2, getSchemaPattern(schemaPattern));
0546:                    prep.setString(3, getPattern(procedureNamePattern));
0547:                    return prep.executeQuery();
0548:                } catch (Throwable e) {
0549:                    throw logAndConvert(e);
0550:                }
0551:            }
0552:
0553:            /**
0554:             * Gets the list of procedure columns.
0555:             *
0556:             * <ul>
0557:             * <li>1 PROCEDURE_CAT (String) catalog
0558:             * </li><li>2 PROCEDURE_SCHEM (String) schema
0559:             * </li><li>3 PROCEDURE_NAME (String) name
0560:             * </li><li>4 COLUMN_NAME (String) column name
0561:             * </li><li>5 COLUMN_TYPE (short) column type
0562:             * </li><li>6 DATA_TYPE (short) sql type
0563:             * </li><li>7 TYPE_NAME (String) type name
0564:             * </li><li>8 PRECISION (int) precision
0565:             * </li><li>9 LENGTH (int) length
0566:             * </li><li>10 SCALE (short) scale
0567:             * </li><li>11 RADIX (int) always 10
0568:             * </li><li>12 NULLABLE (short) nullable
0569:             * </li><li>13 REMARKS (String) description
0570:             * </li></ul>
0571:             *
0572:             * @throws SQLException if the connection is closed
0573:             */
0574:            public ResultSet getProcedureColumns(String catalog,
0575:                    String schemaPattern, String procedureNamePattern,
0576:                    String columnNamePattern) throws SQLException {
0577:                try {
0578:                    if (debug()) {
0579:                        debugCode("getProcedureColumns(" + quote(catalog)
0580:                                + ", " + quote(schemaPattern) + ", "
0581:                                + quote(procedureNamePattern) + ", "
0582:                                + quote(columnNamePattern) + ");");
0583:                    }
0584:                    checkClosed();
0585:                    PreparedStatement prep = conn
0586:                            .prepareAutoCloseStatement("SELECT "
0587:                                    + "ALIAS_CATALOG PROCEDURE_CAT, "
0588:                                    + "ALIAS_SCHEMA PROCEDURE_SCHEM, "
0589:                                    + "ALIAS_NAME PROCEDURE_NAME, "
0590:                                    + "COLUMN_NAME, "
0591:                                    + "COLUMN_TYPE, "
0592:                                    + "DATA_TYPE, "
0593:                                    + "TYPE_NAME, "
0594:                                    + "PRECISION, "
0595:                                    + "PRECISION LENGTH, "
0596:                                    + "SCALE, "
0597:                                    + "RADIX, "
0598:                                    + "NULLABLE, "
0599:                                    + "REMARKS "
0600:                                    + "FROM INFORMATION_SCHEMA.FUNCTION_COLUMNS "
0601:                                    + "WHERE ALIAS_CATALOG LIKE ? "
0602:                                    + "AND ALIAS_SCHEMA LIKE ? "
0603:                                    + "AND ALIAS_NAME LIKE ? "
0604:                                    + "AND COLUMN_NAME LIKE ?");
0605:                    prep.setString(1, getCatalogPattern(catalog));
0606:                    prep.setString(2, getSchemaPattern(schemaPattern));
0607:                    prep.setString(3, getPattern(procedureNamePattern));
0608:                    prep.setString(4, getPattern(columnNamePattern));
0609:                    return prep.executeQuery();
0610:                } catch (Throwable e) {
0611:                    throw logAndConvert(e);
0612:                }
0613:            }
0614:
0615:            /**
0616:             * Gets the list of schemas.
0617:             * The result set is sorted by TABLE_SCHEM.
0618:             *
0619:             * <ul>
0620:             * <li>1 TABLE_SCHEM (String) schema name
0621:             * </li><li>2 TABLE_CATALOG (String) catalog name
0622:             * </li><li>3 IS_DEFAULT (boolean) if this is the default schema
0623:             * </li></ul>
0624:             *
0625:             * @return the schema list
0626:             * @throws SQLException if the connection is closed
0627:             */
0628:            public ResultSet getSchemas() throws SQLException {
0629:                try {
0630:                    debugCodeCall("getSchemas");
0631:                    checkClosed();
0632:                    PreparedStatement prep = conn
0633:                            .prepareAutoCloseStatement("SELECT "
0634:                                    + "SCHEMA_NAME TABLE_SCHEM, "
0635:                                    + "CATALOG_NAME TABLE_CATALOG, "
0636:                                    + " IS_DEFAULT "
0637:                                    + "FROM INFORMATION_SCHEMA.SCHEMATA "
0638:                                    + "ORDER BY SCHEMA_NAME");
0639:                    return prep.executeQuery();
0640:                } catch (Throwable e) {
0641:                    throw logAndConvert(e);
0642:                }
0643:            }
0644:
0645:            /**
0646:             * Gets the list of catalogs.
0647:             * The result set is sorted by TABLE_CAT.
0648:             *
0649:             * <ul>
0650:             * <li>1 TABLE_CAT (String) catalog name
0651:             * </li></ul>
0652:             *
0653:             * @return the catalog list
0654:             * @throws SQLException if the connection is closed
0655:             */
0656:            public ResultSet getCatalogs() throws SQLException {
0657:                try {
0658:                    debugCodeCall("getCatalogs");
0659:                    checkClosed();
0660:                    PreparedStatement prep = conn
0661:                            .prepareAutoCloseStatement("SELECT CATALOG_NAME TABLE_CAT "
0662:                                    + "FROM INFORMATION_SCHEMA.CATALOGS");
0663:                    return prep.executeQuery();
0664:                } catch (Throwable e) {
0665:                    throw logAndConvert(e);
0666:                }
0667:            }
0668:
0669:            /**
0670:             * Gets the list of table types. This call returns a result set with three
0671:             * records: "SYSTEM TABLE", "TABLE", "and "VIEW".
0672:             * The result set is sorted by TABLE_TYPE.
0673:             *
0674:             * <ul>
0675:             * <li>1 TABLE_TYPE (String) table type
0676:             * </li></ul>
0677:             *
0678:             * @return the table types
0679:             * @throws SQLException if the connection is closed
0680:             */
0681:            public ResultSet getTableTypes() throws SQLException {
0682:                try {
0683:                    debugCodeCall("getTableTypes");
0684:                    checkClosed();
0685:                    PreparedStatement prep = conn
0686:                            .prepareAutoCloseStatement("SELECT "
0687:                                    + "TYPE TABLE_TYPE "
0688:                                    + "FROM INFORMATION_SCHEMA.TABLE_TYPES "
0689:                                    + "ORDER BY TABLE_TYPE");
0690:                    return prep.executeQuery();
0691:                } catch (Throwable e) {
0692:                    throw logAndConvert(e);
0693:                }
0694:            }
0695:
0696:            /**
0697:             * Gets the list of column privileges. The result set is sorted by
0698:             * COLUMN_NAME and PRIVILEGE
0699:             * 
0700:             * <ul>
0701:             * <li>1 TABLE_CAT (String) table catalog </li>
0702:             * <li>2 TABLE_SCHEM (String) table schema </li>
0703:             * <li>3 TABLE_NAME (String) table name </li>
0704:             * <li>4 COLUMN_NAME (String) column name </li>
0705:             * <li>5 GRANTOR (String) grantor of access </li>
0706:             * <li>6 GRANTEE (String) grantee of access </li>
0707:             * <li>7 PRIVILEGE (String) SELECT, INSERT, UPDATE, DELETE or REFERENCES
0708:             * (only one per row) </li>
0709:             * <li>8 IS_GRANTABLE (String) YES means the grantee can grant access to
0710:             * others </li>
0711:             * </ul>
0712:             * 
0713:             * @param catalog null (to get all objects) or the catalog name
0714:             * @param schema null (to get all objects) or a schema name (uppercase for
0715:             *            unquoted names)
0716:             * @param table a table name (uppercase for unquoted names)
0717:             * @param columnNamePattern null (to get all objects) or a column name
0718:             *            (uppercase for unquoted names)
0719:             * @return the list of privileges
0720:             * @throws SQLException if the connection is closed
0721:             */
0722:            public ResultSet getColumnPrivileges(String catalog, String schema,
0723:                    String table, String columnNamePattern) throws SQLException {
0724:                try {
0725:                    if (debug()) {
0726:                        debugCode("getColumnPrivileges(" + quote(catalog)
0727:                                + ", " + quote(schema) + ", " + quote(table)
0728:                                + ", " + quote(columnNamePattern) + ");");
0729:                    }
0730:                    checkClosed();
0731:                    PreparedStatement prep = conn
0732:                            .prepareAutoCloseStatement("SELECT "
0733:                                    + "TABLE_CATALOG TABLE_CAT, "
0734:                                    + "TABLE_SCHEMA TABLE_SCHEM, "
0735:                                    + "TABLE_NAME, "
0736:                                    + "COLUMN_NAME, "
0737:                                    + "GRANTOR, "
0738:                                    + "GRANTEE, "
0739:                                    + "PRIVILEGE_TYPE PRIVILEGE, "
0740:                                    + "IS_GRANTABLE "
0741:                                    + "FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES "
0742:                                    + "WHERE TABLE_CATALOG LIKE ? "
0743:                                    + "AND TABLE_SCHEMA LIKE ? "
0744:                                    + "AND TABLE_NAME = ? "
0745:                                    + "AND COLUMN_NAME LIKE ? "
0746:                                    + "ORDER BY COLUMN_NAME, PRIVILEGE");
0747:                    prep.setString(1, getCatalogPattern(catalog));
0748:                    prep.setString(2, getSchemaPattern(schema));
0749:                    prep.setString(3, table);
0750:                    prep.setString(4, getPattern(columnNamePattern));
0751:                    return prep.executeQuery();
0752:                } catch (Throwable e) {
0753:                    throw logAndConvert(e);
0754:                }
0755:            }
0756:
0757:            /**
0758:             * Gets the list of table privileges. The result set is sorted by
0759:             * TABLE_SCHEM, TABLE_NAME, and PRIVILEGE.
0760:             * 
0761:             * <ul>
0762:             * <li>1 TABLE_CAT (String) table catalog </li>
0763:             * <li>2 TABLE_SCHEM (String) table schema </li>
0764:             * <li>3 TABLE_NAME (String) table name </li>
0765:             * <li>4 GRANTOR (String) grantor of access </li>
0766:             * <li>5 GRANTEE (String) grantee of access </li>
0767:             * <li>6 PRIVILEGE (String) SELECT, INSERT, UPDATE, DELETE or REFERENCES
0768:             * (only one per row) </li>
0769:             * <li>7 IS_GRANTABLE (String) YES means the grantee can grant access to
0770:             * others </li>
0771:             * </ul>
0772:             * 
0773:             * @param catalog null (to get all objects) or the catalog name
0774:             * @param schemaPattern null (to get all objects) or a schema name
0775:             *            (uppercase for unquoted names)
0776:             * @param tableNamePattern null (to get all objects) or a table name
0777:             *            (uppercase for unquoted names)
0778:             * @return the list of privileges
0779:             * @throws SQLException if the connection is closed
0780:             */
0781:            public ResultSet getTablePrivileges(String catalog,
0782:                    String schemaPattern, String tableNamePattern)
0783:                    throws SQLException {
0784:                try {
0785:                    if (debug()) {
0786:                        debugCode("getTablePrivileges(" + quote(catalog) + ", "
0787:                                + quote(schemaPattern) + ", "
0788:                                + quote(tableNamePattern) + ");");
0789:                    }
0790:                    checkClosed();
0791:                    PreparedStatement prep = conn
0792:                            .prepareAutoCloseStatement("SELECT "
0793:                                    + "TABLE_CATALOG TABLE_CAT, "
0794:                                    + "TABLE_SCHEMA TABLE_SCHEM, "
0795:                                    + "TABLE_NAME, "
0796:                                    + "GRANTOR, "
0797:                                    + "GRANTEE, "
0798:                                    + "PRIVILEGE_TYPE PRIVILEGE, "
0799:                                    + "IS_GRANTABLE "
0800:                                    + "FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES "
0801:                                    + "WHERE TABLE_CATALOG LIKE ? "
0802:                                    + "AND TABLE_SCHEMA LIKE ? "
0803:                                    + "AND TABLE_NAME LIKE ? "
0804:                                    + "ORDER BY TABLE_SCHEM, TABLE_NAME, PRIVILEGE");
0805:                    prep.setString(1, getCatalogPattern(catalog));
0806:                    prep.setString(2, getSchemaPattern(schemaPattern));
0807:                    prep.setString(3, getPattern(tableNamePattern));
0808:                    return prep.executeQuery();
0809:                } catch (Throwable e) {
0810:                    throw logAndConvert(e);
0811:                }
0812:            }
0813:
0814:            /**
0815:             * Gets the list of columns that best identifier a row in a table.
0816:             * The list is ordered by SCOPE.
0817:             *
0818:             * <ul>
0819:             * <li>1 SCOPE (short) scope of result (always bestRowSession)
0820:             * </li><li>2 COLUMN_NAME (String) column name
0821:             * </li><li>3 DATA_TYPE (short) SQL data type, see also java.sql.Types
0822:             * </li><li>4 TYPE_NAME (String) type name
0823:             * </li><li>5 COLUMN_SIZE (int) precision
0824:             * </li><li>6 BUFFER_LENGTH (int) unused
0825:             * </li><li>7 DECIMAL_DIGITS (short) scale
0826:             * </li><li>8 PSEUDO_COLUMN (short) (always bestRowNotPseudo)
0827:             * </li></ul>
0828:             *
0829:             * @param catalog null (to get all objects) or the catalog name
0830:             * @param schema schema name (must be specified)
0831:             * @param tableName table name (must be specified)
0832:             * @param scope ignored
0833:             * @param nullable ignored
0834:             * @return the primary key index
0835:             * @throws SQLException if the connection is closed
0836:             */
0837:            public ResultSet getBestRowIdentifier(String catalog,
0838:                    String schema, String tableName, int scope, boolean nullable)
0839:                    throws SQLException {
0840:                try {
0841:                    if (debug()) {
0842:                        debugCode("getBestRowIdentifier(" + quote(catalog)
0843:                                + ", " + quote(schema) + ", "
0844:                                + quote(tableName) + ", " + scope + ", "
0845:                                + nullable + ");");
0846:                    }
0847:                    checkClosed();
0848:                    PreparedStatement prep = conn
0849:                            .prepareAutoCloseStatement("SELECT "
0850:                                    + "CAST(? AS SMALLINT) SCOPE, "
0851:                                    + "C.COLUMN_NAME, "
0852:                                    + "C.DATA_TYPE, "
0853:                                    + "C.TYPE_NAME, "
0854:                                    + "C.CHARACTER_MAXIMUM_LENGTH COLUMN_SIZE, "
0855:                                    + "C.CHARACTER_MAXIMUM_LENGTH BUFFER_LENGTH, "
0856:                                    + "CAST(C.NUMERIC_SCALE AS SMALLINT) DECIMAL_DIGITS, "
0857:                                    + "CAST(? AS SMALLINT) PSEUDO_COLUMN "
0858:                                    + "FROM INFORMATION_SCHEMA.INDEXES I, "
0859:                                    + " INFORMATION_SCHEMA.COLUMNS C "
0860:                                    + "WHERE C.TABLE_NAME = I.TABLE_NAME "
0861:                                    + "AND C.COLUMN_NAME = I.COLUMN_NAME "
0862:                                    + "AND C.TABLE_CATALOG LIKE ? "
0863:                                    + "AND C.TABLE_SCHEMA LIKE ? "
0864:                                    + "AND C.TABLE_NAME = ? "
0865:                                    + "AND I.PRIMARY_KEY = TRUE "
0866:                                    + "ORDER BY SCOPE");
0867:                    prep.setInt(1, DatabaseMetaData.bestRowSession); // SCOPE
0868:                    prep.setInt(2, DatabaseMetaData.bestRowNotPseudo); // PSEUDO_COLUMN
0869:                    prep.setString(3, getCatalogPattern(catalog));
0870:                    prep.setString(4, getSchemaPattern(schema));
0871:                    prep.setString(5, tableName);
0872:                    return prep.executeQuery();
0873:                } catch (Throwable e) {
0874:                    throw logAndConvert(e);
0875:                }
0876:            }
0877:
0878:            /**
0879:             * Get the list of columns that are update when any value is updated.
0880:             *
0881:             * <ul>
0882:             * <li>1 SCOPE (int) not used
0883:             * </li><li>2 COLUMN_NAME (String) column name
0884:             * </li><li>3 DATA_TYPE (int) SQL data type - see also java.sql.Types
0885:             * </li><li>4 TYPE_NAME (String) data type name
0886:             * </li><li>5 COLUMN_SIZE (int) precision
0887:             * </li><li>6 BUFFER_LENGTH (int) length (bytes)
0888:             * </li><li>7 DECIMAL_DIGITS (int) scale
0889:             * </li><li>8 PSEUDO_COLUMN (int) is this column a pseudo column
0890:             * </li></ul>
0891:             *
0892:             * @param catalog null (to get all objects) or the catalog name
0893:             * @param schema schema name (must be specified)
0894:             * @param tableName table name (must be specified)
0895:             * @return an empty result set
0896:             * @throws SQLException if the connection is closed
0897:             */
0898:            public ResultSet getVersionColumns(String catalog, String schema,
0899:                    String tableName) throws SQLException {
0900:                try {
0901:                    if (debug()) {
0902:                        debugCode("getVersionColumns(" + quote(catalog) + ", "
0903:                                + quote(schema) + ", " + quote(tableName)
0904:                                + ");");
0905:                    }
0906:                    checkClosed();
0907:                    PreparedStatement prep = conn
0908:                            .prepareAutoCloseStatement("SELECT "
0909:                                    + "ZERO() SCOPE, " + "COLUMN_NAME, "
0910:                                    + "CAST(DATA_TYPE AS INT) DATA_TYPE, "
0911:                                    + "TYPE_NAME, "
0912:                                    + "NUMERIC_PRECISION COLUMN_SIZE, "
0913:                                    + "NUMERIC_PRECISION BUFFER_LENGTH, "
0914:                                    + "NUMERIC_PRECISION DECIMAL_DIGITS, "
0915:                                    + "ZERO() PSEUDO_COLUMN "
0916:                                    + "FROM INFORMATION_SCHEMA.COLUMNS "
0917:                                    + "WHERE FALSE");
0918:                    return prep.executeQuery();
0919:                } catch (Throwable e) {
0920:                    throw logAndConvert(e);
0921:                }
0922:            }
0923:
0924:            /**
0925:             * Gets the list of primary key columns that are referenced by a table. The
0926:             * result set is sorted by PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME,
0927:             * FK_NAME, KEY_SEQ.
0928:             * 
0929:             * <ul>
0930:             * <li>1 PKTABLE_CAT (String) primary catalog </li>
0931:             * <li>2 PKTABLE_SCHEM (String) primary schema </li>
0932:             * <li>3 PKTABLE_NAME (String) primary table </li>
0933:             * <li>4 PKCOLUMN_NAME (String) primary column </li>
0934:             * <li>5 FKTABLE_CAT (String) foreign catalog </li>
0935:             * <li>6 FKTABLE_SCHEM (String) foreign schema </li>
0936:             * <li>7 FKTABLE_NAME (String) foreign table </li>
0937:             * <li>8 FKCOLUMN_NAME (String) foreign column </li>
0938:             * <li>9 KEY_SEQ (short) sequence number (1, 2, ...) </li>
0939:             * <li>10 UPDATE_RULE (short) action on update (see
0940:             * DatabaseMetaData.importedKey...) </li>
0941:             * <li>11 DELETE_RULE (short) action on delete (see
0942:             * DatabaseMetaData.importedKey...) </li>
0943:             * <li>12 FK_NAME (String) foreign key name </li>
0944:             * <li>13 PK_NAME (String) primary key name </li>
0945:             * <li>14 DEFERRABILITY (short) deferrable or not (always
0946:             * importedKeyNotDeferrable) </li>
0947:             * </ul>
0948:             * 
0949:             * @param catalog null (to get all objects) or the catalog name
0950:             * @param schema the schema name of the foreign table
0951:             * @param tableName the name of the foreign table
0952:             * @return the result set
0953:             * @throws SQLException if the connection is closed
0954:             */
0955:            public ResultSet getImportedKeys(String catalog, String schema,
0956:                    String tableName) throws SQLException {
0957:                try {
0958:                    if (debug()) {
0959:                        debugCode("getImportedKeys(" + quote(catalog) + ", "
0960:                                + quote(schema) + ", " + quote(tableName)
0961:                                + ");");
0962:                    }
0963:                    checkClosed();
0964:                    PreparedStatement prep = conn
0965:                            .prepareAutoCloseStatement("SELECT "
0966:                                    + "PKTABLE_CATALOG PKTABLE_CAT, "
0967:                                    + "PKTABLE_SCHEMA PKTABLE_SCHEM, "
0968:                                    + "PKTABLE_NAME PKTABLE_NAME, "
0969:                                    + "PKCOLUMN_NAME, "
0970:                                    + "FKTABLE_CATALOG FKTABLE_CAT, "
0971:                                    + "FKTABLE_SCHEMA FKTABLE_SCHEM, "
0972:                                    + "FKTABLE_NAME, "
0973:                                    + "FKCOLUMN_NAME, "
0974:                                    + "ORDINAL_POSITION KEY_SEQ, "
0975:                                    + "UPDATE_RULE, "
0976:                                    + "DELETE_RULE, "
0977:                                    + "FK_NAME, "
0978:                                    + "PK_NAME, "
0979:                                    + "DEFERRABILITY "
0980:                                    + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES "
0981:                                    + "WHERE FKTABLE_CATALOG LIKE ? "
0982:                                    + "AND FKTABLE_SCHEMA LIKE ? "
0983:                                    + "AND FKTABLE_NAME = ? "
0984:                                    + "ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, FK_NAME, KEY_SEQ");
0985:                    prep.setString(1, getCatalogPattern(catalog));
0986:                    prep.setString(2, getSchemaPattern(schema));
0987:                    prep.setString(3, tableName);
0988:                    return prep.executeQuery();
0989:                } catch (Throwable e) {
0990:                    throw logAndConvert(e);
0991:                }
0992:            }
0993:
0994:            /**
0995:             * Gets the list of foreign key columns that reference a table. The result
0996:             * set is sorted by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME,
0997:             * KEY_SEQ.
0998:             * 
0999:             * <ul>
1000:             * <li>1 PKTABLE_CAT (String) primary catalog </li>
1001:             * <li>2 PKTABLE_SCHEM (String) primary schema </li>
1002:             * <li>3 PKTABLE_NAME (String) primary table </li>
1003:             * <li>4 PKCOLUMN_NAME (String) primary column </li>
1004:             * <li>5 FKTABLE_CAT (String) foreign catalog </li>
1005:             * <li>6 FKTABLE_SCHEM (String) foreign schema </li>
1006:             * <li>7 FKTABLE_NAME (String) foreign table </li>
1007:             * <li>8 FKCOLUMN_NAME (String) foreign column </li>
1008:             * <li>9 KEY_SEQ (short) sequence number (1,2,...) </li>
1009:             * <li>10 UPDATE_RULE (short) action on update (see
1010:             * DatabaseMetaData.importedKey...) </li>
1011:             * <li>11 DELETE_RULE (short) action on delete (see
1012:             * DatabaseMetaData.importedKey...) </li>
1013:             * <li>12 FK_NAME (String) foreign key name </li>
1014:             * <li>13 PK_NAME (String) primary key name </li>
1015:             * <li>14 DEFERRABILITY (short) deferrable or not (always
1016:             * importedKeyNotDeferrable) </li>
1017:             * </ul>
1018:             * 
1019:             * @param catalog null (to get all objects) or the catalog name
1020:             * @param schema the schema name of the primary table
1021:             * @param tableName the name of the primary table
1022:             * @return the result set
1023:             * @throws SQLException if the connection is closed
1024:             */
1025:            public ResultSet getExportedKeys(String catalog, String schema,
1026:                    String tableName) throws SQLException {
1027:                try {
1028:                    if (debug()) {
1029:                        debugCode("getExportedKeys(" + quote(catalog) + ", "
1030:                                + quote(schema) + ", " + quote(tableName)
1031:                                + ");");
1032:                    }
1033:                    checkClosed();
1034:                    PreparedStatement prep = conn
1035:                            .prepareAutoCloseStatement("SELECT "
1036:                                    + "PKTABLE_CATALOG PKTABLE_CAT, "
1037:                                    + "PKTABLE_SCHEMA PKTABLE_SCHEM, "
1038:                                    + "PKTABLE_NAME PKTABLE_NAME, "
1039:                                    + "PKCOLUMN_NAME, "
1040:                                    + "FKTABLE_CATALOG FKTABLE_CAT, "
1041:                                    + "FKTABLE_SCHEMA FKTABLE_SCHEM, "
1042:                                    + "FKTABLE_NAME, "
1043:                                    + "FKCOLUMN_NAME, "
1044:                                    + "ORDINAL_POSITION KEY_SEQ, "
1045:                                    + "UPDATE_RULE, "
1046:                                    + "DELETE_RULE, "
1047:                                    + "FK_NAME, "
1048:                                    + "PK_NAME, "
1049:                                    + "DEFERRABILITY "
1050:                                    + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES "
1051:                                    + "WHERE PKTABLE_CATALOG LIKE ? "
1052:                                    + "AND PKTABLE_SCHEMA LIKE ? "
1053:                                    + "AND PKTABLE_NAME = ? "
1054:                                    + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ");
1055:                    prep.setString(1, getCatalogPattern(catalog));
1056:                    prep.setString(2, getSchemaPattern(schema));
1057:                    prep.setString(3, tableName);
1058:                    return prep.executeQuery();
1059:                } catch (Throwable e) {
1060:                    throw logAndConvert(e);
1061:                }
1062:            }
1063:
1064:            /**
1065:             * Gets the list of foreign key columns that references a table, as well as
1066:             * the list of primary key columns that are references by a table. The
1067:             * result set is sorted by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME,
1068:             * FK_NAME, KEY_SEQ.
1069:             * 
1070:             * <ul>
1071:             * <li>1 PKTABLE_CAT (String) primary catalog </li>
1072:             * <li>2 PKTABLE_SCHEM (String) primary schema </li>
1073:             * <li>3 PKTABLE_NAME (String) primary table </li>
1074:             * <li>4 PKCOLUMN_NAME (String) primary column </li>
1075:             * <li>5 FKTABLE_CAT (String) foreign catalog </li>
1076:             * <li>6 FKTABLE_SCHEM (String) foreign schema </li>
1077:             * <li>7 FKTABLE_NAME (String) foreign table </li>
1078:             * <li>8 FKCOLUMN_NAME (String) foreign column </li>
1079:             * <li>9 KEY_SEQ (short) sequence number (1,2,...) </li>
1080:             * <li>10 UPDATE_RULE (short) action on update (see
1081:             * DatabaseMetaData.importedKey...) </li>
1082:             * <li>11 DELETE_RULE (short) action on delete (see
1083:             * DatabaseMetaData.importedKey...) </li>
1084:             * <li>12 FK_NAME (String) foreign key name </li>
1085:             * <li>13 PK_NAME (String) primary key name </li>
1086:             * <li>14 DEFERRABILITY (short) deferrable or not (always
1087:             * importedKeyNotDeferrable) </li>
1088:             * </ul>
1089:             * 
1090:             * @param primaryCatalog ignored
1091:             * @param primarySchema the schema name of the primary table (must be
1092:             *            specified)
1093:             * @param primaryTable the name of the primary table (must be specified)
1094:             * @param foreignCatalog ignored
1095:             * @param foreignSchema the schema name of the foreign table (must be
1096:             *            specified)
1097:             * @param foreignTable the name of the foreign table (must be specified)
1098:             * @return the result set
1099:             * @throws SQLException if the connection is closed
1100:             */
1101:            public ResultSet getCrossReference(String primaryCatalog,
1102:                    String primarySchema, String primaryTable,
1103:                    String foreignCatalog, String foreignSchema,
1104:                    String foreignTable) throws SQLException {
1105:                try {
1106:                    if (debug()) {
1107:                        debugCode("getCrossReference(" + quote(primaryCatalog)
1108:                                + ", " + quote(primarySchema) + ", "
1109:                                + quote(primaryTable) + ", "
1110:                                + quote(foreignCatalog) + ", "
1111:                                + quote(foreignSchema) + ", "
1112:                                + quote(foreignTable) + ");");
1113:                    }
1114:                    checkClosed();
1115:                    PreparedStatement prep = conn
1116:                            .prepareAutoCloseStatement("SELECT "
1117:                                    + "PKTABLE_CATALOG PKTABLE_CAT, "
1118:                                    + "PKTABLE_SCHEMA PKTABLE_SCHEM, "
1119:                                    + "PKTABLE_NAME PKTABLE_NAME, "
1120:                                    + "PKCOLUMN_NAME, "
1121:                                    + "FKTABLE_CATALOG FKTABLE_CAT, "
1122:                                    + "FKTABLE_SCHEMA FKTABLE_SCHEM, "
1123:                                    + "FKTABLE_NAME, "
1124:                                    + "FKCOLUMN_NAME, "
1125:                                    + "ORDINAL_POSITION KEY_SEQ, "
1126:                                    + "UPDATE_RULE, "
1127:                                    + "DELETE_RULE, "
1128:                                    + "FK_NAME, "
1129:                                    + "PK_NAME, "
1130:                                    + "DEFERRABILITY "
1131:                                    + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES "
1132:                                    + "WHERE PKTABLE_CATALOG LIKE ? "
1133:                                    + "AND PKTABLE_SCHEMA LIKE ? "
1134:                                    + "AND PKTABLE_NAME = ? "
1135:                                    + "AND FKTABLE_CATALOG LIKE ? "
1136:                                    + "AND FKTABLE_SCHEMA LIKE ? "
1137:                                    + "AND FKTABLE_NAME = ? "
1138:                                    + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ");
1139:                    prep.setString(1, getCatalogPattern(primaryCatalog));
1140:                    prep.setString(2, getSchemaPattern(primarySchema));
1141:                    prep.setString(3, primaryTable);
1142:                    prep.setString(4, getCatalogPattern(foreignCatalog));
1143:                    prep.setString(5, getSchemaPattern(foreignSchema));
1144:                    prep.setString(6, foreignTable);
1145:                    return prep.executeQuery();
1146:                } catch (Throwable e) {
1147:                    throw logAndConvert(e);
1148:                }
1149:            }
1150:
1151:            /**
1152:             * Gets the list of user defined data types.
1153:             * This call returns an empty result set.
1154:             *
1155:             * <ul>
1156:             * <li>1 TYPE_CAT (String) catalog
1157:             * </li><li>2 TYPE_SCHEM (String) schema
1158:             * </li><li>3 TYPE_NAME (String) type name
1159:             * </li><li>4 CLASS_NAME (String) Java class
1160:             * </li><li>5 DATA_TYPE (short) SQL Type - see also java.sql.Types
1161:             * </li><li>6 REMARKS (String) description
1162:             * </li><li>7 BASE_TYPE (short) base type - see also java.sql.Types
1163:             * </li></ul>
1164:             *
1165:             * @param catalog ignored
1166:             * @param schemaPattern ignored
1167:             * @param typeNamePattern ignored
1168:             * @param types ignored
1169:             * @return an empty result set
1170:             * @throws SQLException if the connection is closed
1171:             */
1172:            public ResultSet getUDTs(String catalog, String schemaPattern,
1173:                    String typeNamePattern, int[] types) throws SQLException {
1174:                try {
1175:                    if (debug()) {
1176:                        debugCode("getUDTs(" + quote(catalog) + ", "
1177:                                + quote(schemaPattern) + ", "
1178:                                + quote(typeNamePattern) + ", "
1179:                                + quoteIntArray(types) + ");");
1180:                    }
1181:                    checkClosed();
1182:                    PreparedStatement prep = conn
1183:                            .prepareAutoCloseStatement("SELECT "
1184:                                    + "CATALOG_NAME  TYPE_CAT, "
1185:                                    + "CATALOG_NAME  TYPE_SCHEM, "
1186:                                    + "CATALOG_NAME  TYPE_NAME, "
1187:                                    + "CATALOG_NAME  CLASS_NAME, "
1188:                                    + "CAST(ZERO() AS SMALLINT) DATA_TYPE, "
1189:                                    + "CATALOG_NAME  REMARKS, "
1190:                                    + "CAST(ZERO() AS SMALLINT) BASE_TYPE "
1191:                                    + "FROM INFORMATION_SCHEMA.CATALOGS "
1192:                                    + "WHERE FALSE");
1193:                    return prep.executeQuery();
1194:                } catch (Throwable e) {
1195:                    throw logAndConvert(e);
1196:                }
1197:            }
1198:
1199:            /**
1200:             * Gets the list of data types. The result set is sorted by DATA_TYPE and
1201:             * afterwards by how closely the data type maps to the corresponding JDBC
1202:             * SQL type (best match first).
1203:             * 
1204:             * <ul>
1205:             * <li>1 TYPE_NAME (String) type name </li>
1206:             * <li>2 DATA_TYPE (short) SQL data type - see also java.sql.Types </li>
1207:             * <li>3 PRECISION (int) maximum precision </li>
1208:             * <li>4 LITERAL_PREFIX (String) prefix used to quote a literal </li>
1209:             * <li>5 LITERAL_SUFFIX (String) suffix used to quote a literal </li>
1210:             * <li>6 CREATE_PARAMS (String) parameters used (may be null) </li>
1211:             * <li>7 NULLABLE (short) typeNoNulls (NULL not allowed) or typeNullable
1212:             * </li>
1213:             * <li>8 CASE_SENSITIVE (boolean) case sensitive </li>
1214:             * <li>9 SEARCHABLE (short) typeSearchable </li>
1215:             * <li>10 UNSIGNED_ATTRIBUTE (boolean) unsigned </li>
1216:             * <li>11 FIXED_PREC_SCALE (boolean) fixed precision </li>
1217:             * <li>12 AUTO_INCREMENT (boolean) auto increment </li>
1218:             * <li>13 LOCAL_TYPE_NAME (String) localized version of the data type </li>
1219:             * <li>14 MINIMUM_SCALE (short) minimum scale </li>
1220:             * <li>15 MAXIMUM_SCALE (short) maximum scale </li>
1221:             * <li>16 SQL_DATA_TYPE (int) unused </li>
1222:             * <li>17 SQL_DATETIME_SUB (int) unused </li>
1223:             * <li>18 NUM_PREC_RADIX (int) 2 for binary, 10 for decimal </li>
1224:             * </ul>
1225:             * 
1226:             * @return the list of data types
1227:             * @throws SQLException if the connection is closed
1228:             */
1229:            public ResultSet getTypeInfo() throws SQLException {
1230:                try {
1231:                    debugCodeCall("getTypeInfo");
1232:                    checkClosed();
1233:                    PreparedStatement prep = conn
1234:                            .prepareAutoCloseStatement("SELECT "
1235:                                    + "TYPE_NAME, " + "DATA_TYPE, "
1236:                                    + "PRECISION, " + "PREFIX LITERAL_PREFIX, "
1237:                                    + "SUFFIX LITERAL_SUFFIX, "
1238:                                    + "PARAMS CREATE_PARAMS, " + "NULLABLE, "
1239:                                    + "CASE_SENSITIVE, " + "SEARCHABLE, "
1240:                                    + "FALSE UNSIGNED_ATTRIBUTE, "
1241:                                    + "FALSE FIXED_PREC_SCALE, "
1242:                                    + "AUTO_INCREMENT, "
1243:                                    + "TYPE_NAME LOCAL_TYPE_NAME, "
1244:                                    + "MINIMUM_SCALE, " + "MAXIMUM_SCALE, "
1245:                                    + "DATA_TYPE SQL_DATA_TYPE, "
1246:                                    + "ZERO() SQL_DATETIME_SUB, "
1247:                                    + "RADIX NUM_PREC_RADIX "
1248:                                    + "FROM INFORMATION_SCHEMA.TYPE_INFO "
1249:                                    + "ORDER BY DATA_TYPE, POS");
1250:                    ResultSet rs = prep.executeQuery();
1251:                    return rs;
1252:                } catch (Throwable e) {
1253:                    throw logAndConvert(e);
1254:                }
1255:            }
1256:
1257:            /**
1258:             * Checks if this database store data in local files.
1259:             *
1260:             * @return true
1261:             */
1262:            public boolean usesLocalFiles() {
1263:                debugCodeCall("usesLocalFiles");
1264:                return true;
1265:            }
1266:
1267:            /**
1268:             * Checks if this database use one file per table.
1269:             *
1270:             * @return false
1271:             */
1272:            public boolean usesLocalFilePerTable() {
1273:                debugCodeCall("usesLocalFilePerTable");
1274:                return false;
1275:            }
1276:
1277:            /**
1278:             * Returns the string used to quote identifiers.
1279:             *
1280:             * @return a double quote
1281:             */
1282:            public String getIdentifierQuoteString() {
1283:                debugCodeCall("getIdentifierQuoteString");
1284:                return "\"";
1285:            }
1286:
1287:            /**
1288:             * Gets the comma-separated list of all SQL keywords that are not supported
1289:             * as table/column/index name, in addition to the SQL-92 keywords.
1290:             *
1291:             * @return a list with the keywords
1292:             */
1293:            public String getSQLKeywords() {
1294:                debugCodeCall("getSQLKeywords");
1295:                return "";
1296:            }
1297:
1298:            /**
1299:             * Returns the list of numeric functions supported by this database.
1300:             *
1301:             * @return the list
1302:             */
1303:            public String getNumericFunctions() throws SQLException {
1304:                debugCodeCall("getNumericFunctions");
1305:                return getFunctions("Functions (Numeric)");
1306:            }
1307:
1308:            /**
1309:             * Returns the list of string functions supported by this database.
1310:             *
1311:             * @return the list
1312:             */
1313:            public String getStringFunctions() throws SQLException {
1314:                debugCodeCall("getStringFunctions");
1315:                return getFunctions("Functions (String)");
1316:            }
1317:
1318:            /**
1319:             * Returns the list of system functions supported by this database.
1320:             *
1321:             * @return the list
1322:             */
1323:            public String getSystemFunctions() throws SQLException {
1324:                debugCodeCall("getSystemFunctions");
1325:                return getFunctions("Functions (System)");
1326:            }
1327:
1328:            /**
1329:             * Returns the list of date and time functions supported by this database.
1330:             *
1331:             * @return the list
1332:             */
1333:            public String getTimeDateFunctions() throws SQLException {
1334:                debugCodeCall("getTimeDateFunctions");
1335:                return getFunctions("Functions (Time and Date)");
1336:            }
1337:
1338:            private String getFunctions(String section) throws SQLException {
1339:                try {
1340:                    StringBuffer buff = new StringBuffer();
1341:                    checkClosed();
1342:                    PreparedStatement prep = conn
1343:                            .prepareAutoCloseStatement("SELECT TOPIC "
1344:                                    + "FROM INFORMATION_SCHEMA.HELP WHERE SECTION = ?");
1345:                    prep.setString(1, section);
1346:                    ResultSet rs = prep.executeQuery();
1347:                    while (rs.next()) {
1348:                        String s = rs.getString(1).trim();
1349:                        String[] array = StringUtils.arraySplit(s, ',', true);
1350:                        for (int i = 0; i < array.length; i++) {
1351:                            if (buff.length() > 0) {
1352:                                buff.append(",");
1353:                            }
1354:                            String f = array[i].trim();
1355:                            if (f.indexOf(' ') >= 0) {
1356:                                // remove 'Function' from 'INSERT Function'
1357:                                f = f.substring(0, f.indexOf(' ')).trim();
1358:                            }
1359:                            buff.append(f);
1360:                        }
1361:                    }
1362:                    rs.close();
1363:                    prep.close();
1364:                    return buff.toString();
1365:                } catch (Throwable e) {
1366:                    throw logAndConvert(e);
1367:                }
1368:            }
1369:
1370:            /**
1371:             * Returns the default escape character for LIKE.
1372:             *
1373:             * @return the character '\'
1374:             */
1375:            public String getSearchStringEscape() {
1376:                debugCodeCall("getSearchStringEscape");
1377:                return "" + Constants.DEFAULT_ESCAPE_CHAR;
1378:            }
1379:
1380:            /**
1381:             * Returns the characters that are allowed for identifiers in addiction to
1382:             * A-Z, a-z, 0-9 and '_'.
1383:             *
1384:             * @return an empty String ("")
1385:             */
1386:            public String getExtraNameCharacters() {
1387:                debugCodeCall("getExtraNameCharacters");
1388:                return "";
1389:            }
1390:
1391:            /**
1392:             * Returns whether alter table with add column is supported.
1393:             * @return true
1394:             */
1395:            public boolean supportsAlterTableWithAddColumn() {
1396:                debugCodeCall("supportsAlterTableWithAddColumn");
1397:                return true;
1398:            }
1399:
1400:            /**
1401:             * Returns whether alter table with drop column is supported.
1402:             *
1403:             * @return true
1404:             */
1405:            public boolean supportsAlterTableWithDropColumn() {
1406:                debugCodeCall("supportsAlterTableWithDropColumn");
1407:                return true;
1408:            }
1409:
1410:            /**
1411:             * Returns whether column aliasing is supported.
1412:             *
1413:             * @return true
1414:             */
1415:            public boolean supportsColumnAliasing() {
1416:                debugCodeCall("supportsColumnAliasing");
1417:                return true;
1418:            }
1419:
1420:            /**
1421:             * Returns whether NULL+1 is NULL or not.
1422:             *
1423:             * @return true
1424:             */
1425:            public boolean nullPlusNonNullIsNull() {
1426:                debugCodeCall("nullPlusNonNullIsNull");
1427:                return true;
1428:            }
1429:
1430:            /**
1431:             * Returns whether CONVERT is supported.
1432:             *
1433:             * @return true
1434:             */
1435:            public boolean supportsConvert() {
1436:                debugCodeCall("supportsConvert");
1437:                return true;
1438:            }
1439:
1440:            /**
1441:             * Returns whether CONVERT is supported for one datatype to another.
1442:             *
1443:             * @return true
1444:             */
1445:            public boolean supportsConvert(int fromType, int toType) {
1446:                if (debug()) {
1447:                    debugCode("supportsConvert(" + fromType + ", " + fromType
1448:                            + ");");
1449:                }
1450:                return true;
1451:            }
1452:
1453:            /**
1454:             * Returns whether table correlation names (table alias) are supported.
1455:             *
1456:             * @return true
1457:             */
1458:            public boolean supportsTableCorrelationNames() {
1459:                debugCodeCall("supportsTableCorrelationNames");
1460:                return true;
1461:            }
1462:
1463:            /**
1464:             * Returns whether table correlation names (table alias) are restricted to
1465:             * be different than table names.
1466:             *
1467:             * @return false
1468:             */
1469:            public boolean supportsDifferentTableCorrelationNames() {
1470:                debugCodeCall("supportsDifferentTableCorrelationNames");
1471:                return false;
1472:            }
1473:
1474:            /**
1475:             * Returns whether expression in ORDER BY are supported.
1476:             *
1477:             * @return true
1478:             */
1479:            public boolean supportsExpressionsInOrderBy() {
1480:                debugCodeCall("supportsExpressionsInOrderBy");
1481:                return true;
1482:            }
1483:
1484:            /**
1485:             * Returns whether ORDER BY is supported if the column is not in the SELECT
1486:             * list.
1487:             *
1488:             * @return true
1489:             */
1490:            public boolean supportsOrderByUnrelated() {
1491:                debugCodeCall("supportsOrderByUnrelated");
1492:                return true;
1493:            }
1494:
1495:            /**
1496:             * Returns whether GROUP BY is supported.
1497:             *
1498:             * @return true
1499:             */
1500:            public boolean supportsGroupBy() {
1501:                debugCodeCall("supportsGroupBy");
1502:                return true;
1503:            }
1504:
1505:            /**
1506:             * Returns whether GROUP BY is supported if the column is not in the SELECT
1507:             * list.
1508:             *
1509:             * @return true
1510:             */
1511:            public boolean supportsGroupByUnrelated() {
1512:                debugCodeCall("supportsGroupByUnrelated");
1513:                return true;
1514:            }
1515:
1516:            /**
1517:             * Checks whether a GROUP BY clause can use columns that are not in the
1518:             * SELECT clause, provided that it specifies all the columns in the SELECT
1519:             * clause.
1520:             *
1521:             * @return true
1522:             */
1523:            public boolean supportsGroupByBeyondSelect() {
1524:                debugCodeCall("supportsGroupByBeyondSelect");
1525:                return true;
1526:            }
1527:
1528:            /**
1529:             * Returns whether LIKE... ESCAPE is supported.
1530:             *
1531:             * @return true
1532:             */
1533:            public boolean supportsLikeEscapeClause() {
1534:                debugCodeCall("supportsLikeEscapeClause");
1535:                return true;
1536:            }
1537:
1538:            /**
1539:             * Returns whether multiple result sets are supported.
1540:             *
1541:             * @return false
1542:             */
1543:            public boolean supportsMultipleResultSets() {
1544:                debugCodeCall("supportsMultipleResultSets");
1545:                return false;
1546:            }
1547:
1548:            /**
1549:             * Returns whether multiple transactions (on different connections) are
1550:             * supported.
1551:             *
1552:             * @return true
1553:             */
1554:            public boolean supportsMultipleTransactions() {
1555:                debugCodeCall("supportsMultipleTransactions");
1556:                return true;
1557:            }
1558:
1559:            /**
1560:             * Returns whether columns with NOT NULL are supported.
1561:             *
1562:             * @return true
1563:             */
1564:            public boolean supportsNonNullableColumns() {
1565:                debugCodeCall("supportsNonNullableColumns");
1566:                return true;
1567:            }
1568:
1569:            /**
1570:             * Returns whether ODBC Minimum SQL grammar is supported.
1571:             *
1572:             * @return true
1573:             */
1574:            public boolean supportsMinimumSQLGrammar() {
1575:                debugCodeCall("supportsMinimumSQLGrammar");
1576:                return true;
1577:            }
1578:
1579:            /**
1580:             * Returns whether ODBC Core SQL grammar is supported.
1581:             *
1582:             * @return true
1583:             */
1584:            public boolean supportsCoreSQLGrammar() {
1585:                debugCodeCall("supportsCoreSQLGrammar");
1586:                return true;
1587:            }
1588:
1589:            /**
1590:             * Returns whether ODBC Extended SQL grammar is supported.
1591:             *
1592:             * @return false
1593:             */
1594:            public boolean supportsExtendedSQLGrammar() {
1595:                debugCodeCall("supportsExtendedSQLGrammar");
1596:                return false;
1597:            }
1598:
1599:            /**
1600:             * Returns whether SQL-92 entry level grammar is supported.
1601:             *
1602:             * @return true
1603:             */
1604:            public boolean supportsANSI92EntryLevelSQL() {
1605:                debugCodeCall("supportsANSI92EntryLevelSQL");
1606:                return true;
1607:            }
1608:
1609:            /**
1610:             * Returns whether SQL-92 intermediate level grammar is supported.
1611:             *
1612:             * @return false
1613:             */
1614:            public boolean supportsANSI92IntermediateSQL() {
1615:                debugCodeCall("supportsANSI92IntermediateSQL");
1616:                return false;
1617:            }
1618:
1619:            /**
1620:             * Returns whether SQL-92 full level grammar is supported.
1621:             *
1622:             * @return false
1623:             */
1624:            public boolean supportsANSI92FullSQL() {
1625:                debugCodeCall("supportsANSI92FullSQL");
1626:                return false;
1627:            }
1628:
1629:            /**
1630:             * Returns whether referential integrity is supported.
1631:             *
1632:             * @return true
1633:             */
1634:            public boolean supportsIntegrityEnhancementFacility() {
1635:                debugCodeCall("supportsIntegrityEnhancementFacility");
1636:                return true;
1637:            }
1638:
1639:            /**
1640:             * Returns whether outer joins are supported.
1641:             *
1642:             * @return true
1643:             */
1644:            public boolean supportsOuterJoins() {
1645:                debugCodeCall("supportsOuterJoins");
1646:                return true;
1647:            }
1648:
1649:            /**
1650:             * Returns whether full outer joins are supported.
1651:             *
1652:             * @return false
1653:             */
1654:            public boolean supportsFullOuterJoins() {
1655:                debugCodeCall("supportsFullOuterJoins");
1656:                return false;
1657:            }
1658:
1659:            /**
1660:             * Returns whether limited outer joins are supported.
1661:             *
1662:             * @return true
1663:             */
1664:            public boolean supportsLimitedOuterJoins() {
1665:                debugCodeCall("supportsLimitedOuterJoins");
1666:                return true;
1667:            }
1668:
1669:            /**
1670:             * Returns the term for "schema".
1671:             *
1672:             * @return "schema"
1673:             */
1674:            public String getSchemaTerm() {
1675:                debugCodeCall("getSchemaTerm");
1676:                return "schema";
1677:            }
1678:
1679:            /**
1680:             * Returns the term for "procedure".
1681:             *
1682:             * @return "procedure"
1683:             */
1684:            public String getProcedureTerm() {
1685:                debugCodeCall("getProcedureTerm");
1686:                return "procedure";
1687:            }
1688:
1689:            /**
1690:             * Returns the term for "catalog".
1691:             *
1692:             * @return "catalog"
1693:             */
1694:            public String getCatalogTerm() {
1695:                debugCodeCall("getCatalogTerm");
1696:                return "catalog";
1697:            }
1698:
1699:            /**
1700:             * Returns whether the catalog is at the beginning.
1701:             *
1702:             * @return true
1703:             */
1704:            public boolean isCatalogAtStart() {
1705:                debugCodeCall("isCatalogAtStart");
1706:                return true;
1707:            }
1708:
1709:            /**
1710:             * Returns the catalog separator.
1711:             *
1712:             * @return "."
1713:             */
1714:            public String getCatalogSeparator() {
1715:                debugCodeCall("getCatalogSeparator");
1716:                return ".";
1717:            }
1718:
1719:            /**
1720:             * Returns whether the schema name in INSERT, UPDATE, DELETE is supported.
1721:             *
1722:             * @return true
1723:             */
1724:            public boolean supportsSchemasInDataManipulation() {
1725:                debugCodeCall("supportsSchemasInDataManipulation");
1726:                return true;
1727:            }
1728:
1729:            /**
1730:             * Returns whether the schema name in procedure calls is supported.
1731:             *
1732:             * @return true
1733:             */
1734:            public boolean supportsSchemasInProcedureCalls() {
1735:                debugCodeCall("supportsSchemasInProcedureCalls");
1736:                return true;
1737:            }
1738:
1739:            /**
1740:             * Returns whether the schema name in CREATE TABLE is supported.
1741:             *
1742:             * @return true
1743:             */
1744:            public boolean supportsSchemasInTableDefinitions() {
1745:                debugCodeCall("supportsSchemasInTableDefinitions");
1746:                return true;
1747:            }
1748:
1749:            /**
1750:             * Returns whether the schema name in CREATE INDEX is supported.
1751:             *
1752:             * @return true
1753:             */
1754:            public boolean supportsSchemasInIndexDefinitions() {
1755:                debugCodeCall("supportsSchemasInIndexDefinitions");
1756:                return true;
1757:            }
1758:
1759:            /**
1760:             * Returns whether the schema name in GRANT is supported.
1761:             *
1762:             * @return true
1763:             */
1764:            public boolean supportsSchemasInPrivilegeDefinitions() {
1765:                debugCodeCall("supportsSchemasInPrivilegeDefinitions");
1766:                return true;
1767:            }
1768:
1769:            /**
1770:             * Returns whether the catalog name in INSERT, UPDATE, DELETE is supported.
1771:             *
1772:             * @return true
1773:             */
1774:            public boolean supportsCatalogsInDataManipulation() {
1775:                debugCodeCall("supportsCatalogsInDataManipulation");
1776:                return true;
1777:            }
1778:
1779:            /**
1780:             * Returns whether the catalog name in procedure calls is supported.
1781:             *
1782:             * @return false
1783:             */
1784:            public boolean supportsCatalogsInProcedureCalls() {
1785:                debugCodeCall("supportsCatalogsInProcedureCalls");
1786:                return false;
1787:            }
1788:
1789:            /**
1790:             * Returns whether the catalog name in CREATE TABLE is supported.
1791:             *
1792:             * @return true
1793:             */
1794:            public boolean supportsCatalogsInTableDefinitions() {
1795:                debugCodeCall("supportsCatalogsInTableDefinitions");
1796:                return true;
1797:            }
1798:
1799:            /**
1800:             * Returns whether the catalog name in CREATE INDEX is supported.
1801:             *
1802:             * @return true
1803:             */
1804:            public boolean supportsCatalogsInIndexDefinitions() {
1805:                debugCodeCall("supportsCatalogsInIndexDefinitions");
1806:                return true;
1807:            }
1808:
1809:            /**
1810:             * Returns whether the catalog name in GRANT is supported.
1811:             *
1812:             * @return true
1813:             */
1814:            public boolean supportsCatalogsInPrivilegeDefinitions() {
1815:                debugCodeCall("supportsCatalogsInPrivilegeDefinitions");
1816:                return true;
1817:            }
1818:
1819:            /**
1820:             * Returns whether positioned deletes are supported.
1821:             *
1822:             * @return true
1823:             */
1824:            public boolean supportsPositionedDelete() {
1825:                debugCodeCall("supportsPositionedDelete");
1826:                return true;
1827:            }
1828:
1829:            /**
1830:             * Returns whether positioned updates are supported.
1831:             *
1832:             * @return true
1833:             */
1834:            public boolean supportsPositionedUpdate() {
1835:                debugCodeCall("supportsPositionedUpdate");
1836:                return true;
1837:            }
1838:
1839:            /**
1840:             * Returns whether SELECT ... FOR UPDATE is supported.
1841:             *
1842:             * @return true
1843:             */
1844:            public boolean supportsSelectForUpdate() {
1845:                debugCodeCall("supportsSelectForUpdate");
1846:                return true;
1847:            }
1848:
1849:            /**
1850:             * Returns whether stored procedures are supported.
1851:             *
1852:             * @return false
1853:             */
1854:            public boolean supportsStoredProcedures() {
1855:                debugCodeCall("supportsStoredProcedures");
1856:                return false;
1857:            }
1858:
1859:            /**
1860:             * Returns whether subqueries (SELECT) in comparisons are supported.
1861:             *
1862:             * @return true
1863:             */
1864:            public boolean supportsSubqueriesInComparisons() {
1865:                debugCodeCall("supportsSubqueriesInComparisons");
1866:                return true;
1867:            }
1868:
1869:            /**
1870:             * Returns whether SELECT in EXISTS is supported.
1871:             *
1872:             * @return true
1873:             */
1874:            public boolean supportsSubqueriesInExists() {
1875:                debugCodeCall("supportsSubqueriesInExists");
1876:                return true;
1877:            }
1878:
1879:            /**
1880:             * Returns whether IN(SELECT...) is supported.
1881:             *
1882:             * @return true
1883:             */
1884:            public boolean supportsSubqueriesInIns() {
1885:                debugCodeCall("supportsSubqueriesInIns");
1886:                return true;
1887:            }
1888:
1889:            /**
1890:             * Returns whether subqueries in quantified expression are supported.
1891:             *
1892:             * @return true
1893:             */
1894:            public boolean supportsSubqueriesInQuantifieds() {
1895:                debugCodeCall("supportsSubqueriesInQuantifieds");
1896:                return true;
1897:            }
1898:
1899:            /**
1900:             * Returns whether correlated subqueries are supported.
1901:             *
1902:             * @return true
1903:             */
1904:            public boolean supportsCorrelatedSubqueries() {
1905:                debugCodeCall("supportsCorrelatedSubqueries");
1906:                return true;
1907:            }
1908:
1909:            /**
1910:             * Returns whether UNION SELECT is supported.
1911:             *
1912:             * @return true
1913:             */
1914:            public boolean supportsUnion() {
1915:                debugCodeCall("supportsUnion");
1916:                return true;
1917:            }
1918:
1919:            /**
1920:             * Returns whether UNION ALL SELECT is supported.
1921:             *
1922:             * @return true
1923:             */
1924:            public boolean supportsUnionAll() {
1925:                debugCodeCall("supportsUnionAll");
1926:                return true;
1927:            }
1928:
1929:            /**
1930:             * Returns whether open result sets across commits are supported.
1931:             *
1932:             * @return false
1933:             */
1934:            public boolean supportsOpenCursorsAcrossCommit() {
1935:                debugCodeCall("supportsOpenCursorsAcrossCommit");
1936:                return false;
1937:            }
1938:
1939:            /**
1940:             * Returns whether open result sets across rollback are supported.
1941:             *
1942:             * @return false
1943:             */
1944:            public boolean supportsOpenCursorsAcrossRollback() {
1945:                debugCodeCall("supportsOpenCursorsAcrossRollback");
1946:                return false;
1947:            }
1948:
1949:            /**
1950:             * Returns whether open statements across commit are supported.
1951:             *
1952:             * @return true
1953:             */
1954:            public boolean supportsOpenStatementsAcrossCommit() {
1955:                debugCodeCall("supportsOpenStatementsAcrossCommit");
1956:                return true;
1957:            }
1958:
1959:            /**
1960:             * Returns whether open statements across rollback are supported.
1961:             *
1962:             * @return true
1963:             */
1964:            public boolean supportsOpenStatementsAcrossRollback() {
1965:                debugCodeCall("supportsOpenStatementsAcrossRollback");
1966:                return true;
1967:            }
1968:
1969:            /**
1970:             * Returns whether transactions are supported.
1971:             *
1972:             * @return true
1973:             */
1974:            public boolean supportsTransactions() {
1975:                debugCodeCall("supportsTransactions");
1976:                return true;
1977:            }
1978:
1979:            /**
1980:             * Returns whether a specific transaction isolation level is supported.
1981:             *
1982:             * @return true
1983:             */
1984:            public boolean supportsTransactionIsolationLevel(int level) {
1985:                debugCodeCall("supportsTransactionIsolationLevel");
1986:                return true;
1987:            }
1988:
1989:            /**
1990:             * Returns whether data manipulation and CREATE/DROP is supported in
1991:             * transactions.
1992:             *
1993:             * @return false
1994:             */
1995:            public boolean supportsDataDefinitionAndDataManipulationTransactions() {
1996:                debugCodeCall("supportsDataDefinitionAndDataManipulationTransactions");
1997:                return false;
1998:            }
1999:
2000:            /**
2001:             * Returns whether only data manipulations are supported in transactions.
2002:             *
2003:             * @return true
2004:             */
2005:            public boolean supportsDataManipulationTransactionsOnly() {
2006:                debugCodeCall("supportsDataManipulationTransactionsOnly");
2007:                return true;
2008:            }
2009:
2010:            /**
2011:             * Returns whether CREATE/DROP commit an open transaction.
2012:             *
2013:             * @return true
2014:             */
2015:            public boolean dataDefinitionCausesTransactionCommit() {
2016:                debugCodeCall("dataDefinitionCausesTransactionCommit");
2017:                return true;
2018:            }
2019:
2020:            /**
2021:             * Returns whether CREATE/DROP do not affect transactions.
2022:             *
2023:             * @return false
2024:             */
2025:            public boolean dataDefinitionIgnoredInTransactions() {
2026:                debugCodeCall("dataDefinitionIgnoredInTransactions");
2027:                return false;
2028:            }
2029:
2030:            /**
2031:             * Returns whether a specific result set type is supported.
2032:             * ResultSet.TYPE_SCROLL_SENSITIVE is not supported.
2033:             *
2034:             * @return true for all types except ResultSet.TYPE_FORWARD_ONLY
2035:             */
2036:            public boolean supportsResultSetType(int type) {
2037:                debugCodeCall("supportsResultSetType", type);
2038:                return type != ResultSet.TYPE_SCROLL_SENSITIVE;
2039:            }
2040:
2041:            /**
2042:             * Returns whether a specific result set concurrency is supported.
2043:             * ResultSet.TYPE_SCROLL_SENSITIVE is not supported.
2044:             *
2045:             * @return true if the type is not ResultSet.TYPE_SCROLL_SENSITIVE
2046:             */
2047:            public boolean supportsResultSetConcurrency(int type,
2048:                    int concurrency) {
2049:                if (debug()) {
2050:                    debugCode("supportsResultSetConcurrency(" + type + ", "
2051:                            + concurrency + ");");
2052:                }
2053:                return type != ResultSet.TYPE_SCROLL_SENSITIVE;
2054:            }
2055:
2056:            /**
2057:             * Returns whether own updates are visible.
2058:             *
2059:             * @return false
2060:             */
2061:            public boolean ownUpdatesAreVisible(int type) {
2062:                debugCodeCall("ownUpdatesAreVisible", type);
2063:                return false;
2064:            }
2065:
2066:            /**
2067:             * Returns whether own deletes are visible.
2068:             *
2069:             * @return false
2070:             */
2071:            public boolean ownDeletesAreVisible(int type) {
2072:                debugCodeCall("ownDeletesAreVisible", type);
2073:                return false;
2074:            }
2075:
2076:            /**
2077:             * Returns whether own inserts are visible.
2078:             * @return false
2079:             */
2080:            public boolean ownInsertsAreVisible(int type) {
2081:                debugCodeCall("ownInsertsAreVisible", type);
2082:                return false;
2083:            }
2084:
2085:            /**
2086:             * Returns whether other updates are visible.
2087:             * @return false
2088:             */
2089:            public boolean othersUpdatesAreVisible(int type) {
2090:                debugCodeCall("othersUpdatesAreVisible", type);
2091:                return false;
2092:            }
2093:
2094:            /**
2095:             * Returns whether other deletes are visible.
2096:             * @return false
2097:             */
2098:            public boolean othersDeletesAreVisible(int type) {
2099:                debugCodeCall("othersDeletesAreVisible", type);
2100:                return false;
2101:            }
2102:
2103:            /**
2104:             * Returns whether other inserts are visible.
2105:             * @return false
2106:             */
2107:            public boolean othersInsertsAreVisible(int type) {
2108:                debugCodeCall("othersInsertsAreVisible", type);
2109:                return false;
2110:            }
2111:
2112:            /**
2113:             * Returns whether updates are detected.
2114:             * @return false
2115:             */
2116:            public boolean updatesAreDetected(int type) {
2117:                debugCodeCall("updatesAreDetected", type);
2118:                return false;
2119:            }
2120:
2121:            /**
2122:             * Returns whether deletes are detected.
2123:             * @return false
2124:             */
2125:            public boolean deletesAreDetected(int type) {
2126:                debugCodeCall("deletesAreDetected", type);
2127:                return false;
2128:            }
2129:
2130:            /**
2131:             * Returns whether inserts are detected.
2132:             * @return false
2133:             */
2134:            public boolean insertsAreDetected(int type) {
2135:                debugCodeCall("insertsAreDetected", type);
2136:                return false;
2137:            }
2138:
2139:            /**
2140:             * Returns whether batch updates are supported.
2141:             * @return true
2142:             */
2143:            public boolean supportsBatchUpdates() {
2144:                debugCodeCall("supportsBatchUpdates");
2145:                return true;
2146:            }
2147:
2148:            /**
2149:             * Returns whether the maximum row size includes blobs.
2150:             * @return false
2151:             */
2152:            public boolean doesMaxRowSizeIncludeBlobs() {
2153:                debugCodeCall("doesMaxRowSizeIncludeBlobs");
2154:                return false;
2155:            }
2156:
2157:            /**
2158:             * Returns the default transaction isolation level.
2159:             * @return Connection.TRANSACTION_READ_COMMITTED
2160:             */
2161:            public int getDefaultTransactionIsolation() {
2162:                debugCodeCall("getDefaultTransactionIsolation");
2163:                return Connection.TRANSACTION_READ_COMMITTED;
2164:            }
2165:
2166:            /**
2167:             * Checks if for CREATE TABLE Test(ID INT), getTables returns Test as the
2168:             * table name.
2169:             * @return false
2170:             */
2171:            public boolean supportsMixedCaseIdentifiers() {
2172:                debugCodeCall("supportsMixedCaseIdentifiers");
2173:                return false;
2174:            }
2175:
2176:            /**
2177:             * Checks if a table created with CREATE TABLE "Test"(ID INT) is a different
2178:             * table than a table created with CREATE TABLE TEST(ID INT).
2179:             * @return true
2180:             */
2181:            public boolean supportsMixedCaseQuotedIdentifiers() {
2182:                debugCodeCall("supportsMixedCaseQuotedIdentifiers");
2183:                return true;
2184:            }
2185:
2186:            /**
2187:             * Checks if for CREATE TABLE Test(ID INT), getTables returns TEST as the
2188:             * table name.
2189:             * @return true
2190:             */
2191:            public boolean storesUpperCaseIdentifiers() {
2192:                debugCodeCall("storesUpperCaseIdentifiers");
2193:                return true;
2194:            }
2195:
2196:            /**
2197:             * Checks if for CREATE TABLE Test(ID INT), getTables returns test as the
2198:             * table name.
2199:             * @return false
2200:             */
2201:            public boolean storesLowerCaseIdentifiers() {
2202:                debugCodeCall("storesLowerCaseIdentifiers");
2203:                return false;
2204:            }
2205:
2206:            /**
2207:             * Checks if for CREATE TABLE Test(ID INT), getTables returns Test as the
2208:             * table name.
2209:             * @return false
2210:             */
2211:            public boolean storesMixedCaseIdentifiers() {
2212:                debugCodeCall("storesMixedCaseIdentifiers");
2213:                return false;
2214:            }
2215:
2216:            /**
2217:             * Checks if for CREATE TABLE "Test"(ID INT), getTables returns TEST as the
2218:             * table name.
2219:             * @return false
2220:             */
2221:            public boolean storesUpperCaseQuotedIdentifiers() {
2222:                debugCodeCall("storesUpperCaseQuotedIdentifiers");
2223:                return false;
2224:            }
2225:
2226:            /**
2227:             * Checks if for CREATE TABLE "Test"(ID INT), getTables returns test as the
2228:             * table name.
2229:             * @return false
2230:             */
2231:            public boolean storesLowerCaseQuotedIdentifiers() {
2232:                debugCodeCall("storesLowerCaseQuotedIdentifiers");
2233:                return false;
2234:            }
2235:
2236:            /**
2237:             * Checks if for CREATE TABLE "Test"(ID INT), getTables returns Test as the
2238:             * table name.
2239:             * @return true
2240:             */
2241:            public boolean storesMixedCaseQuotedIdentifiers() {
2242:                debugCodeCall("storesMixedCaseQuotedIdentifiers");
2243:                return true;
2244:            }
2245:
2246:            /**
2247:             * Returns the maximum length for hex values (characters).
2248:             * @return 0 for limit is unknown
2249:             */
2250:            public int getMaxBinaryLiteralLength() {
2251:                debugCodeCall("getMaxBinaryLiteralLength");
2252:                return 0;
2253:            }
2254:
2255:            /**
2256:             * Returns the maximum length for literals.
2257:             * @return 0 for limit is unknown
2258:             */
2259:            public int getMaxCharLiteralLength() {
2260:                debugCodeCall("getMaxCharLiteralLength");
2261:                return 0;
2262:            }
2263:
2264:            /**
2265:             * Returns the maximum length for column names.
2266:             * @return 0 for limit is unknown
2267:             */
2268:            public int getMaxColumnNameLength() {
2269:                debugCodeCall("getMaxColumnNameLength");
2270:                return 0;
2271:            }
2272:
2273:            /**
2274:             * Returns the maximum number of columns in GROUP BY.
2275:             * @return 0 for limit is unknown
2276:             */
2277:            public int getMaxColumnsInGroupBy() {
2278:                debugCodeCall("getMaxColumnsInGroupBy");
2279:                return 0;
2280:            }
2281:
2282:            /**
2283:             * Returns the maximum number of columns in CREATE INDEX.
2284:             * @return 0 for limit is unknown
2285:             */
2286:            public int getMaxColumnsInIndex() {
2287:                debugCodeCall("getMaxColumnsInIndex");
2288:                return 0;
2289:            }
2290:
2291:            /**
2292:             * Returns the maximum number of columns in ORDER BY.
2293:             * @return 0 for limit is unknown
2294:             */
2295:            public int getMaxColumnsInOrderBy() {
2296:                debugCodeCall("getMaxColumnsInOrderBy");
2297:                return 0;
2298:            }
2299:
2300:            /**
2301:             * Returns the maximum number of columns in SELECT.
2302:             * @return 0 for limit is unknown
2303:             */
2304:            public int getMaxColumnsInSelect() {
2305:                debugCodeCall("getMaxColumnsInSelect");
2306:                return 0;
2307:            }
2308:
2309:            /**
2310:             * Returns the maximum number of columns in CREATE TABLE.
2311:             * @return 0 for limit is unknown
2312:             */
2313:            public int getMaxColumnsInTable() {
2314:                debugCodeCall("getMaxColumnsInTable");
2315:                return 0;
2316:            }
2317:
2318:            /**
2319:             * Returns the maximum number of open connection.
2320:             * @return 0 for limit is unknown
2321:             */
2322:            public int getMaxConnections() {
2323:                debugCodeCall("getMaxConnections");
2324:                return 0;
2325:            }
2326:
2327:            /**
2328:             * Returns the maximum length for a cursor name.
2329:             * @return 0 for limit is unknown
2330:             */
2331:            public int getMaxCursorNameLength() {
2332:                debugCodeCall("getMaxCursorNameLength");
2333:                return 0;
2334:            }
2335:
2336:            /**
2337:             * Returns the maximum length for an index (in bytes).
2338:             * @return 0 for limit is unknown
2339:             */
2340:            public int getMaxIndexLength() {
2341:                debugCodeCall("getMaxIndexLength");
2342:                return 0;
2343:            }
2344:
2345:            /**
2346:             * Returns the maximum length for a schema name.
2347:             * @return 0 for limit is unknown
2348:             */
2349:            public int getMaxSchemaNameLength() {
2350:                debugCodeCall("getMaxSchemaNameLength");
2351:                return 0;
2352:            }
2353:
2354:            /**
2355:             * Returns the maximum length for a procedure name.
2356:             * @return 0 for limit is unknown
2357:             */
2358:            public int getMaxProcedureNameLength() {
2359:                debugCodeCall("getMaxProcedureNameLength");
2360:                return 0;
2361:            }
2362:
2363:            /**
2364:             * Returns the maximum length for a catalog name.
2365:             * @return 0 for limit is unknown
2366:             */
2367:            public int getMaxCatalogNameLength() {
2368:                debugCodeCall("getMaxCatalogNameLength");
2369:                return 0;
2370:            }
2371:
2372:            /**
2373:             * Returns the maximum size of a row (in bytes).
2374:             * @return 0 for limit is unknown
2375:             */
2376:            public int getMaxRowSize() {
2377:                debugCodeCall("getMaxRowSize");
2378:                return 0;
2379:            }
2380:
2381:            /**
2382:             * Returns the maximum length of a statement.
2383:             * @return 0 for limit is unknown
2384:             */
2385:            public int getMaxStatementLength() {
2386:                debugCodeCall("getMaxStatementLength");
2387:                return 0;
2388:            }
2389:
2390:            /**
2391:             * Returns the maximum number of open statements.
2392:             * @return 0 for limit is unknown
2393:             */
2394:            public int getMaxStatements() {
2395:                debugCodeCall("getMaxStatements");
2396:                return 0;
2397:            }
2398:
2399:            /**
2400:             * Returns the maximum length for a table name.
2401:             * @return 0 for limit is unknown
2402:             */
2403:            public int getMaxTableNameLength() {
2404:                debugCodeCall("getMaxTableNameLength");
2405:                return 0;
2406:            }
2407:
2408:            /**
2409:             * Returns the maximum number of tables in a SELECT.
2410:             * @return 0 for limit is unknown
2411:             */
2412:            public int getMaxTablesInSelect() {
2413:                debugCodeCall("getMaxTablesInSelect");
2414:                return 0;
2415:            }
2416:
2417:            /**
2418:             * Returns the maximum length for a user name.
2419:             * @return 0 for limit is unknown
2420:             */
2421:            public int getMaxUserNameLength() {
2422:                debugCodeCall("getMaxUserNameLength");
2423:                return 0;
2424:            }
2425:
2426:            /**
2427:             * Does the database support savepoints.
2428:             * @return true
2429:             */
2430:            public boolean supportsSavepoints() {
2431:                debugCodeCall("supportsSavepoints");
2432:                return true;
2433:            }
2434:
2435:            /**
2436:             * Does the database support named parameters.
2437:             * @return false
2438:             */
2439:            public boolean supportsNamedParameters() {
2440:                debugCodeCall("supportsNamedParameters");
2441:                return false;
2442:            }
2443:
2444:            /**
2445:             * Does the database support multiple open result sets.
2446:             * @return true
2447:             */
2448:            public boolean supportsMultipleOpenResults() {
2449:                debugCodeCall("supportsMultipleOpenResults");
2450:                return true;
2451:            }
2452:
2453:            /**
2454:             * Does the database support getGeneratedKeys.
2455:             * @return true
2456:             */
2457:            public boolean supportsGetGeneratedKeys() {
2458:                debugCodeCall("supportsGetGeneratedKeys");
2459:                return true;
2460:            }
2461:
2462:            /**
2463:             * [Not supported]
2464:             */
2465:            public ResultSet getSuperTypes(String catalog,
2466:                    String schemaPattern, String typeNamePattern)
2467:                    throws SQLException {
2468:                try {
2469:                    if (debug()) {
2470:                        debugCode("getSuperTypes(" + quote(catalog) + ", "
2471:                                + quote(schemaPattern) + ", "
2472:                                + quote(typeNamePattern) + ");");
2473:                    }
2474:                    throw Message.getUnsupportedException();
2475:                } catch (Throwable e) {
2476:                    throw logAndConvert(e);
2477:                }
2478:            }
2479:
2480:            /**
2481:             * Get the list of super tables of a table.
2482:             * This method currently returns an empty result set.
2483:             *
2484:             * <ul>
2485:             * <li>1 TABLE_CAT (String) table catalog
2486:             * </li><li>2 TABLE_SCHEM (String) table schema
2487:             * </li><li>3 TABLE_NAME (String) table name
2488:             * </li><li>4 SUPERTABLE_NAME (String) the name of the super table
2489:             * </li></ul>
2490:             *
2491:             * @return an empty result set
2492:             */
2493:            public ResultSet getSuperTables(String catalog,
2494:                    String schemaPattern, String tableNamePattern)
2495:                    throws SQLException {
2496:                try {
2497:                    if (debug()) {
2498:                        debugCode("getSuperTables(" + quote(catalog) + ", "
2499:                                + quote(schemaPattern) + ", "
2500:                                + quote(tableNamePattern) + ");");
2501:                    }
2502:                    checkClosed();
2503:                    PreparedStatement prep = conn
2504:                            .prepareAutoCloseStatement("SELECT "
2505:                                    + "CATALOG_NAME TABLE_CAT, "
2506:                                    + "CATALOG_NAME TABLE_SCHEM, "
2507:                                    + "CATALOG_NAME TABLE_NAME, "
2508:                                    + "CATALOG_NAME SUPERTABLE_NAME "
2509:                                    + "FROM INFORMATION_SCHEMA.CATALOGS "
2510:                                    + "WHERE FALSE");
2511:                    return prep.executeQuery();
2512:                } catch (Throwable e) {
2513:                    throw logAndConvert(e);
2514:                }
2515:            }
2516:
2517:            /**
2518:             * [Not supported]
2519:             */
2520:            public ResultSet getAttributes(String catalog,
2521:                    String schemaPattern, String typeNamePattern,
2522:                    String attributeNamePattern) throws SQLException {
2523:                try {
2524:                    if (debug()) {
2525:                        debugCode("getAttributes(" + quote(catalog) + ", "
2526:                                + quote(schemaPattern) + ", "
2527:                                + quote(typeNamePattern) + ", "
2528:                                + quote(attributeNamePattern) + ");");
2529:                    }
2530:                    throw Message.getUnsupportedException();
2531:                } catch (Throwable e) {
2532:                    throw logAndConvert(e);
2533:                }
2534:            }
2535:
2536:            /**
2537:             * Does this database supports a result set holdability.
2538:             * 
2539:             * @param holdability ResultSet.HOLD_CURSORS_OVER_COMMIT or
2540:             *            CLOSE_CURSORS_AT_COMMIT
2541:             * @return true if the holdability is ResultSet.CLOSE_CURSORS_AT_COMMIT
2542:             */
2543:            //#ifdef JDK14
2544:            public boolean supportsResultSetHoldability(int holdability) {
2545:                debugCodeCall("supportsResultSetHoldability", holdability);
2546:                return holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT;
2547:            }
2548:
2549:            //#endif
2550:
2551:            /**
2552:             * Gets the result set holdability.
2553:             * @return ResultSet.CLOSE_CURSORS_AT_COMMIT
2554:             */
2555:            //#ifdef JDK14
2556:            public int getResultSetHoldability() {
2557:                debugCodeCall("getResultSetHoldability");
2558:                return ResultSet.CLOSE_CURSORS_AT_COMMIT;
2559:            }
2560:
2561:            //#endif
2562:
2563:            /**
2564:             * Gets the major version of the database.
2565:             * @return the major version
2566:             */
2567:            public int getDatabaseMajorVersion() {
2568:                debugCodeCall("getDatabaseMajorVersion");
2569:                return Constants.VERSION_MAJOR;
2570:            }
2571:
2572:            /**
2573:             * Gets the minor version of the database.
2574:             * @return the minor version
2575:             */
2576:            public int getDatabaseMinorVersion() {
2577:                debugCodeCall("getDatabaseMinorVersion");
2578:                return Constants.VERSION_MINOR;
2579:            }
2580:
2581:            /**
2582:             * Gets the major version of the supported JDBC API.
2583:             * @return the major version
2584:             */
2585:            public int getJDBCMajorVersion() throws SQLException {
2586:                debugCodeCall("getJDBCMajorVersion");
2587:                return Constants.VERSION_JDBC_MAJOR;
2588:            }
2589:
2590:            /**
2591:             * Gets the minor version of the supported JDBC API.
2592:             * @return the minor version
2593:             */
2594:            public int getJDBCMinorVersion() throws SQLException {
2595:                debugCodeCall("getJDBCMinorVersion");
2596:                return Constants.VERSION_JDBC_MINOR;
2597:            }
2598:
2599:            /**
2600:             * Gets the SQL State type.
2601:             * @return DatabaseMetaData.sqlStateSQL99
2602:             */
2603:            //#ifdef JDK14
2604:            public int getSQLStateType() {
2605:                debugCodeCall("getSQLStateType");
2606:                return DatabaseMetaData.sqlStateSQL99;
2607:            }
2608:
2609:            //#endif
2610:
2611:            /**
2612:             * Does the database make a copy before updating.
2613:             * @return false
2614:             */
2615:            public boolean locatorsUpdateCopy() {
2616:                debugCodeCall("locatorsUpdateCopy");
2617:                return false;
2618:            }
2619:
2620:            /**
2621:             * Does the database support statement pooling.
2622:             * @return false
2623:             */
2624:            public boolean supportsStatementPooling() {
2625:                debugCodeCall("supportsStatementPooling");
2626:                return false;
2627:            }
2628:
2629:            // =============================================================
2630:
2631:            JdbcDatabaseMetaData(JdbcConnection conn, Trace trace, int id) {
2632:                setTrace(trace, TraceObject.DATABASE_META_DATA, id);
2633:                this .conn = conn;
2634:            }
2635:
2636:            private void checkClosed() throws SQLException {
2637:                conn.checkClosed();
2638:            }
2639:
2640:            private String getPattern(String pattern) {
2641:                return pattern == null ? "%" : pattern;
2642:            }
2643:
2644:            private String getSchemaPattern(String pattern) {
2645:                return pattern == null ? "%"
2646:                        : pattern.length() == 0 ? Constants.SCHEMA_MAIN
2647:                                : pattern;
2648:            }
2649:
2650:            private String getCatalogPattern(String catalogPattern) {
2651:                // Workaround for OpenOffice: getColumns is called with "" as the catalog
2652:                return catalogPattern == null || catalogPattern.length() == 0 ? "%"
2653:                        : catalogPattern;
2654:            }
2655:
2656:            /**
2657:             * Get the lifetime of a rowid.
2658:             * @return ROWID_UNSUPPORTED
2659:             */
2660:            //#ifdef JDK16
2661:            /*
2662:             public RowIdLifetime getRowIdLifetime() {
2663:             debugCodeCall("getRowIdLifetime");
2664:             return RowIdLifetime.ROWID_UNSUPPORTED;
2665:             }
2666:             */
2667:            //#endif
2668:            /**
2669:             * [Not supported] Gets the list of schemas.
2670:             */
2671:            public ResultSet getSchemas(String catalog, String schemaPattern)
2672:                    throws SQLException {
2673:                debugCodeCall("getSchemas");
2674:                throw Message.getUnsupportedException();
2675:            }
2676:
2677:            /**
2678:             * Returns whether the database supports calling functions using the call syntax.
2679:             * @return true
2680:             */
2681:            public boolean supportsStoredFunctionsUsingCallSyntax()
2682:                    throws SQLException {
2683:                debugCodeCall("supportsStoredFunctionsUsingCallSyntax");
2684:                return true;
2685:            }
2686:
2687:            /**
2688:             * Returns whether an exception while auto commit is on closes all result sets.
2689:             * @return false
2690:             */
2691:            public boolean autoCommitFailureClosesAllResultSets()
2692:                    throws SQLException {
2693:                debugCodeCall("autoCommitFailureClosesAllResultSets");
2694:                return false;
2695:            }
2696:
2697:            /**
2698:             * [Not supported] Returns the client info properties.
2699:             */
2700:            public ResultSet getClientInfoProperties() throws SQLException {
2701:                debugCodeCall("getClientInfoProperties");
2702:                throw Message.getUnsupportedException();
2703:            }
2704:
2705:            /**
2706:             * [Not supported] Return an object of this class if possible.
2707:             */
2708:            //#ifdef JDK16
2709:            /*
2710:             public <T> T unwrap(Class<T> iface) throws SQLException {
2711:             debugCodeCall("unwrap");
2712:             throw Message.getUnsupportedException();
2713:             }
2714:             */
2715:            //#endif
2716:            /**
2717:             * [Not supported] Checks if unwrap can return an object of this class.
2718:             */
2719:            //#ifdef JDK16
2720:            /*
2721:             public boolean isWrapperFor(Class< ? > iface) throws SQLException {
2722:             debugCodeCall("isWrapperFor");
2723:             throw Message.getUnsupportedException();
2724:             }
2725:             */
2726:            //#endif
2727:            /**
2728:             * [Not supported] Gets the list of function columns.
2729:             */
2730:            public ResultSet getFunctionColumns(String catalog,
2731:                    String schemaPattern, String functionNamePattern,
2732:                    String columnNamePattern) throws SQLException {
2733:                debugCodeCall("getFunctionColumns");
2734:                throw Message.getUnsupportedException();
2735:            }
2736:
2737:            /**
2738:             * [Not supported] Gets the list of functions.
2739:             */
2740:            public ResultSet getFunctions(String arg0, String arg1, String arg2)
2741:                    throws SQLException {
2742:                debugCodeCall("getFunctions");
2743:                throw Message.getUnsupportedException();
2744:            }
2745:
2746:            /**
2747:             * INTERNAL
2748:             */
2749:            public String toString() {
2750:                return getTraceObjectName() + ": " + conn;
2751:            }
2752:
2753:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.