Module util
A module providing various RDBMS related utility functions
Functions
-
createSequence(conn, dialect, schemaName, sequenceName)
-
createTable(store, tableName, columns, primaryKey, engineType)
-
dropSequence(conn, sequenceName, schemaName)
-
dropTable(conn, tableName, schemaName)
-
getColumns(dbMetaData, tablePattern, schemaPattern, columnPattern)
-
getPrimaryKeys(dbMetaData, tableName, schemaName)
-
getTables(conn, schemaName, tableName)
-
tableExists(conn, tableName, schemaName)
createSequence
(conn, dialect, schemaName, sequenceName)
Parameters
java.sql.Connection |
conn |
The connection to use |
Dialect |
dialect |
The dialect to use |
String |
schemaName |
Optional schema name |
String |
sequenceName |
The name of the sequence to create |
createTable
(store, tableName, columns, primaryKey, engineType)
Parameters
Store |
store |
The store to create the table for |
String |
tableName |
The name of the table to create |
Array |
columns |
An array containing column definitions |
Array |
primaryKey |
An array containing the primary key columns |
String |
engineType |
Optional engine type, solely for mysql databases |
dropSequence
(conn, sequenceName, schemaName)
Drops the sequence with the given name
Parameters
java.sql.Connection |
conn |
The connection to use |
String |
sequenceName |
The name of the sequence to drop |
String |
schemaName |
Optional schema name |
dropTable
(conn, tableName, schemaName)
Drops the table with the given name
Parameters
java.sql.Connection |
conn |
The connection to use |
String |
tableName |
The name of the table |
String |
schemaName |
Optional schema name |
getColumns
(dbMetaData, tablePattern, schemaPattern, columnPattern)
Returns the columns of a given table
Parameters
java.sql.DatabaseMetadata |
dbMetaData |
The database metadata |
String |
tablePattern |
Optional table name pattern (defaults to "%") |
String |
schemaPattern |
Optional schema name pattern (defaults to "%") |
String |
columnPattern |
Optional column name pattern (defaults to "%") |
Returns
Array |
An array containing the column metadata |
getPrimaryKeys
(dbMetaData, tableName, schemaName)
Returns the primary keys of a given table
Parameters
java.sql.DatabaseMetadata |
dbMetaData |
The database metadata |
String |
tableName |
The name of the table |
String |
schemaName |
Optional schema name |
Returns
Array |
An array containing the table's primary keys |
getTables
(conn, schemaName, tableName)
Returns the tables for the connection passed as argument
Parameters
java.sql.Connection |
conn |
The connection to use |
String |
schemaName |
Optional schema name |
String |
tableName |
Optional table name |
tableExists
(conn, tableName, schemaName)
Returns true if the database has a table with the given name
Parameters
java.sql.Connection |
conn |
The connection to use |
String |
tableName |
The name of the table |
String |
schemaName |
Optional schema name |
Returns
Boolean |
True if the table exists, false otherwise |