Companion

object Companion

Types

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val logger: KLogger
Link copied to clipboard

Functions

Link copied to clipboard
fun addBatch(rowData: Array<Any?>, numColumns: Int, preparedStatement: PreparedStatement): Boolean
fun addBatch(rowData: List<Any?>, numColumns: Int, preparedStatement: PreparedStatement): Boolean

This method inserts the data into the prepared statement as a batch insert. The statement is not executed.

Link copied to clipboard

The result set must be open and remains open after this call.

Link copied to clipboard
fun columnNames(resultSet: ResultSet): List<String>

The result set must be open and remains open after this call.

Link copied to clipboard
fun containsSchema(connection: Connection, schemaName: String): Boolean

The name of the schema is first checked for an exact lexicographical match. If a match occurs, the schema is returned. If a lexicographical match fails, then a check for a match ignoring the case of the string is performed. This is done because SQL identifier names should be case-insensitive. If neither matches then false is returned.

Link copied to clipboard
fun containsTable(connection: Connection, tableName: String, schemaName: String?): Boolean

Checks if the named table is within the schema based on the connection.

Link copied to clipboard
fun containsView(connection: Connection, viewName: String, schemaName: String?): Boolean

Checks if the named view is within the schema based on the connection.

Link copied to clipboard

Populates a CachedRowSet based on the supplied ResultSet

Link copied to clipboard

Returns the user-defined schema names and the table names within each schema, The key can be null because the database might not support the schema concept. There can be table names associated with the key "null".

Link copied to clipboard

The connection should be open and is not closed during this function. It is the caller's responsibility to close the connection when appropriate. Retrieves the table and schema information from the database meta-data.

Link copied to clipboard

Returns the user-defined schema names and the view names within each schema, The key can be null because the database might not support the schema concept. There can be view names associated with the key "null".

Link copied to clipboard

The connection should be open and is not closed during this function. It is the caller's responsibility to close the connection when appropriate. Retrieves the view information from the database meta-data.

Link copied to clipboard
fun deleteAllFromTableSQL(tableName: String, schemaName: String?): String

Returns a string SQL to be used to delete all records from a table

Link copied to clipboard
fun deleteFromTableWhereSQL(tableName: String, fieldName: String, schemaName: String?): String

Returns a string to be used in a prepared statement delete from schemaName.tableName where fieldName = ?

Link copied to clipboard
fun executeCommand(connection: Connection, command: String): Boolean

Executes the SQL provided in the string. Squelches exceptions The string must not have ";" semicolon at the end. The caller is responsible for closing the connection

Link copied to clipboard
fun executeCommands(connection: Connection, commands: List<String>): Boolean

Consecutively executes the list of SQL queries supplied as a list of strings The strings must not have ";" semicolon at the end. The caller is responsible for closing the connection

Link copied to clipboard
fun exportAsWorkSheet(resultSet: ResultSet, sheet: Sheet, writeHeader: Boolean = true)

Exports the data in the ResultSet to an Excel worksheet. The ResultSet is assumed to be forward only and each row is processed until all rows are exported. The ResultSet is closed after the processing.

Link copied to clipboard

A simple wrapper to ease the use of JDBC for novices. Returns the results of a query in the form of a JDBC CachedRowSet. Errors in the SQL are the user's responsibility. Any exceptions are logged and squashed. The underlying query is closed.

Link copied to clipboard

A simple wrapper to ease the use of JDBC for novices. Returns the results of a query in the form of a JDBC ResultSet that is TYPE_FORWARD_ONLY and CONCUR_READ_ONLY . Errors in the SQL are the user's responsibility. Any exceptions are logged and squashed. It is the user's responsibility to close the ResultSet. That is, the statement used to create the ResultSet is not automatically closed.

Link copied to clipboard
fun fillFromColumn(column: Int, cachedRowSet: CachedRowSet): List<Any?>

Fills a list with the indicated column of the CachedRowSet

Link copied to clipboard
fun insertIntoTableStatementSQL(tableName: String, numColumns: Int, schemaName: String? = null): String
fun insertIntoTableStatementSQL(tableName: String, fields: List<String>, schemaName: String? = null): String

Creates an SQL string that can be used to insert data into the table

Link copied to clipboard

Writes SQLWarnings to log file

Link copied to clipboard
fun makeDeleteFromPreparedStatement(con: Connection, tableName: String, fieldName: String, schemaName: String?): PreparedStatement

Uses the longLastingConnection property for the connection for metadata checking.

Link copied to clipboard
fun makeInsertPreparedStatement(con: Connection, tableName: String, numColumns: Int, schemaName: String?): PreparedStatement
Link copied to clipboard
fun numRows(connection: Connection, tableName: String, schemaName: String?): Long

Determines the number of rows in the table within the schema based on the supplied connection.

Link copied to clipboard

Takes the input string and builds a string to represent the command from the string.

Link copied to clipboard

Takes the input string and builds a string to represent the SQL command from the string. Uses EmbeddedDerbyDatabase.DEFAULT_DELIMITER as the delimiter, i.e. ";" Checks for "--", "//" and "#" as start of line comments

fun parseLine(line: String, delimiter: String, command: StringBuilder): DatabaseIfc.LineOption

Takes the input string and builds a string to represent the SQL command from the string. Checks for "--", "//" and "#" as start of line comments

Link copied to clipboard

Method to parse a SQL script for the database. The script honors SQL comments and separates each SQL command into a list of strings, 1 string for each command. The list of queries is returned.

Link copied to clipboard

Parses the supplied string and breaks it up into a list of strings The string needs to honor SQL comments and separates each SQL command into a list of strings, 1 string for each command. The list of queries is returned.

Link copied to clipboard
fun schemaNames(connection: Connection): List<String>

Retrieves the names of the schemas from the database meta-data. The connection should be open and is not closed during this function.

Link copied to clipboard
fun tableNames(connection: Connection, schemaName: String?): List<String>

Returns a list of table names associated with the schema based on the supplied connection.

Link copied to clipboard
fun toDataFrame(resultSet: ResultSet): AnyFrame
Link copied to clipboard
fun updateTableStatementSQL(tableName: String, updateFields: List<String>, whereFields: List<String>, schemaName: String?): String

Creates an SQL string for a prepared statement to update records in a table. The update and where field lists should have unique elements and at least 1 element.

Link copied to clipboard
fun viewNames(connection: Connection, schemaName: String?): List<String>

Returns a list of views associated with the schema based on the supplied connection.

Link copied to clipboard
fun writeAsCSV(resultSet: ResultSet, header: Boolean = true, writer: Writer)

The ResultSet is processed through all rows.

Link copied to clipboard
Link copied to clipboard
fun writeAsText(rowSet: CachedRowSet, writer: PrintWriter)