📄 jdbcdatabasemetadata.java
字号:
/** * " WHERE 1=1 ". <p> * * This attribute is in support of methods that use SQL SELECT statements to * generate returned <code>ResultSet</code> objects. <p> * * A good optimizer will simply drop this when parsing a condition * expression. And it makes our code much easier to write, since we don't * have to check our "WHERE" clause productions as strictly for proper * conjunction: we just stick additional conjunctive predicates on the * end of this and Presto! Everything works :-) <p> * @since HSQLDB 1.7.2 */ private static final String whereTrue = " WHERE 1=1"; //---------------------------------------------------------------------- // First, a variety of minor information about the target database. /** * Retrieves whether the current user can call all the procedures * returned by the method <code>getProcedures</code>. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * This method still <em>always</em> returns * <code>true</code>. <p> * * In a future release, the plugin interface may be modified to allow * implementors to report different values here, based on their * implementations. * </div> * <!-- end release-specific documentation --> * * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean allProceduresAreCallable() throws SQLException { return true; } /** * Retrieves whether the current user can use all the tables returned * by the method <code>getTables</code> in a <code>SELECT</code> * statement. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB always reports <code>true</code>.<p> * * Please note that the default 1.7.2 <code>getTables</code> behaviour is * omit from the list of <em>requested</em> tables only those to which the * invoking user has <em>no</em> access of any kind. <p> * * </div> * <!-- end release-specific documentation --> * * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean allTablesAreSelectable() throws SQLException { return true; } /** * Retrieves the URL for this DBMS. * * * @return the URL for this DBMS or <code>null</code> if it cannot be * generated * @exception SQLException if a database access error occurs */ public String getURL() throws SQLException { return connection.getURL(); } /** * Retrieves the user name as known to this database. * * * @return the database user name * @exception SQLException if a database access error occurs */ public String getUserName() throws SQLException { ResultSet rs = execute("CALL USER()"); rs.next(); String result = rs.getString(1); rs.close(); return result; } /** * Retrieves whether this database is in read-only mode. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * Starting with 1.7.2, this makes * an SQL call to the new {@link Library#isReadOnlyDatabase} method * which provides correct determination of the read-only status for * both local and remote database instances. * </div> * <!-- end release-specific documentation --> * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean isReadOnly() throws SQLException { ResultSet rs = execute("CALL \"org.hsqldb.Library.isReadOnlyDatabase\"()"); rs.next(); boolean result = rs.getBoolean(1); rs.close(); return result; } /** * Retrieves whether <code>NULL</code> values are sorted high. * Sorted high means that <code>NULL</code> values * sort higher than any other value in a domain. In an ascending order, * if this method returns <code>true</code>, <code>NULL</code> values * will appear at the end. By contrast, the method * <code>nullsAreSortedAtEnd</code> indicates whether <code>NULL</code> values * are sorted at the end regardless of sort order. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB sorts null low; this method always returns <code>false</code>. * </div> * <!-- end release-specific documentation --> * * * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean nullsAreSortedHigh() throws SQLException { return false; } /** * Retrieves whether <code>NULL</code> values are sorted low. * Sorted low means that <code>NULL</code> values * sort lower than any other value in a domain. In an ascending order, * if this method returns <code>true</code>, <code>NULL</code> values * will appear at the beginning. By contrast, the method * <code>nullsAreSortedAtStart</code> indicates whether <code>NULL</code> values * are sorted at the beginning regardless of sort order. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB sorts null low; this method always returns <code>true</code>. * </div> * <!-- end release-specific documentation --> * * * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean nullsAreSortedLow() throws SQLException { return true; } /** * Retrieves whether <code>NULL</code> values are sorted at the start regardless * of sort order. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB sorts null low; this method always returns <code>false</code>. * </div> * <!-- end release-specific documentation --> * * * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean nullsAreSortedAtStart() throws SQLException { return false; } /** * Retrieves whether <code>NULL</code> values are sorted at the end regardless of * sort order. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB sorts null low; this method always returns <code>false</code>. * </div> * <!-- end release-specific documentation --> * * * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean nullsAreSortedAtEnd() throws SQLException { return false; } /** * Retrieves the name of this database product. <p> * * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * Starting with HSQLDB 1.7.2, this value is retrieved through an * SQL call to the new {@link Library#getDatabaseProductName} method * which allows correct determination of the database product name * for both local and remote database instances. * </div> <p> * * @return database product name * @exception SQLException if a database access error occurs */ public String getDatabaseProductName() throws SQLException { ResultSet rs = execute("call \"org.hsqldb.Library.getDatabaseProductName\"()"); rs.next(); String result = rs.getString(1); rs.close(); return result; } /** * Retrieves the version number of this database product. <p> * * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * Starting with HSQLDB 1.7.2, this value is retrieved through an * SQL call to the new {@link Library#getDatabaseProductVersion} method * which allows correct determination of the database product name * for both local and remote database instances. * </div> <p> * * @return database version number * @exception SQLException if a database access error occurs */ public String getDatabaseProductVersion() throws SQLException { ResultSet rs = execute( "call \"org.hsqldb.Library.getDatabaseProductVersion\"()"); rs.next(); String result = rs.getString(1); rs.close(); return result; } /** * Retrieves the name of this JDBC driver. * * @return JDBC driver name * @exception SQLException if a database access error occurs */ public String getDriverName() throws SQLException { return HsqlDatabaseProperties.PRODUCT_NAME + " Driver"; } /** * Retrieves the version number of this JDBC driver as a <code>String</code>. * * @return JDBC driver version * @exception SQLException if a database access error occurs */ public String getDriverVersion() throws SQLException { return HsqlDatabaseProperties.THIS_VERSION; } /** * Retrieves this JDBC driver's major version number. * * @return JDBC driver major version */ public int getDriverMajorVersion() { return HsqlDatabaseProperties.MAJOR; } /** * Retrieves this JDBC driver's minor version number. * * @return JDBC driver minor version number */ public int getDriverMinorVersion() { return HsqlDatabaseProperties.MINOR; } /** * Retrieves whether this database stores tables in a local file. <p> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * From HSQLDB 1.7.2 it is assumed that this refers to data being stored * by the JDBC client. This method always returns false. * </div> * <!-- end release-specific documentation --> * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean usesLocalFiles() throws SQLException { return false; } /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -