Package de.thomas_oster.lazysql
Class AbstractRDBMSAdapter
java.lang.Object
de.thomas_oster.lazysql.AbstractRDBMSAdapter
- Direct Known Subclasses:
MssqlAdapter,MysqlAdapter,OracleAdapter,UnknownRDBMSAdapter
A class representing support for an RDBMS. If your RDBMS need some special
treatment, extend this class and add your implementation to the getAdapterByDbUri
method
- Author:
- Thomas Oster (mail@thomas-oster.de)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcheckSQLSyntax(Connection con, String sql, List<Argument> params) static AbstractRDBMSAdaptergetAdapterByDbUri(String dburi, String customDriver) protected ClassgetColumnType(int DATA_TYPE, String TYPE_NAME, int NULLABLE) Maps the SQL Column type to java class.getInsertableTableColumns(Connection con, String name, String prefix) getInsertableTableColumns(Connection con, String catalog, String schema, String name, String prefix) getSchemas(Connection con, String prefix) getSchemas(Connection con, String catalog, String prefix) getSqlQueryType(Connection con, String sql, List<Argument> params) Let's the db analyze an SQL query and throws an exception or returns a map containing the names and types of the resulting rowsgetStoredProcedureParameters(Connection con, String name) getStoredProcedureParameters(Connection con, String catalog, String schema, String name) getStoredProcedures(Connection con, String prefix) getStoredProcedures(Connection con, String catalog, String schema, String prefix) getTableColumns(Connection con, String name, String prefix) getTableColumns(Connection con, String catalog, String schema, String name, String prefix) getTables(Connection db, String prefix) getTables(Connection db, String catalog, String schema, String prefix) protected final voidtryToLoadDriver(String className)
-
Constructor Details
-
AbstractRDBMSAdapter
public AbstractRDBMSAdapter()
-
-
Method Details
-
tryToLoadDriver
-
getAdapterByDbUri
public static AbstractRDBMSAdapter getAdapterByDbUri(String dburi, String customDriver) throws DbConfig.ConfigException - Throws:
DbConfig.ConfigException
-
getColumnType
Maps the SQL Column type to java class. Gets the information from the getMetadata().getColumns method if it returns null, the column is ignored.- Parameters:
DATA_TYPE- the datatype from the metadataTYPE_NAME- the type name from the metadataNULLABLE- the nullable column from the metadata- Returns:
- the java Type corresponding to the SQL type name and nullable information
-
getSchemas
- Throws:
SQLException
-
getSchemas
- Throws:
SQLException
-
getInsertableTableColumns
protected List<Argument> getInsertableTableColumns(Connection con, String catalog, String schema, String name, String prefix) throws SQLException - Throws:
SQLException
-
getTableColumns
protected List<Argument> getTableColumns(Connection con, String catalog, String schema, String name, String prefix) throws SQLException - Throws:
SQLException
-
getTableColumns
public List<Argument> getTableColumns(Connection con, String name, String prefix) throws SQLException - Throws:
SQLException
-
getInsertableTableColumns
public List<Argument> getInsertableTableColumns(Connection con, String name, String prefix) throws SQLException - Throws:
SQLException
-
getStoredProcedureParameters
public List<Argument> getStoredProcedureParameters(Connection con, String catalog, String schema, String name) throws SQLException, AbstractRDBMSAdapter.NotSupportedException -
getStoredProcedureParameters
public List<Argument> getStoredProcedureParameters(Connection con, String name) throws SQLException, AbstractRDBMSAdapter.NotSupportedException -
getStoredProcedures
public List<AbstractRDBMSAdapter.Procedure> getStoredProcedures(Connection con, String catalog, String schema, String prefix) throws SQLException, AbstractRDBMSAdapter.NotSupportedException -
getStoredProcedures
public List<AbstractRDBMSAdapter.Procedure> getStoredProcedures(Connection con, String prefix) throws SQLException, AbstractRDBMSAdapter.NotSupportedException -
getSqlQueryType
public abstract List<Argument> getSqlQueryType(Connection con, String sql, List<Argument> params) throws SQLException, AbstractRDBMSAdapter.NotSupportedException Let's the db analyze an SQL query and throws an exception or returns a map containing the names and types of the resulting rows- Parameters:
con- the database connectionsql- the sql queryparams- a list of parameters used in this query- Returns:
- returns a list of arguments corresponding to the query result type
- Throws:
SQLException- if the query is wrongAbstractRDBMSAdapter.NotSupportedException- if the corresponding adapter cannot check the query result type
-
checkSQLSyntax
public abstract void checkSQLSyntax(Connection con, String sql, List<Argument> params) throws SQLException, AbstractRDBMSAdapter.NotSupportedException -
getTables
public List<String> getTables(Connection db, String catalog, String schema, String prefix) throws SQLException - Throws:
SQLException
-
getTables
- Throws:
SQLException
-