comparison src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @ 730:ee061ab9ee32

Corrected DatabaseMetaData.getSQLKeywords() output. It used to return all MonetDB SQL keywords, but now it excludes the SQL:2003 keywords as defined by the Java JDBC API specification.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 09 Feb 2023 16:31:27 +0100 (2023-02-09)
parents 2b763b189452
children 4b11238ebe15
comparison
equal deleted inserted replaced
729:6c9abd326ad2 730:ee061ab9ee32
323 public String getIdentifierQuoteString() { 323 public String getIdentifierQuoteString() {
324 return "\""; 324 return "\"";
325 } 325 }
326 326
327 /** 327 /**
328 * Get a comma separated list of all a database's SQL keywords that 328 * Retrieves a comma-separated list of all of this database's
329 * are NOT also SQL:2003 keywords. 329 * SQL keywords that are NOT also SQL:2003 keywords.
330 * 330 *
331 * @return a comma separated list of MonetDB keywords 331 * @return a comma separated list of MonetDB keywords that are not also SQL:2003 keywords
332 */ 332 */
333 @Override 333 @Override
334 public String getSQLKeywords() { 334 public String getSQLKeywords() {
335 final String keywords = getConcatenatedStringFromQuery("SELECT \"keyword\" FROM \"sys\".\"keywords\" ORDER BY 1"); 335 final String keywords = getConcatenatedStringFromQuery(
336 "SELECT \"keyword\" FROM \"sys\".\"keywords\" " +
337 // exclude all SQL:2003 keywords
338 "WHERE \"keyword\" NOT IN (" +
339 "'ABS','ALL','ALLOCATE','ALTER','AND','ANY','ARE','ARRAY','AS'," +
340 "'ASENSITIVE','ASYMMETRIC','AT','ATOMIC','AUTHORIZATION','AVG'," +
341 "'BEGIN','BETWEEN','BIGINT','BINARY','BLOB','BOOLEAN','BOTH','BY'," +
342 "'CALL','CALLED','CARDINALITY','CASCADED','CASE','CAST','CEIL','CEILING'," +
343 "'CHAR','CHARACTER','CHARACTER_LENGTH','CHAR_LENGTH','CHECK','CLOB'," +
344 "'CLOSE','COALESCE','COLLATE','COLLECT','COLUMN','COMMIT','CONDITION'," +
345 "'CONNECT','CONSTRAINT','CONVERT','CORR','CORRESPONDING','COUNT'," +
346 "'COVAR_POP','COVAR_SAMP','CREATE','CROSS','CUBE','CUME_DIST','CURRENT','CURRENT_DATE'," +
347 "'CURRENT_DEFAULT_TRANSFORM_GROUP','CURRENT_PATH','CURRENT_ROLE','CURRENT_TIME'," +
348 "'CURRENT_TIMESTAMP','CURRENT_TRANSFORM_GROUP_FOR_TYPE','CURRENT_USER','CURSOR','CYCLE'," +
349 "'DATE','DAY','DEALLOCATE','DEC','DECIMAL','DECLARE','DEFAULT','DELETE','DENSE_RANK','DEREF'," +
350 "'DESCRIBE','DETERMINISTIC','DISCONNECT','DISTINCT','DOUBLE','DROP','DYNAMIC'," +
351 "'EACH','ELEMENT','ELSE','END','END-EXEC','ESCAPE','EVERY','EXCEPT','EXEC','EXECUTE','EXISTS','EXP','EXTERNAL','EXTRACT'," +
352 "'FALSE','FETCH','FILTER','FLOAT','FLOOR','FOR','FOREIGN','FREE','FROM','FULL','FUNCTION','FUSION'," +
353 "'GET','GLOBAL','GRANT','GROUP','GROUPING','HAVING','HOLD','HOUR'," +
354 "'IDENTITY','IN','INDICATOR','INNER','INOUT','INSENSITIVE','INSERT'," +
355 "'INT','INTEGER','INTERSECT','INTERSECTION','INTERVAL','INTO','IS','JOIN'," +
356 "'LANGUAGE','LARGE','LATERAL','LEADING','LEFT','LIKE','LN','LOCAL','LOCALTIME','LOCALTIMESTAMP','LOWER'," +
357 "'MATCH','MAX','MEMBER','MERGE','METHOD','MIN','MINUTE','MOD','MODIFIES','MODULE','MONTH','MULTISET'," +
358 "'NATIONAL','NATURAL','NCHAR','NCLOB','NEW','NO','NONE','NORMALIZE','NOT','NULL','NULLIF','NUMERIC'," +
359 "'OCTET_LENGTH','OF','OLD','ON','ONLY','OPEN','OR','ORDER','OUT','OUTER','OVER','OVERLAPS','OVERLAY'," +
360 "'PARAMETER','PARTITION','PERCENTILE_CONT','PERCENTILE_DISC','PERCENT_RANK'," +
361 "'POSITION','POWER','PRECISION','PREPARE','PRIMARY','PROCEDURE'," +
362 "'RANGE','RANK','READS','REAL','RECURSIVE','REF','REFERENCES','REFERENCING'," +
363 "'REGR_AVGX','REGR_AVGY','REGR_COUNT','REGR_INTERCEPT','REGR_R2','REGR_SLOPE','REGR_SXX','REGR_SXY','REGR_SYY'," +
364 "'RELEASE','RESULT','RETURN','RETURNS','REVOKE','RIGHT','ROLLBACK','ROLLUP','ROW','ROWS','ROW_NUMBER'," +
365 "'SAVEPOINT','SCOPE','SCROLL','SEARCH','SECOND','SELECT','SENSITIVE','SESSION_USER','SET'," +
366 "'SIMILAR','SMALLINT','SOME','SPECIFIC','SPECIFICTYPE','SQL','SQLEXCEPTION','SQLSTATE','SQLWARNING'," +
367 "'SQRT','START','STATIC','STDDEV_POP','STDDEV_SAMP','SUBMULTISET','SUBSTRING','SUM'," +
368 "'SYMMETRIC','SYSTEM','SYSTEM_USER'," +
369 "'TABLE','TABLESAMPLE','THEN','TIME','TIMESTAMP','TIMEZONE_HOUR','TIMEZONE_MINUTE'," +
370 "'TO','TRAILING','TRANSLATE','TRANSLATION','TREAT','TRIGGER','TRIM','TRUE'," +
371 "'UESCAPE','UNION','UNIQUE','UNKNOWN','UNNEST','UPDATE','UPPER','USER','USING'," +
372 "'VALUE','VALUES','VARCHAR','VARYING','VAR_POP','VAR_SAMP'," +
373 "'WHEN','WHENEVER','WHERE','WIDTH_BUCKET','WINDOW','WITH','WITHIN','WITHOUT','YEAR'" +
374 ") ORDER BY 1");
336 375
337 /* An old MonetDB server (pre Jul2015 release) will not have a table sys.keywords and return an empty String */ 376 /* An old MonetDB server (pre Jul2015 release) will not have a table sys.keywords and return an empty String */
338 return (keywords.isEmpty()) ? 377 return (keywords.isEmpty()) ?
339 /* for old servers return static list (as returned in clients/odbc/driver/SQLGetInfo.c case SQL_KEYWORDS:) */ 378 /* for old servers return static list (as returned in clients/odbc/driver/SQLGetInfo.c case SQL_KEYWORDS:) */
340 "ADMIN,AFTER,AGGREGATE,ALWAYS,ASYMMETRIC,ATOMIC," + 379 "ADMIN,AFTER,AGGREGATE,ALWAYS,ASYMMETRIC,ATOMIC," +