Package cdc.rdb
Class RdbHelper
java.lang.Object
cdc.rdb.RdbHelper
Helper class for DB handling.
- Author:
- Damien Carbonne
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDeleteFromTableQuery(String schemaName, String tableName, List<String> whereColumnsNames) getInsertIntoTableQuery(String schemaName, String tableName, int columns) getInsertIntoTableQuery(String schemaName, String tableName, List<String> columnsNames) getOrderClause(List<RdbColumnSorting> sortings) getQueryTableName(String schemaName, String tableName) getSelectClause(String schemaName, String tableName) longgetTableSize(Connection connection, String schemaName, String tableName) getTableSizeQuery(String schemaName, String tableName) getUpdateTableQuery(String schemaName, String tableName, List<String> setColumnsNames, List<String> whereColumnsNames) static voidprint(ResultSet rs, PrintStream out) wrapIdentifier(String id)
-
Constructor Details
-
RdbHelper
- Throws:
SQLException
-
RdbHelper
- Throws:
SQLException
-
-
Method Details
-
getCatalogSeparator
- Returns:
- The catalog separator.
-
getIdentifierQuoteString
- Returns:
- The identifier quote string.
-
wrapIdentifier
- Parameters:
id- The naked identifier.- Returns:
idwrapped with identifier quote string.
-
getQueryTableName
- Parameters:
schemaName- The schema name.tableName- The table name.- Returns:
- The String designating the table identified by
schemaNameandtableName.
-
getSelectClause
- Parameters:
schemaName- The schema name.tableName- The table name.- Returns:
SELECT * FROM TTT
whereTTTis the table name.
-
getTableSizeQuery
- Parameters:
schemaName- The schema name.tableName- The table name.- Returns:
SELECT COUNT (*) FROM TTT
whereTTTis the table name.
-
getInsertIntoTableQuery
- Parameters:
schemaName- The schema name.tableName- The table name.columns- The number of columns.- Returns:
INSERT INTO TTT VALUES(?,?,...)
whereTTTis the table name.
-
getInsertIntoTableQuery
public String getInsertIntoTableQuery(String schemaName, String tableName, List<String> columnsNames) - Parameters:
schemaName- The schema name.tableName- The table name.columnsNames- The columns names.- Returns:
INSERT INTO TTT (N1, N2, ...) VALUES (?,?,...)
whereTTTis the table name
andNiis the i-th column name.
-
getDeleteFromTableQuery
-
getUpdateTableQuery
-
getTableSize
public long getTableSize(Connection connection, String schemaName, String tableName) throws SQLException - Parameters:
connection- The connection.schemaName- The schema name.tableName- The table name.- Returns:
- The size of the table designated by
schemaNameandtableName. - Throws:
SQLException- When an SQL error occurs.
-
getOrderClause
- Parameters:
sortings- The columns sortings.- Returns:
- A String defining an order clause based on
sortings.
-
print
-