| 1 30 31 32 package org.hsqldb.jdbc; 33 34 import java.sql.Connection ; 35 import java.sql.DatabaseMetaData ; 36 import java.sql.ResultSet ; 37 import java.sql.SQLException ; 38 39 import org.hsqldb.Column; 40 import org.hsqldb.Library; 41 import org.hsqldb.Trace; 42 import org.hsqldb.lib.StringUtil; 43 import org.hsqldb.persist.HsqlDatabaseProperties; 44 45 59 279 public class jdbcDatabaseMetaData implements DatabaseMetaData { 280 281 282 static final Integer INT_COLUMNS_NO_NULLS = new Integer (columnNoNulls); 283 284 288 292 private jdbcConnection connection; 293 294 297 private boolean useSchemaDefault; 298 299 305 private static final String BRI_SESSION_SCOPE_IN_LIST = "(" 306 + bestRowSession + ")"; 307 308 314 private static final String BRI_TEMPORARY_SCOPE_IN_LIST = "(" 315 + bestRowTemporary + "," + bestRowTransaction + "," + bestRowSession 316 + ")"; 317 318 324 private static final String BRI_TRANSACTION_SCOPE_IN_LIST = "(" 325 + bestRowTransaction + "," + bestRowSession + ")"; 326 327 335 private static final String selstar = "SELECT * FROM INFORMATION_SCHEMA."; 336 337 350 private static final String whereTrue = " WHERE 1=1"; 351 352 355 375 public boolean allProceduresAreCallable() throws SQLException { 376 return true; 377 } 378 379 400 public boolean allTablesAreSelectable() throws SQLException { 401 return true; 402 } 403 404 412 public String getURL() throws SQLException { 413 return connection.getURL(); 414 } 415 416 423 public String getUserName() throws SQLException { 424 425 ResultSet rs = execute("CALL USER()"); 426 427 rs.next(); 428 429 String result = rs.getString(1); 430 431 rs.close(); 432 433 return result; 434 } 435 436 452 public boolean isReadOnly() throws SQLException { 453 454 ResultSet rs = 455 execute("CALL \"org.hsqldb.Library.isReadOnlyDatabase\"()"); 456 457 rs.next(); 458 459 boolean result = rs.getBoolean(1); 460 461 rs.close(); 462 463 return result; 464 } 465 466 487 public boolean nullsAreSortedHigh() throws SQLException { 488 return false; 489 } 490 491 512 public boolean nullsAreSortedLow() throws SQLException { 513 return true; 514 } 515 516 532 public boolean nullsAreSortedAtStart() throws SQLException { 533 return false; 534 } 535 536 552 public boolean nullsAreSortedAtEnd() throws SQLException { 553 return false; 554 } 555 556 571 public String getDatabaseProductName() throws SQLException { 572 573 ResultSet rs = 574 execute("call \"org.hsqldb.Library.getDatabaseProductName\"()"); 575 576 rs.next(); 577 578 String result = rs.getString(1); 579 580 rs.close(); 581 582 return result; 583 } 584 585 600 public String getDatabaseProductVersion() throws SQLException { 601 602 ResultSet rs = execute( 603 "call \"org.hsqldb.Library.getDatabaseProductVersion\"()"); 604 605 rs.next(); 606 607 String result = rs.getString(1); 608 609 rs.close(); 610 611 return result; 612 } 613 614 620 public String getDriverName() throws SQLException { 621 return HsqlDatabaseProperties.PRODUCT_NAME + " Driver"; 622 } 623 624 630 public String getDriverVersion() throws SQLException { 631 return HsqlDatabaseProperties.THIS_VERSION; 632 } 633 634 639 public int getDriverMajorVersion() { 640 return HsqlDatabaseProperties.MAJOR; 641 } 642 643 648 public int getDriverMinorVersion() { 649 return HsqlDatabaseProperties.MINOR; 650 } 651 652 666 public boolean usesLocalFiles() throws SQLException { 667 return false; 668 } 669 670 685 public boolean usesLocalFilePerTable() throws SQLException { 686 return false; 687 } 688 689 707 public boolean supportsMixedCaseIdentifiers() throws SQLException { 708 return false; 709 } 710 711 729 public boolean storesUpperCaseIdentifiers() throws SQLException { 730 return true; 731 } 732 733 751 public boolean storesLowerCaseIdentifiers() throws SQLException { 752 return false; 753 } 754 755 773 public boolean storesMixedCaseIdentifiers() throws SQLException { 774 return false; 775 } 776 777 795 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { 796 return true; 797 } 798 799 817 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { 818 return false; 819 } 820 821 837 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { 838 return false; 839 } 840 841 859 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { 860 return false; 861 } 862 863 878 public String getIdentifierQuoteString() throws SQLException { 879 return "\""; 880 } 881 882 885 904 public String getSQLKeywords() throws SQLException { 905 906 return "BEFORE,BIGINT,BINARY,CACHED,DATETIME," 907 + "LIMIT,LONGVARBINARY,LONGVARCHAR,OBJECT,OTHER,SAVEPOINT," 908 + "TEMP,TEXT,TOP,TRIGGER,TINYINT,VARBINARY,VARCHAR_IGNORECASE"; 909 } 910 911 918 public String getNumericFunctions() throws SQLException { 919 return StringUtil.getList(Library.sNumeric, ",", ""); 920 } 921 922 929 public String getStringFunctions() throws SQLException { 930 return StringUtil.getList(Library.sString, ",", ""); 931 } 932 933 940 public String getSystemFunctions() throws SQLException { 941 return StringUtil.getList(Library.sSystem, ",", ""); 942 } 943 944 950 public String getTimeDateFunctions() throws SQLException { 951 return StringUtil.getList(Library.sTimeDate, ",", ""); 952 } 953 954 976 public String getSearchStringEscape() throws SQLException { 977 return "\\"; 978 } 979 980 997 public String getExtraNameCharacters() throws SQLException { 998 return ""; 999 } 1000 1001 1004 |