comparison src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java @ 352:f62137dd6050

Remove spaces from static SQL predicates: 1 = 0 and 1 = 1.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Wed, 22 Jan 2020 16:46:21 +0100 (2020-01-22)
parents 54137aeb1f92
children eabbc5bf7cdb
comparison
equal deleted inserted replaced
350:54137aeb1f92 352:f62137dd6050
1639 .append(useCommentsTable ? "COALESCE(cm.\"remark\", cast(f.\"func\" as varchar(9999)))" : "cast(f.\"func\" as varchar(9999))").append(" AS \"REMARKS\", " + 1639 .append(useCommentsTable ? "COALESCE(cm.\"remark\", cast(f.\"func\" as varchar(9999)))" : "cast(f.\"func\" as varchar(9999))").append(" AS \"REMARKS\", " +
1640 // in MonetDB procedures have no return value by design. 1640 // in MonetDB procedures have no return value by design.
1641 "cast(").append(DatabaseMetaData.procedureNoResult).append(" AS smallint) AS \"PROCEDURE_TYPE\", " + 1641 "cast(").append(DatabaseMetaData.procedureNoResult).append(" AS smallint) AS \"PROCEDURE_TYPE\", " +
1642 // only the id value uniquely identifies a procedure. Include it to be able to differentiate between multiple overloaded procedures with the same name 1642 // only the id value uniquely identifies a procedure. Include it to be able to differentiate between multiple overloaded procedures with the same name
1643 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " + 1643 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " +
1644 "FROM \"sys\".\"functions\" f JOIN \"sys\".\"schemas\" s ON (f.\"schema_id\" = s.\"id\") "); 1644 "FROM \"sys\".\"functions\" f JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" ");
1645 if (useCommentsTable) { 1645 if (useCommentsTable) {
1646 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON (f.\"id\" = cm.\"id\") "); 1646 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON f.\"id\" = cm.\"id\" ");
1647 } 1647 }
1648 // include procedures only (type = 2). Others will be returned via getFunctions() 1648 // include procedures only (type = 2). Others will be returned via getFunctions()
1649 query.append("WHERE f.\"type\" = 2"); 1649 query.append("WHERE f.\"type\" = 2");
1650 1650
1651 if (catalog != null && !catalog.isEmpty()) { 1651 if (catalog != null && !catalog.isEmpty()) {
1652 // non-empty catalog selection. 1652 // non-empty catalog selection.
1653 // as we do not support catalogs this always results in no rows returned 1653 // as we do not support catalogs this always results in no rows returned
1654 query.append(" AND 1 = 0"); 1654 query.append(" AND 1=0");
1655 } else { 1655 } else {
1656 if (schemaPattern != null && !schemaPattern.equals("%")) { 1656 if (schemaPattern != null && !schemaPattern.equals("%")) {
1657 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 1657 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
1658 } 1658 }
1659 if (procedureNamePattern != null && !procedureNamePattern.equals("%")) { 1659 if (procedureNamePattern != null && !procedureNamePattern.equals("%")) {
1766 "cast(a.\"number\" + 1 as int) AS \"ORDINAL_POSITION\", " + 1766 "cast(a.\"number\" + 1 as int) AS \"ORDINAL_POSITION\", " +
1767 "cast('' as varchar(3)) AS \"IS_NULLABLE\", " + 1767 "cast('' as varchar(3)) AS \"IS_NULLABLE\", " +
1768 // the specific name contains the function id, in order to be able to match the args to the correct overloaded procedure name 1768 // the specific name contains the function id, in order to be able to match the args to the correct overloaded procedure name
1769 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " + 1769 "cast(f.\"id\" as varchar(10)) AS \"SPECIFIC_NAME\" " +
1770 "FROM \"sys\".\"args\" a " + 1770 "FROM \"sys\".\"args\" a " +
1771 "JOIN \"sys\".\"functions\" f ON (a.\"func_id\" = f.\"id\") " + 1771 "JOIN \"sys\".\"functions\" f ON a.\"func_id\" = f.\"id\" " +
1772 "JOIN \"sys\".\"schemas\" s ON (f.\"schema_id\" = s.\"id\") " + 1772 "JOIN \"sys\".\"schemas\" s ON f.\"schema_id\" = s.\"id\" " +
1773 // include procedures only (type = 2). Others will be returned via getFunctionColumns() 1773 // include procedures only (type = 2). Others will be returned via getFunctionColumns()
1774 "WHERE f.\"type\" = 2"); 1774 "WHERE f.\"type\" = 2");
1775 1775
1776 if (catalog != null && !catalog.isEmpty()) { 1776 if (catalog != null && !catalog.isEmpty()) {
1777 // non-empty catalog selection. 1777 // non-empty catalog selection.
1778 // as we do not support catalogs this always results in no rows returned 1778 // as we do not support catalogs this always results in no rows returned
1779 query.append(" AND 1 = 0"); 1779 query.append(" AND 1=0");
1780 } else { 1780 } else {
1781 if (schemaPattern != null && !schemaPattern.equals("%")) { 1781 if (schemaPattern != null && !schemaPattern.equals("%")) {
1782 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 1782 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
1783 } 1783 }
1784 if (procedureNamePattern != null && !procedureNamePattern.equals("%")) { 1784 if (procedureNamePattern != null && !procedureNamePattern.equals("%")) {
1878 } 1878 }
1879 query.append("JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" "); 1879 query.append("JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" ");
1880 if (useCommentsTable) { 1880 if (useCommentsTable) {
1881 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON t.\"id\" = cm.\"id\" "); 1881 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON t.\"id\" = cm.\"id\" ");
1882 } 1882 }
1883 query.append("WHERE 1 = 1"); 1883 query.append("WHERE 1=1");
1884 1884
1885 if (catalog != null && !catalog.isEmpty()) { 1885 if (catalog != null && !catalog.isEmpty()) {
1886 // non-empty catalog selection. 1886 // non-empty catalog selection.
1887 // as we do not support catalogs this always results in no rows returned 1887 // as we do not support catalogs this always results in no rows returned
1888 query.append(" AND 1 = 0"); 1888 query.append(" AND 1=0");
1889 } else { 1889 } else {
1890 if (schemaPattern != null && !schemaPattern.equals("%")) { 1890 if (schemaPattern != null && !schemaPattern.equals("%")) {
1891 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 1891 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
1892 } 1892 }
1893 if (tableNamePattern != null && !tableNamePattern.equals("%")) { 1893 if (tableNamePattern != null && !tableNamePattern.equals("%")) {
1946 "FROM \"sys\".\"schemas\""); 1946 "FROM \"sys\".\"schemas\"");
1947 1947
1948 if (catalog != null && !catalog.isEmpty()) { 1948 if (catalog != null && !catalog.isEmpty()) {
1949 // non-empty catalog selection. 1949 // non-empty catalog selection.
1950 // as we do not support catalogs this always results in no rows returned 1950 // as we do not support catalogs this always results in no rows returned
1951 query.append(" WHERE 1 = 0"); 1951 query.append(" WHERE 1=0");
1952 } else { 1952 } else {
1953 if (schemaPattern != null && !schemaPattern.equals("%")) { 1953 if (schemaPattern != null && !schemaPattern.equals("%")) {
1954 query.append(" WHERE \"name\" ").append(composeMatchPart(schemaPattern)); 1954 query.append(" WHERE \"name\" ").append(composeMatchPart(schemaPattern));
1955 } 1955 }
1956 } 1956 }
1975 */ 1975 */
1976 @Override 1976 @Override
1977 public ResultSet getCatalogs() throws SQLException { 1977 public ResultSet getCatalogs() throws SQLException {
1978 // MonetDB does NOT support catalogs. 1978 // MonetDB does NOT support catalogs.
1979 // Return a resultset with no rows 1979 // Return a resultset with no rows
1980 return executeMetaDataQuery("SELECT cast(null as char(1)) AS \"TABLE_CAT\" WHERE 1 = 0"); 1980 return executeMetaDataQuery("SELECT cast(null as char(1)) AS \"TABLE_CAT\" WHERE 1=0");
1981 } 1981 }
1982 1982
1983 /** 1983 /**
1984 * Get the table types available in this database. 1984 * Get the table types available in this database.
1985 * The results are ordered by table type. 1985 * The results are ordered by table type.
2125 "JOIN \"sys\".\"tables\" t ON c.\"table_id\" = t.\"id\" " + 2125 "JOIN \"sys\".\"tables\" t ON c.\"table_id\" = t.\"id\" " +
2126 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" "); 2126 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" ");
2127 if (useCommentsTable) { 2127 if (useCommentsTable) {
2128 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON c.\"id\" = cm.\"id\" "); 2128 query.append("LEFT OUTER JOIN \"sys\".\"comments\" cm ON c.\"id\" = cm.\"id\" ");
2129 } 2129 }
2130 query.append("WHERE 1 = 1"); 2130 query.append("WHERE 1=1");
2131 2131
2132 if (catalog != null && !catalog.isEmpty()) { 2132 if (catalog != null && !catalog.isEmpty()) {
2133 // non-empty catalog selection. 2133 // non-empty catalog selection.
2134 // as we do not support catalogs this always results in no rows returned 2134 // as we do not support catalogs this always results in no rows returned
2135 query.append(" AND 1 = 0"); 2135 query.append(" AND 1=0");
2136 } else { 2136 } else {
2137 if (schemaPattern != null && !schemaPattern.equals("%")) { 2137 if (schemaPattern != null && !schemaPattern.equals("%")) {
2138 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 2138 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
2139 } 2139 }
2140 if (tableNamePattern != null && !tableNamePattern.equals("%")) { 2140 if (tableNamePattern != null && !tableNamePattern.equals("%")) {
2219 "JOIN \"sys\".\"auths\" grantors ON p.\"grantor\" = grantors.\"id\" " + 2219 "JOIN \"sys\".\"auths\" grantors ON p.\"grantor\" = grantors.\"id\" " +
2220 "JOIN \"sys\".\"auths\" grantees ON p.\"auth_id\" = grantees.\"id\" "); 2220 "JOIN \"sys\".\"auths\" grantees ON p.\"auth_id\" = grantees.\"id\" ");
2221 if (usePrivilege_codesTable) { 2221 if (usePrivilege_codesTable) {
2222 query.append("JOIN \"sys\".\"privilege_codes\" pc ON p.\"privileges\" = pc.\"privilege_code_id\" "); 2222 query.append("JOIN \"sys\".\"privilege_codes\" pc ON p.\"privileges\" = pc.\"privilege_code_id\" ");
2223 } 2223 }
2224 query.append("WHERE 1 = 1"); 2224 query.append("WHERE 1=1");
2225 2225
2226 if (catalog != null && !catalog.isEmpty()) { 2226 if (catalog != null && !catalog.isEmpty()) {
2227 // non-empty catalog selection. 2227 // non-empty catalog selection.
2228 // as we do not support catalogs this always results in no rows returned 2228 // as we do not support catalogs this always results in no rows returned
2229 query.append(" AND 1 = 0"); 2229 query.append(" AND 1=0");
2230 } else { 2230 } else {
2231 if (schemaPattern != null && !schemaPattern.equals("%")) { 2231 if (schemaPattern != null && !schemaPattern.equals("%")) {
2232 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 2232 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
2233 } 2233 }
2234 if (tableNamePattern != null && !tableNamePattern.equals("%")) { 2234 if (tableNamePattern != null && !tableNamePattern.equals("%")) {
2308 "JOIN \"sys\".\"auths\" grantors ON p.\"grantor\" = grantors.\"id\" " + 2308 "JOIN \"sys\".\"auths\" grantors ON p.\"grantor\" = grantors.\"id\" " +
2309 "JOIN \"sys\".\"auths\" grantees ON p.\"auth_id\" = grantees.\"id\" "); 2309 "JOIN \"sys\".\"auths\" grantees ON p.\"auth_id\" = grantees.\"id\" ");
2310 if (usePrivilege_codesTable) { 2310 if (usePrivilege_codesTable) {
2311 query.append("JOIN \"sys\".\"privilege_codes\" pc ON p.\"privileges\" = pc.\"privilege_code_id\" "); 2311 query.append("JOIN \"sys\".\"privilege_codes\" pc ON p.\"privileges\" = pc.\"privilege_code_id\" ");
2312 } 2312 }
2313 query.append("WHERE 1 = 1"); 2313 query.append("WHERE 1=1");
2314 2314
2315 if (catalog != null && !catalog.isEmpty()) { 2315 if (catalog != null && !catalog.isEmpty()) {
2316 // non-empty catalog selection. 2316 // non-empty catalog selection.
2317 // as we do not support catalogs this always results in no rows returned 2317 // as we do not support catalogs this always results in no rows returned
2318 query.append(" AND 1 = 0"); 2318 query.append(" AND 1=0");
2319 } else { 2319 } else {
2320 if (schemaPattern != null && !schemaPattern.equals("%")) { 2320 if (schemaPattern != null && !schemaPattern.equals("%")) {
2321 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 2321 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
2322 } 2322 }
2323 if (tableNamePattern != null && !tableNamePattern.equals("%")) { 2323 if (tableNamePattern != null && !tableNamePattern.equals("%")) {
2408 // TODO: when there is no PK and there are multiple unique constraints, pick only the unique constraint which has a) the least number of columns and b) the smallest total(size in bytes) 2408 // TODO: when there is no PK and there are multiple unique constraints, pick only the unique constraint which has a) the least number of columns and b) the smallest total(size in bytes)
2409 2409
2410 if (catalog != null && !catalog.isEmpty()) { 2410 if (catalog != null && !catalog.isEmpty()) {
2411 // non-empty catalog selection. 2411 // non-empty catalog selection.
2412 // as we do not support catalogs this always results in no rows returned 2412 // as we do not support catalogs this always results in no rows returned
2413 query.append(" AND 1 = 0"); 2413 query.append(" AND 1=0");
2414 } else { 2414 } else {
2415 if (scope == DatabaseMetaData.bestRowSession 2415 if (scope == DatabaseMetaData.bestRowSession
2416 || scope == DatabaseMetaData.bestRowTransaction 2416 || scope == DatabaseMetaData.bestRowTransaction
2417 || scope == DatabaseMetaData.bestRowTemporary) { 2417 || scope == DatabaseMetaData.bestRowTemporary) {
2418 if (schema != null && !schema.equals("%")) { 2418 if (schema != null && !schema.equals("%")) {
2423 } 2423 }
2424 if (!nullable) { 2424 if (!nullable) {
2425 query.append(" AND c.\"null\" = false"); 2425 query.append(" AND c.\"null\" = false");
2426 } 2426 }
2427 } else { 2427 } else {
2428 query.append(" AND 1 = 0"); 2428 query.append(" AND 1=0");
2429 } 2429 }
2430 } 2430 }
2431 2431
2432 query.append(" ORDER BY \"SCOPE\", o.\"nr\", \"COLUMN_NAME\""); 2432 query.append(" ORDER BY \"SCOPE\", o.\"nr\", \"COLUMN_NAME\"");
2433 2433
2477 "cast(null as char(1)) AS \"TYPE_NAME\", " + 2477 "cast(null as char(1)) AS \"TYPE_NAME\", " +
2478 "cast(0 as int) AS \"COLUMN_SIZE\", " + 2478 "cast(0 as int) AS \"COLUMN_SIZE\", " +
2479 "cast(0 as int) AS \"BUFFER_LENGTH\", " + 2479 "cast(0 as int) AS \"BUFFER_LENGTH\", " +
2480 "cast(0 as smallint) AS \"DECIMAL_DIGITS\", " + 2480 "cast(0 as smallint) AS \"DECIMAL_DIGITS\", " +
2481 "cast(0 as smallint) AS \"PSEUDO_COLUMN\" " + 2481 "cast(0 as smallint) AS \"PSEUDO_COLUMN\" " +
2482 "WHERE 1 = 0"; 2482 "WHERE 1=0";
2483 2483
2484 return executeMetaDataQuery(query); 2484 return executeMetaDataQuery(query);
2485 } 2485 }
2486 2486
2487 /** 2487 /**
2526 "WHERE k.\"type\" = 0"); // only primary keys (type = 0) 2526 "WHERE k.\"type\" = 0"); // only primary keys (type = 0)
2527 2527
2528 if (catalog != null && !catalog.isEmpty()) { 2528 if (catalog != null && !catalog.isEmpty()) {
2529 // non-empty catalog selection. 2529 // non-empty catalog selection.
2530 // as we do not support catalogs this always results in no rows returned 2530 // as we do not support catalogs this always results in no rows returned
2531 query.append(" AND 1 = 0"); 2531 query.append(" AND 1=0");
2532 } else { 2532 } else {
2533 if (schema != null && !schema.equals("%")) { 2533 if (schema != null && !schema.equals("%")) {
2534 query.append(" AND s.\"name\" ").append(composeMatchPart(schema)); 2534 query.append(" AND s.\"name\" ").append(composeMatchPart(schema));
2535 } 2535 }
2536 if (table != null && !table.equals("%")) { 2536 if (table != null && !table.equals("%")) {
2641 query.append(keyQuery); 2641 query.append(keyQuery);
2642 2642
2643 if (catalog != null && !catalog.isEmpty()) { 2643 if (catalog != null && !catalog.isEmpty()) {
2644 // non-empty catalog selection. 2644 // non-empty catalog selection.
2645 // as we do not support catalogs this always results in no rows returned 2645 // as we do not support catalogs this always results in no rows returned
2646 query.append(" AND 1 = 0"); 2646 query.append(" AND 1=0");
2647 } else { 2647 } else {
2648 if (schema != null && !schema.equals("%")) { 2648 if (schema != null && !schema.equals("%")) {
2649 query.append(" AND fkschema.\"name\" ").append(composeMatchPart(schema)); 2649 query.append(" AND fkschema.\"name\" ").append(composeMatchPart(schema));
2650 } 2650 }
2651 if (table != null && !table.equals("%")) { 2651 if (table != null && !table.equals("%")) {
2729 query.append(keyQuery); 2729 query.append(keyQuery);
2730 2730
2731 if (catalog != null && !catalog.isEmpty()) { 2731 if (catalog != null && !catalog.isEmpty()) {
2732 // non-empty catalog selection. 2732 // non-empty catalog selection.
2733 // as we do not support catalogs this always results in no rows returned 2733 // as we do not support catalogs this always results in no rows returned
2734 query.append(" AND 1 = 0"); 2734 query.append(" AND 1=0");
2735 } else { 2735 } else {
2736 if (schema != null && !schema.equals("%")) { 2736 if (schema != null && !schema.equals("%")) {
2737 query.append(" AND pkschema.\"name\" ").append(composeMatchPart(schema)); 2737 query.append(" AND pkschema.\"name\" ").append(composeMatchPart(schema));
2738 } 2738 }
2739 if (table != null && !table.equals("%")) { 2739 if (table != null && !table.equals("%")) {
2828 2828
2829 if ((pcatalog != null && !pcatalog.isEmpty()) 2829 if ((pcatalog != null && !pcatalog.isEmpty())
2830 || (fcatalog != null && !fcatalog.isEmpty())) { 2830 || (fcatalog != null && !fcatalog.isEmpty())) {
2831 // non-empty catalog selection. 2831 // non-empty catalog selection.
2832 // as we do not support catalogs this always results in no rows returned 2832 // as we do not support catalogs this always results in no rows returned
2833 query.append(" AND 1 = 0"); 2833 query.append(" AND 1=0");
2834 } else { 2834 } else {
2835 if (pschema != null && !pschema.equals("%")) { 2835 if (pschema != null && !pschema.equals("%")) {
2836 query.append(" AND pkschema.\"name\" ").append(composeMatchPart(pschema)); 2836 query.append(" AND pkschema.\"name\" ").append(composeMatchPart(pschema));
2837 } 2837 }
2838 if (ptable != null && !ptable.equals("%")) { 2838 if (ptable != null && !ptable.equals("%")) {
3039 "JOIN \"sys\".\"tables\" t ON i.\"table_id\" = t.\"id\" " + 3039 "JOIN \"sys\".\"tables\" t ON i.\"table_id\" = t.\"id\" " +
3040 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + 3040 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " +
3041 "JOIN \"sys\".\"objects\" o ON i.\"id\" = o.\"id\" " + 3041 "JOIN \"sys\".\"objects\" o ON i.\"id\" = o.\"id\" " +
3042 "JOIN \"sys\".\"columns\" c ON (t.\"id\" = c.\"table_id\" AND o.\"name\" = c.\"name\") " + 3042 "JOIN \"sys\".\"columns\" c ON (t.\"id\" = c.\"table_id\" AND o.\"name\" = c.\"name\") " +
3043 "LEFT OUTER JOIN \"sys\".\"keys\" k ON (i.\"name\" = k.\"name\" AND i.\"table_id\" = k.\"table_id\" AND k.\"type\" IN (0,1)) " + // primary (0) and unique keys (1) only 3043 "LEFT OUTER JOIN \"sys\".\"keys\" k ON (i.\"name\" = k.\"name\" AND i.\"table_id\" = k.\"table_id\" AND k.\"type\" IN (0,1)) " + // primary (0) and unique keys (1) only
3044 "WHERE 1 = 1"); 3044 "WHERE 1=1");
3045 3045
3046 if (catalog != null && !catalog.isEmpty()) { 3046 if (catalog != null && !catalog.isEmpty()) {
3047 // non-empty catalog selection. 3047 // non-empty catalog selection.
3048 // as we do not support catalogs this always results in no rows returned 3048 // as we do not support catalogs this always results in no rows returned
3049 query.append(" AND 1 = 0"); 3049 query.append(" AND 1=0");
3050 } else { 3050 } else {
3051 if (schema != null && !schema.equals("%")) { 3051 if (schema != null && !schema.equals("%")) {
3052 query.append(" AND s.\"name\" ").append(composeMatchPart(schema)); 3052 query.append(" AND s.\"name\" ").append(composeMatchPart(schema));
3053 } 3053 }
3054 if (table != null && !table.equals("%")) { 3054 if (table != null && !table.equals("%")) {
3211 "WHERE t.\"id\" > 99 AND t.\"eclass\" >= 15"); 3211 "WHERE t.\"id\" > 99 AND t.\"eclass\" >= 15");
3212 3212
3213 if (catalog != null && !catalog.isEmpty()) { 3213 if (catalog != null && !catalog.isEmpty()) {
3214 // non-empty catalog selection. 3214 // non-empty catalog selection.
3215 // as we do not support catalogs this always results in no rows returned 3215 // as we do not support catalogs this always results in no rows returned
3216 query.append(" AND 1 = 0"); 3216 query.append(" AND 1=0");
3217 } else { 3217 } else {
3218 if (schemaPattern != null && !schemaPattern.equals("%")) { 3218 if (schemaPattern != null && !schemaPattern.equals("%")) {
3219 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 3219 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
3220 } 3220 }
3221 if (typeNamePattern != null && !typeNamePattern.equals("%")) { 3221 if (typeNamePattern != null && !typeNamePattern.equals("%")) {
3354 ) throws SQLException 3354 ) throws SQLException
3355 { 3355 {
3356 final String query = 3356 final String query =
3357 "SELECT cast(null as char(1)) AS \"TYPE_CAT\", '' AS \"TYPE_SCHEM\", '' AS \"TYPE_NAME\", " + 3357 "SELECT cast(null as char(1)) AS \"TYPE_CAT\", '' AS \"TYPE_SCHEM\", '' AS \"TYPE_NAME\", " +
3358 "cast(null as char(1)) AS \"SUPERTYPE_CAT\", '' AS \"SUPERTYPE_SCHEM\", '' AS \"SUPERTYPE_NAME\" " + 3358 "cast(null as char(1)) AS \"SUPERTYPE_CAT\", '' AS \"SUPERTYPE_SCHEM\", '' AS \"SUPERTYPE_NAME\" " +
3359 "WHERE 1 = 0"; 3359 "WHERE 1=0";
3360 3360
3361 return executeMetaDataQuery(query); 3361 return executeMetaDataQuery(query);
3362 } 3362 }
3363 3363
3364 /** 3364 /**
3399 ) throws SQLException 3399 ) throws SQLException
3400 { 3400 {
3401 final String query = 3401 final String query =
3402 "SELECT cast(null as char(1)) AS \"TABLE_CAT\", " + 3402 "SELECT cast(null as char(1)) AS \"TABLE_CAT\", " +
3403 "'' AS \"TABLE_SCHEM\", '' AS \"TABLE_NAME\", '' AS \"SUPERTABLE_NAME\" " + 3403 "'' AS \"TABLE_SCHEM\", '' AS \"TABLE_NAME\", '' AS \"SUPERTABLE_NAME\" " +
3404 "WHERE 1 = 0"; 3404 "WHERE 1=0";
3405 3405
3406 return executeMetaDataQuery(query); 3406 return executeMetaDataQuery(query);
3407 } 3407 }
3408 3408
3409 /** 3409 /**
3490 "'' AS \"REMARKS\", '' AS \"ATTR_DEF\", cast(0 as int) AS \"SQL_DATA_TYPE\", " + 3490 "'' AS \"REMARKS\", '' AS \"ATTR_DEF\", cast(0 as int) AS \"SQL_DATA_TYPE\", " +
3491 "cast(0 as int) AS \"SQL_DATETIME_SUB\", cast(0 as int) AS \"CHAR_OCTET_LENGTH\", " + 3491 "cast(0 as int) AS \"SQL_DATETIME_SUB\", cast(0 as int) AS \"CHAR_OCTET_LENGTH\", " +
3492 "cast(0 as int) AS \"ORDINAL_POSITION\", 'YES' AS \"IS_NULLABLE\", " + 3492 "cast(0 as int) AS \"ORDINAL_POSITION\", 'YES' AS \"IS_NULLABLE\", " +
3493 "'' AS \"SCOPE_CATALOG\", '' AS \"SCOPE_SCHEMA\", '' AS \"SCOPE_TABLE\", " + 3493 "'' AS \"SCOPE_CATALOG\", '' AS \"SCOPE_SCHEMA\", '' AS \"SCOPE_TABLE\", " +
3494 "cast(0 as smallint) AS \"SOURCE_DATA_TYPE\" " + 3494 "cast(0 as smallint) AS \"SOURCE_DATA_TYPE\" " +
3495 "WHERE 1 = 0"; 3495 "WHERE 1=0";
3496 3496
3497 return executeMetaDataQuery(query); 3497 return executeMetaDataQuery(query);
3498 } 3498 }
3499 3499
3500 /** 3500 /**
3783 query.append("WHERE f.\"type\" <> 2"); 3783 query.append("WHERE f.\"type\" <> 2");
3784 3784
3785 if (catalog != null && !catalog.isEmpty()) { 3785 if (catalog != null && !catalog.isEmpty()) {
3786 // non-empty catalog selection. 3786 // non-empty catalog selection.
3787 // as we do not support catalogs this always results in no rows returned 3787 // as we do not support catalogs this always results in no rows returned
3788 query.append(" AND 1 = 0"); 3788 query.append(" AND 1=0");
3789 } else { 3789 } else {
3790 if (schemaPattern != null && !schemaPattern.equals("%")) { 3790 if (schemaPattern != null && !schemaPattern.equals("%")) {
3791 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 3791 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
3792 } 3792 }
3793 if (functionNamePattern != null && !functionNamePattern.equals("%")) { 3793 if (functionNamePattern != null && !functionNamePattern.equals("%")) {
3901 "WHERE f.\"type\" <> 2"); 3901 "WHERE f.\"type\" <> 2");
3902 3902
3903 if (catalog != null && !catalog.isEmpty()) { 3903 if (catalog != null && !catalog.isEmpty()) {
3904 // non-empty catalog selection. 3904 // non-empty catalog selection.
3905 // as we do not support catalogs this always results in no rows returned 3905 // as we do not support catalogs this always results in no rows returned
3906 query.append(" AND 1 = 0"); 3906 query.append(" AND 1=0");
3907 } else { 3907 } else {
3908 if (schemaPattern != null && !schemaPattern.equals("%")) { 3908 if (schemaPattern != null && !schemaPattern.equals("%")) {
3909 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern)); 3909 query.append(" AND s.\"name\" ").append(composeMatchPart(schemaPattern));
3910 } 3910 }
3911 if (functionNamePattern != null && !functionNamePattern.equals("%")) { 3911 if (functionNamePattern != null && !functionNamePattern.equals("%")) {
3980 "cast(0 as int) AS \"NUM_PREC_RADIX\", " + 3980 "cast(0 as int) AS \"NUM_PREC_RADIX\", " +
3981 "'' AS \"COLUMN_USAGE\", " + 3981 "'' AS \"COLUMN_USAGE\", " +
3982 "'' AS \"REMARKS\", " + 3982 "'' AS \"REMARKS\", " +
3983 "cast(0 as int) AS \"CHAR_OCTET_LENGTH\", " + 3983 "cast(0 as int) AS \"CHAR_OCTET_LENGTH\", " +
3984 "'' AS \"IS_NULLABLE\" " + 3984 "'' AS \"IS_NULLABLE\" " +
3985 "WHERE 1 = 0"; 3985 "WHERE 1=0";
3986 3986
3987 return executeMetaDataQuery(query); 3987 return executeMetaDataQuery(query);
3988 } 3988 }
3989 3989
3990 /** 3990 /**