Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* // Copyright (c) 2015 Couchbase, Inc.
* // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* // except in compliance with the License. You may obtain a copy of the License at
* // http://www.apache.org/licenses/LICENSE-2.0
* // Unless required by applicable law or agreed to in writing, software distributed under the
* // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* // either express or implied. See the License for the specific language governing permissions
* // and limitations under the License.
*/
package com.couchbase;
import com.couchbase.jdbc.core.CouchMetrics;
import com.couchbase.jdbc.core.CouchResponse;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by davec on 2015-02-20.
*/
public class CBDatabaseMetaData implements DatabaseMetaData
{
final CBConnection connection;
public CBDatabaseMetaData(CBConnection connection)
{
this.connection=connection;
}
/**
* Retrieves whether the current user can call all the procedures
* returned by the method getProcedures.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean allProceduresAreCallable() throws SQLException
{
return true;
}
/**
* Retrieves whether the current user can use all the tables returned
* by the method getTables in a SELECT
* statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean allTablesAreSelectable() throws SQLException
{
return true;
}
/**
* Retrieves the URL for this DBMS.
*
* @return the URL for this DBMS or null if it cannot be
* generated
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getURL() throws SQLException
{
return connection.getURL();
}
/**
* Retrieves the user name as known to this database.
*
* @return the database user name
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getUserName() throws SQLException
{
return connection.getUserName();
}
/**
* Retrieves whether this database is in read-only mode.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean isReadOnly() throws SQLException
{
return connection.isReadOnly();
}
/**
* Retrieves whether NULL values are sorted high.
* Sorted high means that NULL values
* sort higher than any other value in a domain. In an ascending order,
* if this method returns true, NULL values
* will appear at the end. By contrast, the method
* nullsAreSortedAtEnd indicates whether NULL values
* are sorted at the end regardless of sort order.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean nullsAreSortedHigh() throws SQLException
{
return false;
}
/**
* Retrieves whether NULL values are sorted low.
* Sorted low means that NULL values
* sort lower than any other value in a domain. In an ascending order,
* if this method returns true, NULL values
* will appear at the beginning. By contrast, the method
* nullsAreSortedAtStart indicates whether NULL values
* are sorted at the beginning regardless of sort order.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean nullsAreSortedLow() throws SQLException
{
return true;
}
/**
* Retrieves whether NULL values are sorted at the start regardless
* of sort order.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean nullsAreSortedAtStart() throws SQLException
{
return false;
}
/**
* Retrieves whether NULL values are sorted at the end regardless of
* sort order.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean nullsAreSortedAtEnd() throws SQLException
{
return false;
}
/**
* Retrieves the name of this database product.
*
* @return database product name
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getDatabaseProductName() throws SQLException
{
return "Couchbase";
}
/**
* Retrieves the version number of this database product.
*
* @return database version number
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getDatabaseProductVersion() throws SQLException
{
ResultSet rs = connection.createStatement().executeQuery("select version()");
if(rs.next())
{
return rs.getString(1);
}
return null;
}
/**
* Retrieves the name of this JDBC driver.
*
* @return JDBC driver name
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getDriverName() throws SQLException
{
return CBDriver.DRIVER_NAME;
}
/**
* Retrieves the version number of this JDBC driver as a String.
*
* @return JDBC driver version
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getDriverVersion() throws SQLException
{
return ""+CBDriver.MAJOR_VERSION+'.'+CBDriver.MINOR_VERSION;
}
/**
* Retrieves this JDBC driver's major version number.
*
* @return JDBC driver major version
*/
@Override
public int getDriverMajorVersion()
{
return CBDriver.MAJOR_VERSION;
}
/**
* Retrieves this JDBC driver's minor version number.
*
* @return JDBC driver minor version number
*/
@Override
public int getDriverMinorVersion()
{
return CBDriver.MINOR_VERSION;
}
/**
* Retrieves whether this database stores tables in a local file.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean usesLocalFiles() throws SQLException
{
return false;
}
/**
* Retrieves whether this database uses a file for each table.
*
* @return true if this database uses a local file for each table;
* false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean usesLocalFilePerTable() throws SQLException
{
return false;
}
/**
* Retrieves whether this database treats mixed case unquoted SQL identifiers as
* case sensitive and as a result stores them in mixed case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsMixedCaseIdentifiers() throws SQLException
{
return true;
}
/**
* Retrieves whether this database treats mixed case unquoted SQL identifiers as
* case insensitive and stores them in upper case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean storesUpperCaseIdentifiers() throws SQLException
{
return false;
}
/**
* Retrieves whether this database treats mixed case unquoted SQL identifiers as
* case insensitive and stores them in lower case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean storesLowerCaseIdentifiers() throws SQLException
{
return false;
}
/**
* Retrieves whether this database treats mixed case unquoted SQL identifiers as
* case insensitive and stores them in mixed case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean storesMixedCaseIdentifiers() throws SQLException
{
return false;
}
/**
* Retrieves whether this database treats mixed case quoted SQL identifiers as
* case sensitive and as a result stores them in mixed case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException
{
return true;
}
/**
* Retrieves whether this database treats mixed case quoted SQL identifiers as
* case insensitive and stores them in upper case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean storesUpperCaseQuotedIdentifiers() throws SQLException
{
return false;
}
/**
* Retrieves whether this database treats mixed case quoted SQL identifiers as
* case insensitive and stores them in lower case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean storesLowerCaseQuotedIdentifiers() throws SQLException
{
return false;
}
/**
* Retrieves whether this database treats mixed case quoted SQL identifiers as
* case insensitive and stores them in mixed case.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean storesMixedCaseQuotedIdentifiers() throws SQLException
{
return false;
}
/**
* Retrieves the string used to quote SQL identifiers.
* This method returns a space " " if identifier quoting is not supported.
*
* @return the quoting string or a space if quoting is not supported
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getIdentifierQuoteString() throws SQLException
{
return "`";
}
/**
* Retrieves a comma-separated list of all of this database's SQL keywords
* that are NOT also SQL:2003 keywords.
*
* @return the list of this database's keywords that are not also
* SQL:2003 keywords
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getSQLKeywords() throws SQLException
{
return null;
}
/**
* Retrieves a comma-separated list of math functions available with
* this database. These are the Open /Open CLI math function names used in
* the JDBC function escape clause.
*
* @return the list of math functions supported by this database
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getNumericFunctions() throws SQLException
{
return "add,div,mod,mult,neg,sub,abs,acos,asin,atan,atan2,ceil,cos,deg,degrees,e,exp,ln,log,floor,inf,nan,neginf,pi,posinf,power,rad,radians,random,round,sign,sin,sqrt,tan,trunc";
}
/**
* Retrieves a comma-separated list of string functions available with
* this database. These are the Open Group CLI string function names used
* in the JDBC function escape clause.
*
* @return the list of string functions supported by this database
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getStringFunctions() throws SQLException
{
return "contains,initcap,length,lower,ltrim,position,pos,regex_contains,regex_like,regex_position,regex_pos,regex_replace,repeat,replace,rtrim,split,substr,title,trim,upper";
}
/**
* Retrieves a comma-separated list of system functions available with
* this database. These are the Open Group CLI system function names used
* in the JDBC function escape clause.
*
* @return a list of system functions supported by this database
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getSystemFunctions() throws SQLException
{
return "";
}
/**
* Retrieves a comma-separated list of the time and date functions available
* with this database.
*
* @return the list of time and date functions supported by this database
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getTimeDateFunctions() throws SQLException
{
return "clock_millis,clock_str,date_add_millis,date_add_str,date_diff_millis,date_diff_str,date_part_millis,date_part_str,date_trunc_millis,date_trunc_str,millis,millis_to_str,millis_to_utc,millis_to_zone_name,now_millis,now_str,str_to_millis,str_to_utc,str_to_zone_name";
}
/**
* Retrieves the string that can be used to escape wildcard characters.
* This is the string that can be used to escape '_' or '%' in
* the catalog search parameters that are a pattern (and therefore use one
* of the wildcard characters).
*
*
The '_' character represents any single character;
* the '%' character represents any sequence of zero or
* more characters.
*
* @return the string used to escape wildcard characters
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getSearchStringEscape() throws SQLException
{
return "\\";
}
/**
* Retrieves all the "extra" characters that can be used in unquoted
* identifier names (those beyond a-z, A-Z, 0-9 and _).
*
* @return the string containing the extra characters
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getExtraNameCharacters() throws SQLException
{
return "";
}
/**
* Retrieves whether this database supports ALTER TABLE
* with add column.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsAlterTableWithAddColumn() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports ALTER TABLE
* with drop column.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsAlterTableWithDropColumn() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports column aliasing.
*
*
If so, the SQL AS clause can be used to provide names for
* computed columns or to provide alias names for columns as
* required.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsColumnAliasing() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports concatenations between
* NULL and non-NULL values being
* NULL.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean nullPlusNonNullIsNull() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports the JDBC scalar function
* CONVERT for the conversion of one JDBC type to another.
* The JDBC types are the generic SQL data types defined
* in java.sql.Types.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsConvert() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports the JDBC scalar function
* CONVERT for conversions between the JDBC types fromType
* and toType. The JDBC types are the generic SQL data types defined
* in java.sql.Types.
*
* @param fromType the type to convert from; one of the type codes from
* the class java.sql.Types
* @param toType the type to convert to; one of the type codes from
* the class java.sql.Types
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
* @see Types
*/
@Override
public boolean supportsConvert(int fromType, int toType) throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports table correlation names.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsTableCorrelationNames() throws SQLException
{
return true;
}
/**
* Retrieves whether, when table correlation names are supported, they
* are restricted to being different from the names of the tables.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsDifferentTableCorrelationNames() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports expressions in
* ORDER BY lists.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsExpressionsInOrderBy() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports using a column that is
* not in the SELECT statement in an
* ORDER BY clause.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsOrderByUnrelated() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports some form of
* GROUP BY clause.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsGroupBy() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports using a column that is
* not in the SELECT statement in a
* GROUP BY clause.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsGroupByUnrelated() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports using columns not included in
* the SELECT statement in a GROUP BY clause
* provided that all of the columns in the SELECT statement
* are included in the GROUP BY clause.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsGroupByBeyondSelect() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports specifying a
* LIKE escape clause.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsLikeEscapeClause() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports getting multiple
* ResultSet objects from a single call to the
* method execute.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsMultipleResultSets() throws SQLException
{
return false;
}
/**
* Retrieves whether this database allows having multiple
* transactions open at once (on different connections).
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsMultipleTransactions() throws SQLException
{
return true;
}
/**
* Retrieves whether columns in this database may be defined as non-nullable.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsNonNullableColumns() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports the ODBC Minimum SQL grammar.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsMinimumSQLGrammar() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports the ODBC Core SQL grammar.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsCoreSQLGrammar() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports the ODBC Extended SQL grammar.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsExtendedSQLGrammar() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports the ANSI92 entry level SQL
* grammar.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsANSI92EntryLevelSQL() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsANSI92IntermediateSQL() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports the ANSI92 full SQL grammar supported.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsANSI92FullSQL() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports the SQL Integrity
* Enhancement Facility.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsIntegrityEnhancementFacility() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports some form of outer join.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsOuterJoins() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports full nested outer joins.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsFullOuterJoins() throws SQLException
{
return false;
}
/**
* Retrieves whether this database provides limited support for outer
* joins. (This will be true if the method
* supportsFullOuterJoins returns true).
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsLimitedOuterJoins() throws SQLException
{
return false;
}
/**
* Retrieves the database vendor's preferred term for "schema".
*
* @return the vendor term for "schema"
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getSchemaTerm() throws SQLException
{
return "NAMESPACE";
}
/**
* Retrieves the database vendor's preferred term for "procedure".
*
* @return the vendor term for "procedure"
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getProcedureTerm() throws SQLException
{
return "procedure";
}
/**
* Retrieves the database vendor's preferred term for "catalog".
*
* @return the vendor term for "catalog"
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getCatalogTerm() throws SQLException
{
return "namespace";
}
/**
* Retrieves whether a catalog appears at the start of a fully qualified
* table name. If not, the catalog appears at the end.
*
* @return true if the catalog name appears at the beginning
* of a fully qualified table name; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean isCatalogAtStart() throws SQLException
{
return true;
}
/**
* Retrieves the String that this database uses as the
* separator between a catalog and table name.
*
* @return the separator string
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public String getCatalogSeparator() throws SQLException
{
return ":";
}
/**
* Retrieves whether a schema name can be used in a data manipulation statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSchemasInDataManipulation() throws SQLException
{
return true;
}
/**
* Retrieves whether a schema name can be used in a procedure call statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSchemasInProcedureCalls() throws SQLException
{
return false;
}
/**
* Retrieves whether a schema name can be used in a table definition statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSchemasInTableDefinitions() throws SQLException
{
return false;
}
/**
* Retrieves whether a schema name can be used in an index definition statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSchemasInIndexDefinitions() throws SQLException
{
return true;
}
/**
* Retrieves whether a schema name can be used in a privilege definition statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException
{
return false;
}
/**
* Retrieves whether a catalog name can be used in a data manipulation statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsCatalogsInDataManipulation() throws SQLException
{
return true;
}
/**
* Retrieves whether a catalog name can be used in a procedure call statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsCatalogsInProcedureCalls() throws SQLException
{
return false;
}
/**
* Retrieves whether a catalog name can be used in a table definition statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsCatalogsInTableDefinitions() throws SQLException
{
return false;
}
/**
* Retrieves whether a catalog name can be used in an index definition statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsCatalogsInIndexDefinitions() throws SQLException
{
return true;
}
/**
* Retrieves whether a catalog name can be used in a privilege definition statement.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports positioned DELETE
* statements.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsPositionedDelete() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports positioned UPDATE
* statements.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsPositionedUpdate() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports SELECT FOR UPDATE
* statements.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSelectForUpdate() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports stored procedure calls
* that use the stored procedure escape syntax.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsStoredProcedures() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports subqueries in comparison
* expressions.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSubqueriesInComparisons() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports subqueries in
* EXISTS expressions.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSubqueriesInExists() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports subqueries in
* IN expressions.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSubqueriesInIns() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports subqueries in quantified
* expressions.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsSubqueriesInQuantifieds() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports correlated subqueries.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsCorrelatedSubqueries() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports SQL UNION.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsUnion() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports SQL UNION ALL.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsUnionAll() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports keeping cursors open
* across commits.
*
* @return true if cursors always remain open;
* false if they might not remain open
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsOpenCursorsAcrossCommit() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports keeping cursors open
* across rollbacks.
*
* @return true if cursors always remain open;
* false if they might not remain open
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsOpenCursorsAcrossRollback() throws SQLException
{
return false;
}
/**
* Retrieves whether this database supports keeping statements open
* across commits.
*
* @return true if statements always remain open;
* false if they might not remain open
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsOpenStatementsAcrossCommit() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports keeping statements open
* across rollbacks.
*
* @return true if statements always remain open;
* false if they might not remain open
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsOpenStatementsAcrossRollback() throws SQLException
{
return true;
}
/**
* Retrieves the maximum number of hex characters this database allows in an
* inline binary literal.
*
* @return max the maximum length (in hex characters) for a binary literal;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxBinaryLiteralLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters this database allows
* for a character literal.
*
* @return the maximum number of characters allowed for a character literal;
* a result of zero means that there is no limit or the limit is
* not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxCharLiteralLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters this database allows
* for a column name.
*
* @return the maximum number of characters allowed for a column name;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxColumnNameLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of columns this database allows in a
* GROUP BY clause.
*
* @return the maximum number of columns allowed;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxColumnsInGroupBy() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of columns this database allows in an index.
*
* @return the maximum number of columns allowed;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxColumnsInIndex() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of columns this database allows in an
* ORDER BY clause.
*
* @return the maximum number of columns allowed;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxColumnsInOrderBy() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of columns this database allows in a
* SELECT list.
*
* @return the maximum number of columns allowed;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxColumnsInSelect() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of columns this database allows in a table.
*
* @return the maximum number of columns allowed;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxColumnsInTable() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of concurrent connections to this
* database that are possible.
*
* @return the maximum number of active connections possible at one time;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxConnections() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters that this database allows in a
* cursor name.
*
* @return the maximum number of characters allowed in a cursor name;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxCursorNameLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of bytes this database allows for an
* index, including all of the parts of the index.
*
* @return the maximum number of bytes allowed; this limit includes the
* composite of all the constituent parts of the index;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxIndexLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters that this database allows in a
* schema name.
*
* @return the maximum number of characters allowed in a schema name;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxSchemaNameLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters that this database allows in a
* procedure name.
*
* @return the maximum number of characters allowed in a procedure name;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxProcedureNameLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters that this database allows in a
* catalog name.
*
* @return the maximum number of characters allowed in a catalog name;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxCatalogNameLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of bytes this database allows in
* a single row.
*
* @return the maximum number of bytes allowed for a row; a result of
* zero means that there is no limit or the limit is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxRowSize() throws SQLException
{
return 0;
}
/**
* Retrieves whether the return value for the method
* getMaxRowSize includes the SQL data types
* LONGVARCHAR and LONGVARBINARY.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean doesMaxRowSizeIncludeBlobs() throws SQLException
{
return true;
}
/**
* Retrieves the maximum number of characters this database allows in
* an SQL statement.
*
* @return the maximum number of characters allowed for an SQL statement;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxStatementLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of active statements to this database
* that can be open at the same time.
*
* @return the maximum number of statements that can be open at one time;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxStatements() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters this database allows in
* a table name.
*
* @return the maximum number of characters allowed for a table name;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxTableNameLength() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of tables this database allows in a
* SELECT statement.
*
* @return the maximum number of tables allowed in a SELECT
* statement; a result of zero means that there is no limit or
* the limit is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxTablesInSelect() throws SQLException
{
return 0;
}
/**
* Retrieves the maximum number of characters this database allows in
* a user name.
*
* @return the maximum number of characters allowed for a user name;
* a result of zero means that there is no limit or the limit
* is not known
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public int getMaxUserNameLength() throws SQLException
{
return 0;
}
/**
* Retrieves this database's default transaction isolation level. The
* possible values are defined in java.sql.Connection.
*
* @return the default isolation level
* @throws java.sql.SQLException if a database access error occurs
* @see Connection
*/
@Override
public int getDefaultTransactionIsolation() throws SQLException
{
return Connection.TRANSACTION_READ_UNCOMMITTED;
}
/**
* Retrieves whether this database supports transactions. If not, invoking the
* method commit is a noop, and the isolation level is
* TRANSACTION_NONE.
*
* @return true if transactions are supported;
* false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsTransactions() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports the given transaction isolation level.
*
* @param level one of the transaction isolation levels defined in
* java.sql.Connection
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
* @see Connection
*/
@Override
public boolean supportsTransactionIsolationLevel(int level) throws SQLException
{
return Connection.TRANSACTION_READ_UNCOMMITTED==level;
}
/**
* Retrieves whether this database supports both data definition and
* data manipulation statements within a transaction.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
{
return true;
}
/**
* Retrieves whether this database supports only data manipulation
* statements within a transaction.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean supportsDataManipulationTransactionsOnly() throws SQLException
{
return false;
}
/**
* Retrieves whether a data definition statement within a transaction forces
* the transaction to commit.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean dataDefinitionCausesTransactionCommit() throws SQLException
{
return false;
}
/**
* Retrieves whether this database ignores a data definition statement
* within a transaction.
*
* @return true if so; false otherwise
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public boolean dataDefinitionIgnoredInTransactions() throws SQLException
{
return false;
}
/**
* Retrieves a description of the stored procedures available in the given
* catalog.
*
* Only procedure descriptions matching the schema and
* procedure name criteria are returned. They are ordered by
* PROCEDURE_CAT, PROCEDURE_SCHEM,
* PROCEDURE_NAME and SPECIFIC_ NAME.
*
*
Each procedure description has the the following columns:
*
*
PROCEDURE_CAT String => procedure catalog (may be null)
*
PROCEDURE_SCHEM String => procedure schema (may be null)
*
PROCEDURE_NAME String => procedure name
*
reserved for future use
*
reserved for future use
*
reserved for future use
*
REMARKS String => explanatory comment on the procedure
*
PROCEDURE_TYPE short => kind of procedure:
*
*
procedureResultUnknown - Cannot determine if a return value
* will be returned
*
procedureNoResult - Does not return a return value
*
procedureReturnsResult - Returns a return value
*
*
SPECIFIC_NAME String => The name which uniquely identifies this
* procedure within its schema.
*
*
* A user may not have permissions to execute any of the procedures that are
* returned by getProcedures
*
* @param catalog a catalog name; must match the catalog name as it
* is stored in the database; "" retrieves those without a catalog;
* null means that the catalog name should not be used to narrow
* the search
* @param schemaPattern a schema name pattern; must match the schema name
* as it is stored in the database; "" retrieves those without a schema;
* null means that the schema name should not be used to narrow
* the search
* @param procedureNamePattern a procedure name pattern; must match the
* procedure name as it is stored in the database
* @return ResultSet - each row is a procedure description
* @throws java.sql.SQLException if a database access error occurs
* @see #getSearchStringEscape
*/
@Override
public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException
{
return getEmptyResultSet();
}
/**
* Retrieves a description of the given catalog's stored procedure parameter
* and result columns.
*
*
Only descriptions matching the schema, procedure and
* parameter name criteria are returned. They are ordered by
* PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME and SPECIFIC_NAME. Within this, the return value,
* if any, is first. Next are the parameter descriptions in call
* order. The column descriptions follow in column number order.
*
*
Each row in the ResultSet is a parameter description or
* column description with the following fields:
*
*
PROCEDURE_CAT String => procedure catalog (may be null)
*
PROCEDURE_SCHEM String => procedure schema (may be null)
*
PROCEDURE_NAME String => procedure name
*
COLUMN_NAME String => column/parameter name
*
COLUMN_TYPE Short => kind of column/parameter:
*
*
procedureColumnUnknown - nobody knows
*
procedureColumnIn - IN parameter
*
procedureColumnInOut - INOUT parameter
*
procedureColumnOut - OUT parameter
*
procedureColumnReturn - procedure return value
*
procedureColumnResult - result column in ResultSet
*
*
DATA_TYPE int => SQL type from java.sql.Types
*
TYPE_NAME String => SQL type name, for a UDT type the
* type name is fully qualified
*
PRECISION int => precision
*
LENGTH int => length in bytes of data
*
SCALE short => scale - null is returned for data types where
* SCALE is not applicable.
*
COLUMN_DEF String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null)
*
*
The string NULL (not enclosed in quotes) - if NULL was specified as the default value
*
TRUNCATE (not enclosed in quotes) - if the specified default value cannot be represented without truncation
*
NULL - if a default value was not specified
*
*
SQL_DATA_TYPE int => reserved for future use
*
SQL_DATETIME_SUB int => reserved for future use
*
CHAR_OCTET_LENGTH int => the maximum length of binary and character based columns. For any other datatype the returned value is a
* NULL
*
ORDINAL_POSITION int => the ordinal position, starting from 1, for the input and output parameters for a procedure. A value of 0
* is returned if this row describes the procedure's return value. For result set columns, it is the
* ordinal position of the column in the result set starting from 1. If there are
* multiple result sets, the column ordinal positions are implementation
* defined.
*
IS_NULLABLE String => ISO rules are used to determine the nullability for a column.
*
*
YES --- if the column can include NULLs
*
NO --- if the column cannot include NULLs
*
empty string --- if the nullability for the
* column is unknown
*
*
SPECIFIC_NAME String => the name which uniquely identifies this procedure within its schema.
*
*
*
Note: Some databases may not return the column
* descriptions for a procedure.
*
*
The PRECISION column represents the specified column size for the given column.
* For numeric data, this is the maximum precision. For character data, this is the length in characters.
* For datetime datatypes, this is the length in characters of the String representation (assuming the
* maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype,
* this is the length in bytes. Null is returned for data types where the
* column size is not applicable.
*
* @param catalog a catalog name; must match the catalog name as it
* is stored in the database; "" retrieves those without a catalog;
* null means that the catalog name should not be used to narrow
* the search
* @param schemaPattern a schema name pattern; must match the schema name
* as it is stored in the database; "" retrieves those without a schema;
* null means that the schema name should not be used to narrow
* the search
* @param procedureNamePattern a procedure name pattern; must match the
* procedure name as it is stored in the database
* @param columnNamePattern a column name pattern; must match the column name
* as it is stored in the database
* @return ResultSet - each row describes a stored procedure parameter or
* column
* @throws java.sql.SQLException if a database access error occurs
* @see #getSearchStringEscape
*/
@Override
public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException
{
return getEmptyResultSet();
}
/**
* Retrieves a description of the tables available in the given catalog.
* Only table descriptions matching the catalog, schema, table
* name and type criteria are returned. They are ordered by
* TABLE_TYPE, TABLE_CAT,
* TABLE_SCHEM and TABLE_NAME.
*
* Each table description has the following columns:
*
*
TABLE_CAT String => table catalog (may be null)
*
TABLE_SCHEM String => table schema (may be null)
*
REMARKS String => explanatory comment on the table
*
TYPE_CAT String => the types catalog (may be null)
*
TYPE_SCHEM String => the types schema (may be null)
*
TYPE_NAME String => type name (may be null)
*
SELF_REFERENCING_COL_NAME String => name of the designated
* "identifier" column of a typed table (may be null)
*
REF_GENERATION String => specifies how values in
* SELF_REFERENCING_COL_NAME are created. Values are
* "SYSTEM", "USER", "DERIVED". (may be null)
*
*
*
Note: Some databases may not return information for
* all tables.
*
* @param catalog a catalog name; must match the catalog name as it
* is stored in the database; "" retrieves those without a catalog;
* null means that the catalog name should not be used to narrow
* the search
* @param schemaPattern a schema name pattern; must match the schema name
* as it is stored in the database; "" retrieves those without a schema;
* null means that the schema name should not be used to narrow
* the search
* @param tableNamePattern a table name pattern; must match the
* table name as it is stored in the database
* @param types a list of table types, which must be from the list of table types
* returned from {@link #getTableTypes},to include; null returns
* all types
* @return ResultSet - each row is a table description
* @throws java.sql.SQLException if a database access error occurs
* @see #getSearchStringEscape
*/
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
{
String sql = "select null as TABLE_CAT, namespace_id as TABLE_SCHEM, name as TABLE_NAME, 'TABLE' as TABLE_TYPE, null as REMARKS, null as TYPE_CAT, null as TYPE_SCHEM," +
"null as TYPE_NAME, null as SELF_REFERENCING_COL_NAME, null as REF_GENERATION from system:keyspaces";
if (schemaPattern != null || tableNamePattern != null)
{
sql += " where ";
if ( schemaPattern != null )
{
sql += "namespace_id like '" + schemaPattern + "'";
}
if ( schemaPattern != null && tableNamePattern != null )
{
sql += " and ";
}
if (tableNamePattern != null )
{
sql += "name LIKE '" + tableNamePattern +"'";
}
}
try(Statement statement = connection.createStatement())
{
return statement.executeQuery(sql);
}
}
/**
* Retrieves the schema names available in this database. The results
* are ordered by TABLE_CATALOG and
* TABLE_SCHEM.
*
*
The schema columns are:
*
*
TABLE_SCHEM String => schema name
*
TABLE_CATALOG String => catalog name (may be null)
*
*
* @return a ResultSet object in which each row is a
* schema description
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public ResultSet getSchemas() throws SQLException
{
return getSchemas(null, null);
}
/**
* Retrieves the catalog names available in this database. The results
* are ordered by catalog name.
*
*
The catalog column is:
*
*
TABLE_CAT String => catalog name
*
*
* @return a ResultSet object in which each row has a
* single String column that is a catalog name
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public ResultSet getCatalogs() throws SQLException
{
String sql = "select name as TABLE_CAT from system:namespaces";
try( Statement statement = connection.createStatement())
{
return statement.executeQuery( sql );
}
}
/**
* Retrieves the table types available in this database. The results
* are ordered by table type.
*
*
*
* @return a ResultSet object in which each row has a
* single String column that is a table type
* @throws java.sql.SQLException if a database access error occurs
*/
@Override
public ResultSet getTableTypes() throws SQLException
{
List