📄 jdbcdatabasemetadata.java
字号:
/*
* jdbcDatabaseMetaData.java
*
* Copyright (c) 2001, The HSQL Development Group
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* Neither the name of the HSQL Development Group nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This package is based on HypersonicSQL, originally developed by Thomas Mueller.
*
*/
package org.hsqldb;
import java.sql.*;
/**
* Comprehensive information about the database as a whole.
*
* <P>Many of the methods here return lists of information in
* the form of <code>ResultSet</code> objects.
* You can use the normal ResultSet methods such as getString and getInt
* to retrieve the data from these ResultSets. If a given form of
* metadata is not available, these methods should throw an SQLException.
*
* <P>Some of these methods take arguments that are String patterns. These
* arguments all have names such as fooPattern. Within a pattern String, "%"
* means match any substring of 0 or more characters, and "_" means match
* any one character. Only metadata entries matching the search pattern
* are returned. If a search pattern argument is set to a null ref,
* that argument's criteria will be dropped from the search.
*
* <P>An <code>SQLException</code> will be thrown if a driver does not support
* a meta data method. In the case of methods that return a ResultSet,
* either a ResultSet (which may be empty) is returned or a
* SQLException is thrown.
*/
public class jdbcDatabaseMetaData implements DatabaseMetaData {
private jdbcConnection cConnection;
/**
* Constructor declaration
*
*
* @param c
*/
jdbcDatabaseMetaData(jdbcConnection c) {
cConnection = c;
}
/**
* Can all the procedures returned by getProcedures be called by the
* current user?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean allProceduresAreCallable() {
if (Trace.TRACE) {
Trace.trace();
}
return true;
}
/**
* Can all the tables returned by getTable be SELECTed by the
* current user?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean allTablesAreSelectable() {
if (Trace.TRACE) {
Trace.trace();
}
return true;
}
/**
* What's the url for this database?
*
* @return the url
*/
public String getURL() {
if (Trace.TRACE) {
Trace.trace();
}
return "jdbc:hsqldb:" + cConnection.getName();
}
/**
* What's our user name as known to the database?
*
* @return our database user name
* @exception SQLException if a database access error occurs
*/
public String getUserName() throws SQLException {
if (Trace.TRACE) {
Trace.trace();
}
ResultSet r = executeSelect("SYSTEM_CONNECTIONINFO", "KEY='USER'");
r.next();
return r.getString(2);
}
/**
* Is the database in read-only mode?
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
public boolean isReadOnly() throws SQLException {
if (Trace.TRACE) {
Trace.trace();
}
return cConnection.isReadOnly();
}
/**
* Are NULL values sorted high?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean nullsAreSortedHigh() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Are NULL values sorted low?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean nullsAreSortedLow() {
if (Trace.TRACE) {
Trace.trace();
}
return true;
}
/**
* Are NULL values sorted at the start regardless of sort order?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean nullsAreSortedAtStart() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Are NULL values sorted at the end regardless of sort order?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean nullsAreSortedAtEnd() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* What's the name of this database product?
*
* @return database product name
*/
public String getDatabaseProductName() {
if (Trace.TRACE) {
Trace.trace();
}
return jdbcDriver.PRODUCT;
}
/**
* What's the version of this database product?
*
* @return database version
*/
public String getDatabaseProductVersion() {
if (Trace.TRACE) {
Trace.trace();
}
return jdbcDriver.VERSION;
}
/**
* What's the name of this JDBC driver?
*
* @return JDBC driver name
*/
public String getDriverName() {
if (Trace.TRACE) {
Trace.trace();
}
return jdbcDriver.PRODUCT + " Driver";
}
/**
* What's the version of this JDBC driver?
*
* @return JDBC driver version
*/
public String getDriverVersion() {
if (Trace.TRACE) {
Trace.trace();
}
return jdbcDriver.VERSION;
}
/**
* What's this JDBC driver's major version number?
*
* @return JDBC driver major version
*/
public int getDriverMajorVersion() {
if (Trace.TRACE) {
Trace.trace();
}
return jdbcDriver.MAJOR;
}
/**
* What's this JDBC driver's minor version number?
*
* @return JDBC driver minor version number
*/
public int getDriverMinorVersion() {
if (Trace.TRACE) {
Trace.trace();
}
return jdbcDriver.MINOR;
}
/**
* Does the database store tables in a local file?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean usesLocalFiles() {
if (Trace.TRACE) {
Trace.trace();
}
return cConnection.usesLocalFiles();
}
/**
* Does the database use a file for each table?
*
* @return true if the database uses a local file for each table
*/
public boolean usesLocalFilePerTable() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Does the database treat mixed case unquoted SQL identifiers as
* case sensitive and as a result store them in mixed case?
*
* A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will
* always return false.
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean supportsMixedCaseIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Does the database treat mixed case unquoted SQL identifiers as
* case insensitive and store them in upper case?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean storesUpperCaseIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return true;
}
/**
* Does the database treat mixed case unquoted SQL identifiers as
* case insensitive and store them in lower case?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean storesLowerCaseIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Does the database treat mixed case unquoted SQL identifiers as
* case insensitive and store them in mixed case?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean storesMixedCaseIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Does the database treat mixed case quoted SQL identifiers as
* case sensitive and as a result store them in mixed case?
*
* A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will
* always return true.
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean supportsMixedCaseQuotedIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return true;
// InterBase (iscdrv32.dll) returns false
}
/**
* Does the database treat mixed case quoted SQL identifiers as
* case insensitive and store them in upper case?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean storesUpperCaseQuotedIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Does the database treat mixed case quoted SQL identifiers as
* case insensitive and store them in lower case?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean storesLowerCaseQuotedIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
}
/**
* Does the database treat mixed case quoted SQL identifiers as
* case insensitive and store them in mixed case?
*
* @return <code>true</code> if so; <code>false</code> otherwise
*/
public boolean storesMixedCaseQuotedIdentifiers() {
if (Trace.TRACE) {
Trace.trace();
}
return false;
// No: as case sensitive.
}
/**
* What's the string used to quote SQL identifiers?
* This returns a space " " if identifier quoting isn't supported.
*
* A JDBC Compliant<sup><font size=-2>TM</font></sup>
* driver always uses a double quote character.
*
* @return the quoting string
*/
public String getIdentifierQuoteString() {
if (Trace.TRACE) {
Trace.trace();
}
return "\"";
// InterBase (iscdrv32.dll) returns ""
}
/**
* Gets a comma-separated list of all a database's SQL keywords
* that are NOT also SQL92 keywords.
*
* @return the list
*/
public String getSQLKeywords() {
if (Trace.TRACE) {
Trace.trace();
}
return "";
}
/**
* Gets a comma-separated list of math functions. These are the
* X/Open CLI math function names used in the JDBC function escape
* clause.
*
* @return the list
*/
public String getNumericFunctions() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -