improved sql parser.

This commit is contained in:
wenshao
2017-05-28 17:39:53 +08:00
parent 78488b0b1a
commit a29eb6e0d2
45 changed files with 2303 additions and 89 deletions
@@ -0,0 +1,907 @@
/*
* Copyright 1999-2017 Alibaba Group Holding Ltd.
*
* 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.alibaba.druid.proxy.jdbc;
import java.sql.*;
/**
* Created by wenshao on 26/05/2017.
*/
public class DatabaseMetaDataProxyImpl implements DatabaseMetaData {
private DatabaseMetaData metaData;
public DatabaseMetaDataProxyImpl(DatabaseMetaData metaData) {
this.metaData = metaData;
}
@Override
public boolean allProceduresAreCallable() throws SQLException {
return metaData.allProceduresAreCallable();
}
@Override
public boolean allTablesAreSelectable() throws SQLException {
return metaData.allTablesAreSelectable();
}
@Override
public String getURL() throws SQLException {
return metaData.getURL();
}
@Override
public String getUserName() throws SQLException {
return metaData.getUserName();
}
@Override
public boolean isReadOnly() throws SQLException {
return metaData.isReadOnly();
}
@Override
public boolean nullsAreSortedHigh() throws SQLException {
return metaData.nullsAreSortedHigh();
}
@Override
public boolean nullsAreSortedLow() throws SQLException {
return metaData.nullsAreSortedLow();
}
@Override
public boolean nullsAreSortedAtStart() throws SQLException {
return metaData.nullsAreSortedAtStart();
}
@Override
public boolean nullsAreSortedAtEnd() throws SQLException {
return metaData.nullsAreSortedAtEnd();
}
@Override
public String getDatabaseProductName() throws SQLException {
return metaData.getDatabaseProductName();
}
@Override
public String getDatabaseProductVersion() throws SQLException {
return metaData.getDatabaseProductVersion();
}
@Override
public String getDriverName() throws SQLException {
return metaData.getDriverName();
}
@Override
public String getDriverVersion() throws SQLException {
return metaData.getDriverVersion();
}
@Override
public int getDriverMajorVersion() {
return metaData.getDriverMajorVersion();
}
@Override
public int getDriverMinorVersion() {
return metaData.getDriverMinorVersion();
}
@Override
public boolean usesLocalFiles() throws SQLException {
return metaData.usesLocalFiles();
}
@Override
public boolean usesLocalFilePerTable() throws SQLException {
return metaData.usesLocalFilePerTable();
}
@Override
public boolean supportsMixedCaseIdentifiers() throws SQLException {
return metaData.supportsMixedCaseIdentifiers();
}
@Override
public boolean storesUpperCaseIdentifiers() throws SQLException {
return metaData.storesUpperCaseIdentifiers();
}
@Override
public boolean storesLowerCaseIdentifiers() throws SQLException {
return metaData.storesMixedCaseIdentifiers();
}
@Override
public boolean storesMixedCaseIdentifiers() throws SQLException {
return metaData.supportsMixedCaseIdentifiers();
}
@Override
public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
return metaData.supportsMixedCaseQuotedIdentifiers();
}
@Override
public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
return metaData.storesUpperCaseIdentifiers();
}
@Override
public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
return metaData.storesLowerCaseQuotedIdentifiers();
}
@Override
public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
return metaData.storesMixedCaseQuotedIdentifiers();
}
@Override
public String getIdentifierQuoteString() throws SQLException {
return metaData.getIdentifierQuoteString();
}
@Override
public String getSQLKeywords() throws SQLException {
return metaData.getSQLKeywords();
}
@Override
public String getNumericFunctions() throws SQLException {
return metaData.getNumericFunctions();
}
@Override
public String getStringFunctions() throws SQLException {
return metaData.getStringFunctions();
}
@Override
public String getSystemFunctions() throws SQLException {
return metaData.getSystemFunctions();
}
@Override
public String getTimeDateFunctions() throws SQLException {
return metaData.getTimeDateFunctions();
}
@Override
public String getSearchStringEscape() throws SQLException {
return metaData.getSearchStringEscape();
}
@Override
public String getExtraNameCharacters() throws SQLException {
return metaData.getExtraNameCharacters();
}
@Override
public boolean supportsAlterTableWithAddColumn() throws SQLException {
return metaData.supportsAlterTableWithAddColumn();
}
@Override
public boolean supportsAlterTableWithDropColumn() throws SQLException {
return metaData.supportsAlterTableWithDropColumn();
}
@Override
public boolean supportsColumnAliasing() throws SQLException {
return metaData.supportsColumnAliasing();
}
@Override
public boolean nullPlusNonNullIsNull() throws SQLException {
return metaData.nullPlusNonNullIsNull();
}
@Override
public boolean supportsConvert() throws SQLException {
return metaData.supportsConvert();
}
@Override
public boolean supportsConvert(int fromType, int toType) throws SQLException {
return metaData.supportsConvert(fromType, toType);
}
@Override
public boolean supportsTableCorrelationNames() throws SQLException {
return metaData.supportsTableCorrelationNames();
}
@Override
public boolean supportsDifferentTableCorrelationNames() throws SQLException {
return metaData.supportsDifferentTableCorrelationNames();
}
@Override
public boolean supportsExpressionsInOrderBy() throws SQLException {
return metaData.supportsExpressionsInOrderBy();
}
@Override
public boolean supportsOrderByUnrelated() throws SQLException {
return metaData.supportsOrderByUnrelated();
}
@Override
public boolean supportsGroupBy() throws SQLException {
return metaData.supportsGroupBy();
}
@Override
public boolean supportsGroupByUnrelated() throws SQLException {
return metaData.supportsGroupByUnrelated();
}
@Override
public boolean supportsGroupByBeyondSelect() throws SQLException {
return metaData.supportsGroupByBeyondSelect();
}
@Override
public boolean supportsLikeEscapeClause() throws SQLException {
return metaData.supportsLikeEscapeClause();
}
@Override
public boolean supportsMultipleResultSets() throws SQLException {
return metaData.supportsMultipleResultSets();
}
@Override
public boolean supportsMultipleTransactions() throws SQLException {
return metaData.supportsMultipleTransactions();
}
@Override
public boolean supportsNonNullableColumns() throws SQLException {
return metaData.supportsNonNullableColumns();
}
@Override
public boolean supportsMinimumSQLGrammar() throws SQLException {
return metaData.supportsMinimumSQLGrammar();
}
@Override
public boolean supportsCoreSQLGrammar() throws SQLException {
return metaData.supportsCoreSQLGrammar();
}
@Override
public boolean supportsExtendedSQLGrammar() throws SQLException {
return metaData.supportsExtendedSQLGrammar();
}
@Override
public boolean supportsANSI92EntryLevelSQL() throws SQLException {
return metaData.supportsANSI92EntryLevelSQL();
}
@Override
public boolean supportsANSI92IntermediateSQL() throws SQLException {
return metaData.supportsANSI92IntermediateSQL();
}
@Override
public boolean supportsANSI92FullSQL() throws SQLException {
return metaData.supportsANSI92FullSQL();
}
@Override
public boolean supportsIntegrityEnhancementFacility() throws SQLException {
return metaData.supportsIntegrityEnhancementFacility();
}
@Override
public boolean supportsOuterJoins() throws SQLException {
return metaData.supportsOuterJoins();
}
@Override
public boolean supportsFullOuterJoins() throws SQLException {
return metaData.supportsFullOuterJoins();
}
@Override
public boolean supportsLimitedOuterJoins() throws SQLException {
return metaData.supportsLimitedOuterJoins();
}
@Override
public String getSchemaTerm() throws SQLException {
return metaData.getSchemaTerm();
}
@Override
public String getProcedureTerm() throws SQLException {
return metaData.getProcedureTerm();
}
@Override
public String getCatalogTerm() throws SQLException {
return metaData.getCatalogTerm();
}
@Override
public boolean isCatalogAtStart() throws SQLException {
return metaData.isCatalogAtStart();
}
@Override
public String getCatalogSeparator() throws SQLException {
return metaData.getCatalogSeparator();
}
@Override
public boolean supportsSchemasInDataManipulation() throws SQLException {
return metaData.supportsSchemasInDataManipulation();
}
@Override
public boolean supportsSchemasInProcedureCalls() throws SQLException {
return metaData.supportsSchemasInProcedureCalls();
}
@Override
public boolean supportsSchemasInTableDefinitions() throws SQLException {
return metaData.supportsSchemasInTableDefinitions();
}
@Override
public boolean supportsSchemasInIndexDefinitions() throws SQLException {
return metaData.supportsSchemasInIndexDefinitions();
}
@Override
public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
return metaData.supportsSchemasInPrivilegeDefinitions();
}
@Override
public boolean supportsCatalogsInDataManipulation() throws SQLException {
return metaData.supportsCatalogsInDataManipulation();
}
@Override
public boolean supportsCatalogsInProcedureCalls() throws SQLException {
return metaData.supportsCatalogsInProcedureCalls();
}
@Override
public boolean supportsCatalogsInTableDefinitions() throws SQLException {
return metaData.supportsCatalogsInTableDefinitions();
}
@Override
public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
return metaData.supportsCatalogsInIndexDefinitions();
}
@Override
public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
return metaData.supportsCatalogsInPrivilegeDefinitions();
}
@Override
public boolean supportsPositionedDelete() throws SQLException {
return metaData.supportsPositionedDelete();
}
@Override
public boolean supportsPositionedUpdate() throws SQLException {
return metaData.supportsPositionedUpdate();
}
@Override
public boolean supportsSelectForUpdate() throws SQLException {
return metaData.supportsSelectForUpdate();
}
@Override
public boolean supportsStoredProcedures() throws SQLException {
return metaData.supportsStoredProcedures();
}
@Override
public boolean supportsSubqueriesInComparisons() throws SQLException {
return metaData.supportsSubqueriesInComparisons();
}
@Override
public boolean supportsSubqueriesInExists() throws SQLException {
return metaData.supportsSubqueriesInExists();
}
@Override
public boolean supportsSubqueriesInIns() throws SQLException {
return metaData.supportsSubqueriesInIns();
}
@Override
public boolean supportsSubqueriesInQuantifieds() throws SQLException {
return metaData.supportsSubqueriesInQuantifieds();
}
@Override
public boolean supportsCorrelatedSubqueries() throws SQLException {
return metaData.supportsCorrelatedSubqueries();
}
@Override
public boolean supportsUnion() throws SQLException {
return metaData.supportsUnion();
}
@Override
public boolean supportsUnionAll() throws SQLException {
return metaData.supportsUnionAll();
}
@Override
public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
return metaData.supportsOpenCursorsAcrossCommit();
}
@Override
public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
return metaData.supportsOpenCursorsAcrossRollback();
}
@Override
public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
return metaData.supportsOpenStatementsAcrossCommit();
}
@Override
public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
return metaData.supportsOpenStatementsAcrossRollback();
}
@Override
public int getMaxBinaryLiteralLength() throws SQLException {
return metaData.getMaxBinaryLiteralLength();
}
@Override
public int getMaxCharLiteralLength() throws SQLException {
return metaData.getMaxCharLiteralLength();
}
@Override
public int getMaxColumnNameLength() throws SQLException {
return metaData.getMaxColumnNameLength();
}
@Override
public int getMaxColumnsInGroupBy() throws SQLException {
return metaData.getMaxColumnsInGroupBy();
}
@Override
public int getMaxColumnsInIndex() throws SQLException {
return metaData.getMaxColumnsInIndex();
}
@Override
public int getMaxColumnsInOrderBy() throws SQLException {
return metaData.getMaxColumnsInOrderBy();
}
@Override
public int getMaxColumnsInSelect() throws SQLException {
return metaData.getMaxColumnsInSelect();
}
@Override
public int getMaxColumnsInTable() throws SQLException {
return metaData.getMaxColumnsInTable();
}
@Override
public int getMaxConnections() throws SQLException {
return metaData.getMaxConnections();
}
@Override
public int getMaxCursorNameLength() throws SQLException {
return metaData.getMaxCursorNameLength();
}
@Override
public int getMaxIndexLength() throws SQLException {
return metaData.getMaxIndexLength();
}
@Override
public int getMaxSchemaNameLength() throws SQLException {
return metaData.getMaxSchemaNameLength();
}
@Override
public int getMaxProcedureNameLength() throws SQLException {
return metaData.getMaxProcedureNameLength();
}
@Override
public int getMaxCatalogNameLength() throws SQLException {
return metaData.getMaxCatalogNameLength();
}
@Override
public int getMaxRowSize() throws SQLException {
return metaData.getMaxRowSize();
}
@Override
public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
return metaData.doesMaxRowSizeIncludeBlobs();
}
@Override
public int getMaxStatementLength() throws SQLException {
return metaData.getMaxStatementLength();
}
@Override
public int getMaxStatements() throws SQLException {
return metaData.getMaxStatements();
}
@Override
public int getMaxTableNameLength() throws SQLException {
return metaData.getMaxTableNameLength();
}
@Override
public int getMaxTablesInSelect() throws SQLException {
return metaData.getMaxTablesInSelect();
}
@Override
public int getMaxUserNameLength() throws SQLException {
return metaData.getMaxUserNameLength();
}
@Override
public int getDefaultTransactionIsolation() throws SQLException {
return metaData.getDefaultTransactionIsolation();
}
@Override
public boolean supportsTransactions() throws SQLException {
return metaData.supportsTransactions();
}
@Override
public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
return metaData.supportsTransactionIsolationLevel(level);
}
@Override
public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
return metaData.supportsDataDefinitionAndDataManipulationTransactions();
}
@Override
public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
return metaData.supportsDataManipulationTransactionsOnly();
}
@Override
public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
return metaData.dataDefinitionCausesTransactionCommit();
}
@Override
public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
return metaData.dataDefinitionIgnoredInTransactions();
}
@Override
public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException {
return metaData.getProcedures(catalog, schemaPattern, procedureNamePattern);
}
@Override
public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException {
return metaData.getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern);
}
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
return metaData.getTables(catalog, schemaPattern, tableNamePattern, types);
}
@Override
public ResultSet getSchemas() throws SQLException {
return metaData.getSchemas();
}
@Override
public ResultSet getCatalogs() throws SQLException {
return metaData.getCatalogs();
}
@Override
public ResultSet getTableTypes() throws SQLException {
return metaData.getTableTypes();
}
@Override
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
return metaData.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern);
}
@Override
public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException {
return metaData.getColumnPrivileges(catalog, schema, table, columnNamePattern);
}
@Override
public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
return metaData.getTablePrivileges(catalog, schemaPattern, tableNamePattern);
}
@Override
public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException {
return metaData.getBestRowIdentifier(catalog, schema, table, scope, nullable);
}
@Override
public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException {
return metaData.getVersionColumns(catalog, schema, table);
}
@Override
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
return metaData.getPrimaryKeys(catalog, schema, table);
}
@Override
public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException {
return metaData.getImportedKeys(catalog, schema, table);
}
@Override
public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
return metaData.getExportedKeys(catalog, schema, table);
}
@Override
public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException {
return metaData.getCrossReference(parentCatalog, parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable);
}
@Override
public ResultSet getTypeInfo() throws SQLException {
return metaData.getTypeInfo();
}
@Override
public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException {
return metaData.getIndexInfo(catalog, schema, table, unique, approximate);
}
@Override
public boolean supportsResultSetType(int type) throws SQLException {
return metaData.supportsResultSetType(type);
}
@Override
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
return metaData.supportsResultSetConcurrency(type, concurrency);
}
@Override
public boolean ownUpdatesAreVisible(int type) throws SQLException {
return metaData.ownUpdatesAreVisible(type);
}
@Override
public boolean ownDeletesAreVisible(int type) throws SQLException {
return metaData.ownDeletesAreVisible(type);
}
@Override
public boolean ownInsertsAreVisible(int type) throws SQLException {
return metaData.ownInsertsAreVisible(type);
}
@Override
public boolean othersUpdatesAreVisible(int type) throws SQLException {
return metaData.othersUpdatesAreVisible(type);
}
@Override
public boolean othersDeletesAreVisible(int type) throws SQLException {
return metaData.othersDeletesAreVisible(type);
}
@Override
public boolean othersInsertsAreVisible(int type) throws SQLException {
return metaData.othersInsertsAreVisible(type);
}
@Override
public boolean updatesAreDetected(int type) throws SQLException {
return metaData.updatesAreDetected(type);
}
@Override
public boolean deletesAreDetected(int type) throws SQLException {
return metaData.deletesAreDetected(type);
}
@Override
public boolean insertsAreDetected(int type) throws SQLException {
return metaData.insertsAreDetected(type);
}
@Override
public boolean supportsBatchUpdates() throws SQLException {
return metaData.supportsBatchUpdates();
}
@Override
public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException {
return metaData.getUDTs(catalog, schemaPattern, typeNamePattern, types);
}
@Override
public Connection getConnection() throws SQLException {
return metaData.getConnection();
}
@Override
public boolean supportsSavepoints() throws SQLException {
return metaData.supportsSavepoints();
}
@Override
public boolean supportsNamedParameters() throws SQLException {
return metaData.supportsNamedParameters();
}
@Override
public boolean supportsMultipleOpenResults() throws SQLException {
return metaData.supportsMultipleOpenResults();
}
@Override
public boolean supportsGetGeneratedKeys() throws SQLException {
return metaData.supportsGetGeneratedKeys();
}
@Override
public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException {
return metaData.getSuperTypes(catalog, schemaPattern, typeNamePattern);
}
@Override
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
return metaData.getSuperTypes(catalog, schemaPattern, tableNamePattern);
}
@Override
public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException {
return metaData.getAttributes(catalog, schemaPattern, typeNamePattern, attributeNamePattern);
}
@Override
public boolean supportsResultSetHoldability(int holdability) throws SQLException {
return metaData.supportsResultSetHoldability(holdability);
}
@Override
public int getResultSetHoldability() throws SQLException {
return metaData.getResultSetHoldability();
}
@Override
public int getDatabaseMajorVersion() throws SQLException {
return metaData.getDatabaseMajorVersion();
}
@Override
public int getDatabaseMinorVersion() throws SQLException {
return metaData.getDatabaseMinorVersion();
}
@Override
public int getJDBCMajorVersion() throws SQLException {
return metaData.getJDBCMajorVersion();
}
@Override
public int getJDBCMinorVersion() throws SQLException {
return metaData.getJDBCMinorVersion();
}
@Override
public int getSQLStateType() throws SQLException {
return metaData.getSQLStateType();
}
@Override
public boolean locatorsUpdateCopy() throws SQLException {
return metaData.locatorsUpdateCopy();
}
@Override
public boolean supportsStatementPooling() throws SQLException {
return metaData.supportsStatementPooling();
}
@Override
public RowIdLifetime getRowIdLifetime() throws SQLException {
return metaData.getRowIdLifetime();
}
@Override
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
return metaData.getSchemas(catalog, schemaPattern);
}
@Override
public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
return metaData.supportsStoredFunctionsUsingCallSyntax();
}
@Override
public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
return metaData.autoCommitFailureClosesAllResultSets();
}
@Override
public ResultSet getClientInfoProperties() throws SQLException {
return metaData.getClientInfoProperties();
}
@Override
public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException {
return metaData.getFunctions(catalog, schemaPattern, functionNamePattern);
}
@Override
public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException {
return metaData.getFunctionColumns(catalog, schemaPattern, functionNamePattern, columnNamePattern);
}
public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
return metaData.getPseudoColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern);
}
public boolean generatedKeyAlwaysReturned() throws SQLException {
return metaData.generatedKeyAlwaysReturned();
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return metaData.unwrap(iface);
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return metaData.isWrapperFor(iface);
}
}