Mercurial > hg > monetdb-java
comparison src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @ 827:b2cbe866d020
Enhanced DatabaseMetaData.getTables() method by adding support for SQL table type names: 'BASE TABLE', 'GLOBAL TEMPORARY' and 'LOCAL TEMPORARY' in parameter types[].
These are SQL synonyms of MonetDB table type names: 'TABLE', 'GLOBAL TEMPORARY TABLE' and 'LOCAL TEMPORARY TABLE'.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Wed, 20 Dec 2023 19:10:17 +0100 (16 months ago) |
parents | 23f84ff380c2 |
children | e890195256ac |
comparison
equal
deleted
inserted
replaced
826:1074ad1a4c63 | 827:b2cbe866d020 |
---|---|
1930 } | 1930 } |
1931 | 1931 |
1932 if (types != null && types.length > 0) { | 1932 if (types != null && types.length > 0) { |
1933 query.append(needWhere ? "WHERE" : " AND").append(" tt.\"table_type_name\" IN ("); | 1933 query.append(needWhere ? "WHERE" : " AND").append(" tt.\"table_type_name\" IN ("); |
1934 for (int i = 0; i < types.length; i++) { | 1934 for (int i = 0; i < types.length; i++) { |
1935 String tabletype = types[i]; | |
1936 /* Some JDBC applications use different table type names. | |
1937 * Replace some SQL synonyms to valid MonetDB | |
1938 * table type names as defined in sys.table_types */ | |
1939 if ("BASE TABLE".equals(tabletype)) { | |
1940 tabletype = "TABLE"; | |
1941 } else | |
1942 if ("GLOBAL TEMPORARY".equals(tabletype)) { | |
1943 tabletype = "GLOBAL TEMPORARY TABLE"; | |
1944 } else | |
1945 if ("LOCAL TEMPORARY".equals(tabletype)) { | |
1946 tabletype = "LOCAL TEMPORARY TABLE"; | |
1947 } | |
1935 if (i > 0) { | 1948 if (i > 0) { |
1936 query.append(','); | 1949 query.append(','); |
1937 } | 1950 } |
1938 query.append('\'').append(types[i]).append('\''); | 1951 query.append('\'').append(tabletype).append('\''); |
1939 } | 1952 } |
1940 query.append(')'); | 1953 query.append(')'); |
1954 // for debug: System.out.println("SQL (len " + query.length() + "): " + query); | |
1941 } | 1955 } |
1942 | 1956 |
1943 query.append(" ORDER BY \"TABLE_TYPE\", \"TABLE_SCHEM\", \"TABLE_NAME\""); | 1957 query.append(" ORDER BY \"TABLE_TYPE\", \"TABLE_SCHEM\", \"TABLE_NAME\""); |
1944 | 1958 |
1945 return executeMetaDataQuery(query.toString()); | 1959 return executeMetaDataQuery(query.toString()); |