Module util

A module providing various RDBMS related utility functions

Functions


createSequence (conn, dialect, schemaName, sequenceName)

Creates a sequence

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)

Creates a table

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

Returns

Array The tables

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