Mercurial > hg > monetdb-java
comparison src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java @ 299:1f0324072b0c
Correcting typo in comment
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Wed, 14 Aug 2019 20:28:40 +0200 (2019-08-14) |
parents | 6db8f6702ce8 |
children | 8cc3b51d1984 |
comparison
equal
deleted
inserted
replaced
298:6db8f6702ce8 | 299:1f0324072b0c |
---|---|
1748 } | 1748 } |
1749 // include procedures only (type = 2). Others will be returned via getFunctions() | 1749 // include procedures only (type = 2). Others will be returned via getFunctions() |
1750 query.append("WHERE \"functions\".\"type\" = 2"); | 1750 query.append("WHERE \"functions\".\"type\" = 2"); |
1751 | 1751 |
1752 if (catalog != null && !catalog.isEmpty()) { | 1752 if (catalog != null && !catalog.isEmpty()) { |
1753 // none empty catalog selection. | 1753 // non-empty catalog selection. |
1754 // as we do not support catalogs this always results in no rows returned | 1754 // as we do not support catalogs this always results in no rows returned |
1755 query.append(" AND 1 = 0"); | 1755 query.append(" AND 1 = 0"); |
1756 } else { | 1756 } else { |
1757 if (schemaPattern != null) { | 1757 if (schemaPattern != null) { |
1758 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 1758 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
1873 "JOIN \"sys\".\"schemas\" ON (\"functions\".\"schema_id\" = \"schemas\".\"id\") " + | 1873 "JOIN \"sys\".\"schemas\" ON (\"functions\".\"schema_id\" = \"schemas\".\"id\") " + |
1874 // include procedures only (type = 2). Others will be returned via getFunctionColumns() | 1874 // include procedures only (type = 2). Others will be returned via getFunctionColumns() |
1875 "WHERE \"functions\".\"type\" = 2"); | 1875 "WHERE \"functions\".\"type\" = 2"); |
1876 | 1876 |
1877 if (catalog != null && !catalog.isEmpty()) { | 1877 if (catalog != null && !catalog.isEmpty()) { |
1878 // none empty catalog selection. | 1878 // non-empty catalog selection. |
1879 // as we do not support catalogs this always results in no rows returned | 1879 // as we do not support catalogs this always results in no rows returned |
1880 query.append(" AND 1 = 0"); | 1880 query.append(" AND 1 = 0"); |
1881 } else { | 1881 } else { |
1882 if (schemaPattern != null) { | 1882 if (schemaPattern != null) { |
1883 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 1883 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
2025 if (!preJul2015) { | 2025 if (!preJul2015) { |
2026 query.append(" AND \"tables\".\"type\" = \"table_types\".\"table_type_id\""); | 2026 query.append(" AND \"tables\".\"type\" = \"table_types\".\"table_type_id\""); |
2027 } | 2027 } |
2028 | 2028 |
2029 if (catalog != null && !catalog.isEmpty()) { | 2029 if (catalog != null && !catalog.isEmpty()) { |
2030 // none empty catalog selection. | 2030 // non-empty catalog selection. |
2031 // as we do not support catalogs this always results in no rows returned | 2031 // as we do not support catalogs this always results in no rows returned |
2032 query.append(" AND 1 = 0"); | 2032 query.append(" AND 1 = 0"); |
2033 } else { | 2033 } else { |
2034 if (schemaPattern != null) { | 2034 if (schemaPattern != null) { |
2035 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 2035 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
2088 query.append("SELECT \"name\" AS \"TABLE_SCHEM\", " + | 2088 query.append("SELECT \"name\" AS \"TABLE_SCHEM\", " + |
2089 "cast(null as char(1)) AS \"TABLE_CATALOG\" " + | 2089 "cast(null as char(1)) AS \"TABLE_CATALOG\" " + |
2090 "FROM \"sys\".\"schemas\""); | 2090 "FROM \"sys\".\"schemas\""); |
2091 | 2091 |
2092 if (catalog != null && !catalog.isEmpty()) { | 2092 if (catalog != null && !catalog.isEmpty()) { |
2093 // none empty catalog selection. | 2093 // non-empty catalog selection. |
2094 // as we do not support catalogs this always results in no rows returned | 2094 // as we do not support catalogs this always results in no rows returned |
2095 query.append(" WHERE 1 = 0"); | 2095 query.append(" WHERE 1 = 0"); |
2096 } else { | 2096 } else { |
2097 if (schemaPattern != null) { | 2097 if (schemaPattern != null) { |
2098 query.append(" WHERE \"name\" ").append(composeMatchPart(schemaPattern)); | 2098 query.append(" WHERE \"name\" ").append(composeMatchPart(schemaPattern)); |
2274 ", \"sys\".\"schemas\" " + | 2274 ", \"sys\".\"schemas\" " + |
2275 "WHERE \"columns\".\"table_id\" = \"tables\".\"id\"" + | 2275 "WHERE \"columns\".\"table_id\" = \"tables\".\"id\"" + |
2276 " AND \"tables\".\"schema_id\" = \"schemas\".\"id\""); | 2276 " AND \"tables\".\"schema_id\" = \"schemas\".\"id\""); |
2277 | 2277 |
2278 if (catalog != null && !catalog.isEmpty()) { | 2278 if (catalog != null && !catalog.isEmpty()) { |
2279 // none empty catalog selection. | 2279 // non-empty catalog selection. |
2280 // as we do not support catalogs this always results in no rows returned | 2280 // as we do not support catalogs this always results in no rows returned |
2281 query.append(" AND 1 = 0"); | 2281 query.append(" AND 1 = 0"); |
2282 } else { | 2282 } else { |
2283 if (schemaPattern != null) { | 2283 if (schemaPattern != null) { |
2284 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 2284 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
2375 if (usePrivilege_codesTable) { | 2375 if (usePrivilege_codesTable) { |
2376 query.append(" AND \"privileges\".\"privileges\" = \"privilege_codes\".\"privilege_code_id\""); | 2376 query.append(" AND \"privileges\".\"privileges\" = \"privilege_codes\".\"privilege_code_id\""); |
2377 } | 2377 } |
2378 | 2378 |
2379 if (catalog != null && !catalog.isEmpty()) { | 2379 if (catalog != null && !catalog.isEmpty()) { |
2380 // none empty catalog selection. | 2380 // non-empty catalog selection. |
2381 // as we do not support catalogs this always results in no rows returned | 2381 // as we do not support catalogs this always results in no rows returned |
2382 query.append(" AND 1 = 0"); | 2382 query.append(" AND 1 = 0"); |
2383 } else { | 2383 } else { |
2384 if (schemaPattern != null) { | 2384 if (schemaPattern != null) { |
2385 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 2385 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
2470 if (usePrivilege_codesTable) { | 2470 if (usePrivilege_codesTable) { |
2471 query.append(" AND \"privileges\".\"privileges\" = \"privilege_codes\".\"privilege_code_id\""); | 2471 query.append(" AND \"privileges\".\"privileges\" = \"privilege_codes\".\"privilege_code_id\""); |
2472 } | 2472 } |
2473 | 2473 |
2474 if (catalog != null && !catalog.isEmpty()) { | 2474 if (catalog != null && !catalog.isEmpty()) { |
2475 // none empty catalog selection. | 2475 // non-empty catalog selection. |
2476 // as we do not support catalogs this always results in no rows returned | 2476 // as we do not support catalogs this always results in no rows returned |
2477 query.append(" AND 1 = 0"); | 2477 query.append(" AND 1 = 0"); |
2478 } else { | 2478 } else { |
2479 if (schemaPattern != null) { | 2479 if (schemaPattern != null) { |
2480 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 2480 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
2554 "AND \"objects\".\"name\" = \"columns\".\"name\" " + | 2554 "AND \"objects\".\"name\" = \"columns\".\"name\" " + |
2555 "AND \"tables\".\"schema_id\" = \"schemas\".\"id\" " + | 2555 "AND \"tables\".\"schema_id\" = \"schemas\".\"id\" " + |
2556 "AND \"keys\".\"type\" IN (0, 1)"); // only primary keys (type = 0) and unique keys (type = 1), not fkeys (type = 2) | 2556 "AND \"keys\".\"type\" IN (0, 1)"); // only primary keys (type = 0) and unique keys (type = 1), not fkeys (type = 2) |
2557 | 2557 |
2558 if (catalog != null && !catalog.isEmpty()) { | 2558 if (catalog != null && !catalog.isEmpty()) { |
2559 // none empty catalog selection. | 2559 // non-empty catalog selection. |
2560 // as we do not support catalogs this always results in no rows returned | 2560 // as we do not support catalogs this always results in no rows returned |
2561 query.append(" AND 1 = 0"); | 2561 query.append(" AND 1 = 0"); |
2562 } else { | 2562 } else { |
2563 if (scope != DatabaseMetaData.bestRowSession | 2563 if (scope != DatabaseMetaData.bestRowSession |
2564 && scope != DatabaseMetaData.bestRowTransaction | 2564 && scope != DatabaseMetaData.bestRowTransaction |
2675 "AND \"keys\".\"table_id\" = \"tables\".\"id\" " + | 2675 "AND \"keys\".\"table_id\" = \"tables\".\"id\" " + |
2676 "AND \"tables\".\"schema_id\" = \"schemas\".\"id\" " + | 2676 "AND \"tables\".\"schema_id\" = \"schemas\".\"id\" " + |
2677 "AND \"keys\".\"type\" = 0"); | 2677 "AND \"keys\".\"type\" = 0"); |
2678 | 2678 |
2679 if (catalog != null && !catalog.isEmpty()) { | 2679 if (catalog != null && !catalog.isEmpty()) { |
2680 // none empty catalog selection. | 2680 // non-empty catalog selection. |
2681 // as we do not support catalogs this always results in no rows returned | 2681 // as we do not support catalogs this always results in no rows returned |
2682 query.append(" AND 1 = 0"); | 2682 query.append(" AND 1 = 0"); |
2683 } else { | 2683 } else { |
2684 if (schema != null) { | 2684 if (schema != null) { |
2685 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schema)); | 2685 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schema)); |
2798 { | 2798 { |
2799 final StringBuilder query = new StringBuilder(keyQuery.length() + 250); | 2799 final StringBuilder query = new StringBuilder(keyQuery.length() + 250); |
2800 query.append(keyQuery); | 2800 query.append(keyQuery); |
2801 | 2801 |
2802 if (catalog != null && !catalog.isEmpty()) { | 2802 if (catalog != null && !catalog.isEmpty()) { |
2803 // none empty catalog selection. | 2803 // non-empty catalog selection. |
2804 // as we do not support catalogs this always results in no rows returned | 2804 // as we do not support catalogs this always results in no rows returned |
2805 query.append(" AND 1 = 0"); | 2805 query.append(" AND 1 = 0"); |
2806 } else { | 2806 } else { |
2807 if (schema != null) { | 2807 if (schema != null) { |
2808 query.append(" AND \"fkschema\".\"name\" ").append(composeMatchPart(schema)); | 2808 query.append(" AND \"fkschema\".\"name\" ").append(composeMatchPart(schema)); |
2886 { | 2886 { |
2887 final StringBuilder query = new StringBuilder(keyQuery.length() + 250); | 2887 final StringBuilder query = new StringBuilder(keyQuery.length() + 250); |
2888 query.append(keyQuery); | 2888 query.append(keyQuery); |
2889 | 2889 |
2890 if (catalog != null && !catalog.isEmpty()) { | 2890 if (catalog != null && !catalog.isEmpty()) { |
2891 // none empty catalog selection. | 2891 // non-empty catalog selection. |
2892 // as we do not support catalogs this always results in no rows returned | 2892 // as we do not support catalogs this always results in no rows returned |
2893 query.append(" AND 1 = 0"); | 2893 query.append(" AND 1 = 0"); |
2894 } else { | 2894 } else { |
2895 if (schema != null) { | 2895 if (schema != null) { |
2896 query.append(" AND \"pkschema\".\"name\" ").append(composeMatchPart(schema)); | 2896 query.append(" AND \"pkschema\".\"name\" ").append(composeMatchPart(schema)); |
2985 final StringBuilder query = new StringBuilder(keyQuery.length() + 350); | 2985 final StringBuilder query = new StringBuilder(keyQuery.length() + 350); |
2986 query.append(keyQuery); | 2986 query.append(keyQuery); |
2987 | 2987 |
2988 if ((pcatalog != null && !pcatalog.isEmpty()) | 2988 if ((pcatalog != null && !pcatalog.isEmpty()) |
2989 || (fcatalog != null && !fcatalog.isEmpty())) { | 2989 || (fcatalog != null && !fcatalog.isEmpty())) { |
2990 // none empty catalog selection. | 2990 // non-empty catalog selection. |
2991 // as we do not support catalogs this always results in no rows returned | 2991 // as we do not support catalogs this always results in no rows returned |
2992 query.append(" AND 1 = 0"); | 2992 query.append(" AND 1 = 0"); |
2993 } else { | 2993 } else { |
2994 if (pschema != null) { | 2994 if (pschema != null) { |
2995 query.append(" AND \"pkschema\".\"name\" ").append(composeMatchPart(pschema)); | 2995 query.append(" AND \"pkschema\".\"name\" ").append(composeMatchPart(pschema)); |
3207 "AND \"tables\".\"id\" = \"columns\".\"table_id\" " + | 3207 "AND \"tables\".\"id\" = \"columns\".\"table_id\" " + |
3208 "AND \"objects\".\"name\" = \"columns\".\"name\" " + | 3208 "AND \"objects\".\"name\" = \"columns\".\"name\" " + |
3209 "AND (\"keys\".\"type\" IS NULL OR \"keys\".\"type\" = 1)"); | 3209 "AND (\"keys\".\"type\" IS NULL OR \"keys\".\"type\" = 1)"); |
3210 | 3210 |
3211 if (catalog != null && !catalog.isEmpty()) { | 3211 if (catalog != null && !catalog.isEmpty()) { |
3212 // none empty catalog selection. | 3212 // non-empty catalog selection. |
3213 // as we do not support catalogs this always results in no rows returned | 3213 // as we do not support catalogs this always results in no rows returned |
3214 query.append(" AND 1 = 0"); | 3214 query.append(" AND 1 = 0"); |
3215 } else { | 3215 } else { |
3216 if (schema != null) { | 3216 if (schema != null) { |
3217 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schema)); | 3217 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schema)); |
3375 "FROM \"sys\".\"types\" JOIN \"sys\".\"schemas\" ON \"types\".\"schema_id\" = \"schemas\".\"id\" " + | 3375 "FROM \"sys\".\"types\" JOIN \"sys\".\"schemas\" ON \"types\".\"schema_id\" = \"schemas\".\"id\" " + |
3376 // exclude the built-in types (I assume they always have id <= 99 and eclass < 15) | 3376 // exclude the built-in types (I assume they always have id <= 99 and eclass < 15) |
3377 "WHERE \"types\".\"id\" > 99 AND \"types\".\"eclass\" >= 15"); | 3377 "WHERE \"types\".\"id\" > 99 AND \"types\".\"eclass\" >= 15"); |
3378 | 3378 |
3379 if (catalog != null && !catalog.isEmpty()) { | 3379 if (catalog != null && !catalog.isEmpty()) { |
3380 // none empty catalog selection. | 3380 // non-empty catalog selection. |
3381 // as we do not support catalogs this always results in no rows returned | 3381 // as we do not support catalogs this always results in no rows returned |
3382 query.append(" AND 1 = 0"); | 3382 query.append(" AND 1 = 0"); |
3383 } else { | 3383 } else { |
3384 if (schemaPattern != null) { | 3384 if (schemaPattern != null) { |
3385 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 3385 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
3974 } | 3974 } |
3975 // only functions, so exclude procedures (type = 2). Those will to be returned via getProcedures() | 3975 // only functions, so exclude procedures (type = 2). Those will to be returned via getProcedures() |
3976 query.append("WHERE \"functions\".\"type\" <> 2"); | 3976 query.append("WHERE \"functions\".\"type\" <> 2"); |
3977 | 3977 |
3978 if (catalog != null && !catalog.isEmpty()) { | 3978 if (catalog != null && !catalog.isEmpty()) { |
3979 // none empty catalog selection. | 3979 // non-empty catalog selection. |
3980 // as we do not support catalogs this always results in no rows returned | 3980 // as we do not support catalogs this always results in no rows returned |
3981 query.append(" AND 1 = 0"); | 3981 query.append(" AND 1 = 0"); |
3982 } else { | 3982 } else { |
3983 if (schemaPattern != null) { | 3983 if (schemaPattern != null) { |
3984 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 3984 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |
4092 "JOIN \"sys\".\"schemas\" ON (\"functions\".\"schema_id\" = \"schemas\".\"id\") " + | 4092 "JOIN \"sys\".\"schemas\" ON (\"functions\".\"schema_id\" = \"schemas\".\"id\") " + |
4093 // only functions, so exclude procedures (type = 2). Those will to be returned via getProcedureColumns() | 4093 // only functions, so exclude procedures (type = 2). Those will to be returned via getProcedureColumns() |
4094 "WHERE \"functions\".\"type\" <> 2"); | 4094 "WHERE \"functions\".\"type\" <> 2"); |
4095 | 4095 |
4096 if (catalog != null && !catalog.isEmpty()) { | 4096 if (catalog != null && !catalog.isEmpty()) { |
4097 // none empty catalog selection. | 4097 // non-empty catalog selection. |
4098 // as we do not support catalogs this always results in no rows returned | 4098 // as we do not support catalogs this always results in no rows returned |
4099 query.append(" AND 1 = 0"); | 4099 query.append(" AND 1 = 0"); |
4100 } else { | 4100 } else { |
4101 if (schemaPattern != null) { | 4101 if (schemaPattern != null) { |
4102 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); | 4102 query.append(" AND \"schemas\".\"name\" ").append(composeMatchPart(schemaPattern)); |