OdbcPreparedStatement
classin packageklyn.databases.sql.odbc
public class OdbcPreparedStatement extends OdbcStatementBase implements PreparedStatement:
OdbcPreparedStatement
All Implemented Interfaces: PreparedStatement

ODBC prepared statement.

Parameters are bound through the native ODBC API. Klyn basic values are sent as textual SQL parameters so the target ODBC driver performs the final type conversion.

import klyn.databases.sql

# prepared = connection.prepared("select * from users where id = ?")
# prepared.setInt(1, 42)
# rows = prepared.query()
Properties
Modifier and Type Member Description
public readonly property parameterInfo
parameterInfo as ParameterMetaData:
Parameter metadata.
public readonly property parameterMetadata
parameterMetadata as ParameterMetaData:
Parameter metadata alias.
public readonly property parameters
parameters as Map<Int, Object>:
Current bound parameter values.
public readonly property sql
sql as String:
Prepared SQL text.
Properties inherited from PreparedStatement: parameterInfo, parameterMetadata, parameters, sql
Properties inherited from Statement: batchSize, closeOnCompletion, closed, concurrency, connection, cursorName, escapeProcessing, fetchDirection, fetchSize, generatedKeys, holdability, largeMaxRows, maxFieldSize, maxRows, poolable, queryTimeoutSeconds, resultSetType, warning
Methods
Modifier and Type Member Description
public clearParameters
clearParameters() as Void:
Clears every bound parameter.
public execute
execute() as Boolean throws SQLException:
Executes the prepared statement.
public execute
execute(sql as String) as Boolean throws SQLException:
Executes arbitrary SQL through the underlying statement API.
public executeQuery
executeQuery(sql as String) as ResultSet throws SQLException:
Executes arbitrary query SQL through the underlying statement API.
public executeUpdate
executeUpdate(sql as String) as Int throws SQLException:
Executes arbitrary update SQL through the underlying statement API.
public query
query() as ResultSet throws SQLException:
Executes the prepared query.
public set
set(index as Int, value as Object) as PreparedStatement throws SQLException:
Sets one parameter value.
public setBoolean
setBoolean(index as Int, value as Boolean) as PreparedStatement throws SQLException:
Sets one boolean parameter.
public setDouble
setDouble(index as Int, value as Double) as PreparedStatement throws SQLException:
Sets one `Double` parameter.
public setInt
setInt(index as Int, value as Int) as PreparedStatement throws SQLException:
Sets one `Int` parameter.
public setLong
setLong(index as Int, value as Long) as PreparedStatement throws SQLException:
Sets one `Long` parameter.
public setNull
setNull(index as Int, sqlType as Int = Types.NULL) as PreparedStatement throws SQLException:
Sets one parameter to SQL NULL.
public setString
setString(index as Int, value as String) as PreparedStatement throws SQLException:
Sets one text parameter.
public update
update() as Long throws SQLException:
Executes the prepared update.
Methods inherited from PreparedStatement: clearParameters, execute, query, set, setBoolean, setDouble, setInt, setLong, setNull, setString, update
Methods inherited from Statement: addBatch, clearBatch, clearWarnings, execute, executeBatch, executeQuery, executeUpdate, getResultSet
Methods inherited from AutoClosable: close