📄 oracledatabasemetadata.java
字号:
package oracle.jdbc.driver;import java.sql.*;import oracle.jdbc.dbaccess.*;import oracle.sql.SQLName;/** * The OracleDatabaseMetaData class implements the JDBC 1.0 DatabaseMetaData * interface. */public class OracleDatabaseMetaData implements DatabaseMetaData{ static String DRIVER_NAME = "Oracle JDBC driver"; static String DRIVER_VERSION = "8.1.6.0.0"; static int DRIVER_MAJOR_VERSION = 8; static int DRIVER_MINOR_VERSION = 1; OracleConnection connection; public OracleDatabaseMetaData (OracleConnection conn) { connection = conn; } //---------------------------------------------------------------------- // First, a variety of minor information about the target database. /** * Can all the procedures returned by getProcedures be called by the * current user? * * @return true if so */ public boolean allProceduresAreCallable() throws SQLException { connection.trace ("allProceduresAreCallable"); return false; } /** * Can all the tables returned by getTable be SELECTed by the * current user? * * @return true if so */ public boolean allTablesAreSelectable() throws SQLException { connection.trace ("allTablesAreSelectable"); return false; } /** * What's the url for this database? * * @return the url or null if it can't be generated */ public String getURL() throws SQLException { return connection.getURL(); } /** * What's our user name as known to the database? * * @return our database user name */ public String getUserName() throws SQLException { connection.trace ("getUserName"); return connection.getUserName(); } /** * Is the database in read-only mode? * * @return true if so */ public boolean isReadOnly() throws SQLException { connection.trace ("isReadOnly"); return false; } /** * Are NULL values sorted high? * * @return true if so */ public boolean nullsAreSortedHigh() throws SQLException { connection.trace ("nullsAreSortedHigh"); return false; } /** * Are NULL values sorted low? * * @return true if so */ public boolean nullsAreSortedLow() throws SQLException { connection.trace ("nullsAreSortedLow"); return true; } /** * Are NULL values sorted at the start regardless of sort order? * * @return true if so */ public boolean nullsAreSortedAtStart() throws SQLException { connection.trace ("nullsAreSortedAtStart"); return false; } /** * Are NULL values sorted at the end regardless of sort order? * * @return true if so */ public boolean nullsAreSortedAtEnd() throws SQLException { connection.trace ("nullsAreSortedAtEnd"); return false; } /** * What's the name of this database product? * * @return database product name */ public String getDatabaseProductName() throws SQLException { return "Oracle"; } /** * What's the version of this database product? * * @return database version */ public String getDatabaseProductVersion() throws SQLException { connection.trace ("getDatabaseProductVersion"); int error [] = new int [1]; try { connection.needLine (); byte [] version = connection.db_access.getVersion (); return connection.conversion.CharBytesToString (version, version.length); } catch (java.io.IOException e) { return null; } } /** * What's the name of this JDBC driver? * * @return JDBC driver name */ public String getDriverName() throws SQLException { connection.trace ("getDriverName"); return DRIVER_NAME; } /** * What's the version of this JDBC driver? * * @return JDBC driver version */ public String getDriverVersion() throws SQLException { connection.trace ("getDriverVersion"); return DRIVER_VERSION; } /** * What's this JDBC driver's major version number? * * @return JDBC driver major version */ public int getDriverMajorVersion() { connection.trace ("getDriverMajorVersion"); return DRIVER_MAJOR_VERSION; } /** * What's this JDBC driver's minor version number? * * @return JDBC driver minor version number */ public int getDriverMinorVersion() { connection.trace ("getDriverMinorVersion"); return DRIVER_MINOR_VERSION; } /** * Does the database store tables in a local file? * * @return true if so */ public boolean usesLocalFiles() throws SQLException { connection.trace ("usesLocalFiles"); return false; } /** * Does the database use a file for each table? * * @return true if the database uses a local file for each table */ public boolean usesLocalFilePerTable() throws SQLException { connection.trace ("usesLocalFilePerTable"); 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 driver will always return false. * * @return true if so */ public boolean supportsMixedCaseIdentifiers() throws SQLException { connection.trace ("supportsMixedCaseIdentifiers"); return false; } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ public boolean storesUpperCaseIdentifiers() throws SQLException { connection.trace ("storesUpperCaseIdentifiers"); return true; } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ public boolean storesLowerCaseIdentifiers() throws SQLException { connection.trace ("storesLowerCaseIdentifiers"); return false; } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ public boolean storesMixedCaseIdentifiers() throws SQLException { connection.trace ("storesMixedCaseIdentifiers"); 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 driver will always return false. * * @return true if so */ public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { connection.trace ("supportsMixedCaseQuotedIdentifiers"); return true; } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { connection.trace ("storesUpperCaseQuotedIdentifiers"); return false; } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { connection.trace ("storesLowerCaseQuotedIdentifiers"); return false; } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { connection.trace ("storesMixedCaseQuotedIdentifiers"); return true; } /** * What's the string used to quote SQL identifiers? * This returns a space " " if identifier quoting isn't supported. * * A JDBC compliant driver always uses a double quote character. * * @return the quoting string */ public String getIdentifierQuoteString() throws SQLException { connection.trace ("getIdentifierQuoteString"); return ("\""); } /** * Get a comma separated list of all a database's SQL keywords * that are NOT also SQL92 keywords. * * @return the list */ public String getSQLKeywords() throws SQLException { connection.trace ("getSQLKeywords"); return "ACCESS, ADD, ALTER, AUDIT, CLUSTER, COLUMN, COMMENT, COMPRESS, CONNECT, DATE, DROP, EXCLUSIVE, FILE, IDENTIFIED, IMMEDIATE, INCREMENT, INDEX, INITIAL, INTERSECT, LEVEL, LOCK, LONG, MAXEXTENTS, MINUS, MODE, NOAUDIT, NOCOMPRESS, NOWAIT, NUMBER, OFFLINE, ONLINE, PCTFREE, PRIOR, all_PL_SQL_reserved_ words"; } /** * Get a comma separated list of math functions. * * @return the list */ public String getNumericFunctions() throws SQLException { connection.trace ("getNumericFunctions"); return "ABS, CEIL, COS, COSH, EXP, FLOOR, LN, LOG, MOD, POWER, ROUND, SIGN, SIN, SINH, SQRT, TAN, TANH, TRUNC, AVG, COUNT, GLB, LUB, MAX, MIN, STDDEV, SUM, VARIANCE"; } /** * Get a comma separated list of string functions. * * @return the list */ public String getStringFunctions() throws SQLException { connection.trace ("getStringFunctions"); return "CHR, INITCAP, LOWER, LPAD, LTRIM, NLS,_INITCAP, NLS,_LOWER, NLS,_UPPER, REPLACE, RPAD, RTRIM, SOUNDEX, SUBSTR, SUBSTRB, TRANSLATE, UPPER, ASCII, INSTR, INSTRB, LENGTH, LENGTHB, NLSSORT, CHARTOROWID, CONVERT, HEXTORAW, RAWTOHEX, ROWIDTOCHAR, TO_CHAR, TO_DATE, TO_LABEL, TO_MULTI_BYTE, TO_NUMBER, TO_SINGLE_BYTE"; } /** * Get a comma separated list of system functions. * * @return the list */ public String getSystemFunctions() throws SQLException { connection.trace ("getSystemFunctions"); return "DUMP, GREATEST, GREATEST_LB, LEAST, LEAST_UB, NVL, UID, USER, USERENV, VSIZE"; } /** * Get a comma separated list of time and date functions. * * @return the list */ public String getTimeDateFunctions() throws SQLException { connection.trace ("getTimeDateFunctions"); return "ADD_MONTHS, LAST_DAY, MONTHS_BETWEEN, NEW_TIME, NEXT_DAY, ROUND, SYSDATE, TRUNC"; } /** * This is the string that can be used to escape '_' or '%' in * the string pattern style catalog search parameters. * * <P>The '_' character represents any single character. * <P>The '%' character represents any sequence of zero or * more characters. * @return the string used to escape wildcard characters */ public String getSearchStringEscape() throws SQLException { connection.trace ("getSearchStringEscape"); return "//"; } /** * Get all the "extra" characters that can be used in unquoted * identifier names (those beyond a-z, 0-9 and _). * * @return the string containing the extra characters */ public String getExtraNameCharacters() throws SQLException { connection.trace ("getExtraNameCharacters"); return "$#"; } //-------------------------------------------------------------------- // Functions describing which features are supported. /** * Is "ALTER TABLE" with add column supported? * * @return true if so */ public boolean supportsAlterTableWithAddColumn() throws SQLException { connection.trace ("supportsAlterTableWithAddColumn"); return true; } /** * Is "ALTER TABLE" with drop column supported? * * @return true if so */ public boolean supportsAlterTableWithDropColumn() throws SQLException { connection.trace ("supportsAlterTableWithDropColumn"); return false; } /** * Is column aliasing supported? * * <P>If so, the SQL AS clause can be used to provide names for * computed columns or to provide alias names for columns as * required. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -