public abstract class AbstractSQLHandler extends Object implements SQLHandler
| Modifier and Type | Field and Description |
|---|---|
protected static String |
ADD |
protected static String |
ALTER_TABLE |
protected static String |
COLUMN |
protected static String |
CREATE_TABLE |
static boolean |
DEBUG |
protected static String |
DEFAULT |
protected static String |
DROP |
protected static String |
DROP_TABLE |
protected static String |
NOT_NULL |
CLOSE_PARENTHESIS, OPEN_PARENTHESIS| Constructor and Description |
|---|
AbstractSQLHandler() |
| Modifier and Type | Method and Description |
|---|---|
ISQLInfo |
alterSQLTable(List sqlTables,
Connection connection)
This method alters a database table.
|
String |
alterSQLTable(SQLTableAlter table,
Connection connection)
Alter the table in the database using ANSI standard
|
ISQLInfo |
alterSQLTableTransactional(List sqlTables,
Connection connection)
This method alters a database table in transactional mode.
|
ISQLInfo |
createSQLTable(List sqlTables,
Connection connection)
This method creates a database table.
|
String |
createSQLTable(SQLTableCreation table,
Connection connection)
Creates the table in the database using ANSI standard
|
ISQLInfo |
createSQLTableTransactional(List sqlTables,
Connection connection)
This method creates a database table in transactional mode.
|
String |
createStatementAlterTable(SQLTableAlter table)
Return the SQL Statement to alter the table.
|
String |
createStatementCreateTable(SQLTableCreation table)
Return the SQL Statement to create the table.
|
String |
createStatementDropTable(SQLTableDrop table)
Return the SQL Statement to drop the table.
|
ISQLInfo |
dropSQLTable(List sqlTables,
Connection connection)
This method drops a database table.
|
String |
dropSQLTable(SQLTableDrop table,
Connection connection)
Drop the table in the database using ANSI standard
|
ISQLInfo |
dropSQLTableTransactional(List sqlTables,
Connection connection)
This method drops a database table in transactional mode.
|
protected static void |
executeSQL(String sql,
Connection con)
Execute the SQL Statement.
|
ISQLInfo |
executeSQLTable(List sqlTables,
Connection connection)
This method executes a serial of SQL actions(create,drop or alter) over a
database table.
|
ISQLInfo |
executeSQLTableTransactional(List sqlTables,
Connection connection)
This method executes a serial of SQL actions(create,drop or alter) over a
database table in transactional mode.
|
String |
executeStatement(String statement,
Connection connection) |
String |
getCreateStatementAlterTableColumn(SQLTableAlterColumn table) |
String |
getCreateStatementAlterTableConstraint(SQLTableAlterConstraint table) |
protected String |
getDefinitionColumn(SQLColumn column,
boolean includePrimaryKey) |
protected String |
getStringDefaultValue(Object value,
SQLColumn column) |
String |
isMultiplePrimaryKey(SQLTableCreation table) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSQLTypeNamepublic static boolean DEBUG
protected static final String CREATE_TABLE
protected static final String DROP_TABLE
protected static final String ALTER_TABLE
protected static final String DEFAULT
protected static final String NOT_NULL
protected static final String ADD
protected static final String DROP
protected static final String COLUMN
public ISQLInfo executeSQLTable(List sqlTables, Connection connection)
SQLHandlercommit or the
method rollback. Moreover, Exceptions are also managed by
this method.
-connection.setAutoCommit(false);
...
...
-executeSQLTableTransactional
...
...
-connection.setAutoCommit(true);
executeSQLTable in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionpublic ISQLInfo executeSQLTableTransactional(List sqlTables, Connection connection) throws Exception
SQLHandlerexecuteSQLTableTransactional in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionExceptionpublic ISQLInfo createSQLTable(List sqlTables, Connection connection)
SQLHandlercommit or the method rollback. Moreover,
Exceptions are also managed by this method.
-connection.setAutoCommit(false);
...
...
-createSQLTableTransactional
...
...
-connection.setAutoCommit(true);
createSQLTable in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionpublic ISQLInfo dropSQLTable(List sqlTables, Connection connection)
SQLHandlercommit or the method rollback. Moreover,
Exceptions are also managed by this method.
-connection.setAutoCommit(false);
...
...
-dropSQLTableTransactional
...
...
-connection.setAutoCommit(true);
dropSQLTable in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionpublic ISQLInfo alterSQLTable(List sqlTables, Connection connection)
SQLHandlercommit or the method rollback. Moreover,
Exceptions are also managed by this method.
-connection.setAutoCommit(false);
...
...
-alterSQLTableTransactional
...
...
-connection.setAutoCommit(true);
alterSQLTable in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionpublic ISQLInfo createSQLTableTransactional(List sqlTables, Connection connection) throws Exception
SQLHandler
-execute sql to create all tables
createSQLTableTransactional in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionExceptionpublic ISQLInfo dropSQLTableTransactional(List sqlTables, Connection connection) throws Exception
SQLHandler
-execute sql to drop all tables
dropSQLTableTransactional in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionExceptionpublic ISQLInfo alterSQLTableTransactional(List sqlTables, Connection connection) throws Exception
SQLHandler
-execute sql to alter all tables
alterSQLTableTransactional in interface SQLHandlersqlTables - list with all sqlTablesconnection - the connectionExceptionprotected static void executeSQL(String sql, Connection con) throws Exception
sql - String which contains the SQL Statement.con - The connection.Exceptionpublic String createSQLTable(SQLTableCreation table, Connection connection) throws Exception
table - connection - Exceptionpublic String dropSQLTable(SQLTableDrop table, Connection connection) throws Exception
table - connection - Exceptionpublic String alterSQLTable(SQLTableAlter table, Connection connection) throws Exception
table - connection - Exceptionpublic String executeStatement(String statement, Connection connection) throws Exception
Exceptionpublic String createStatementCreateTable(SQLTableCreation table) throws Exception
SQLHandlercreateStatementCreateTable in interface SQLHandlertable - The SQLTableCreation table with whole information
to create it.String with the SQL statementExceptionprotected String getDefinitionColumn(SQLColumn column, boolean includePrimaryKey) throws Exception
Exceptionpublic String isMultiplePrimaryKey(SQLTableCreation table)
public String createStatementDropTable(SQLTableDrop table) throws Exception
SQLHandlercreateStatementDropTable in interface SQLHandlertable - The SQLTableDrop table with whole information to
drop it.String with the SQL statementExceptionpublic String createStatementAlterTable(SQLTableAlter table) throws Exception
SQLHandlercreateStatementAlterTable in interface SQLHandlertable - The SQLTableAlter table with whole information to
alter it.String with the SQL statementExceptionpublic String getCreateStatementAlterTableColumn(SQLTableAlterColumn table) throws Exception
Exceptionpublic String getCreateStatementAlterTableConstraint(SQLTableAlterConstraint table) throws Exception
ExceptionCopyright © 2016 Imatia Innovation S.L.. All rights reserved.