PreparedStatement
interfacein packageklyn.databases.sql
public interface PreparedStatement extends Statement:
└ PreparedStatement
Prepared SQL statement contract inspired by `java.sql.PreparedStatement`. The Klyn adaptation uses `bind(...)` helpers instead of a large family of setter methods.
import klyn.databases.sql

prepared = connection.prepared("select * from users where id = ?")
prepared.bindInt(1, 42)
Properties
Modifier and Type Member Description
public readonly property parameterInfo
parameterInfo as ParameterMetaData
Parameter metadata exposed as a property.
public readonly property parameters
parameters as Map<Int, Object>
Current bound parameters.
public readonly property sql
sql as String
Prepared SQL text.
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 bind
bind(index as Int, value as Object) as PreparedStatement throws SQLException
Binds one parameter value.
public bindBoolean
bindBoolean(index as Int, value as Boolean) as PreparedStatement throws SQLException
Binds a boolean parameter.
public bindDouble
bindDouble(index as Int, value as Double) as PreparedStatement throws SQLException
Binds a `Double` parameter.
public bindInt
bindInt(index as Int, value as Int) as PreparedStatement throws SQLException
Binds an `Int` parameter.
public bindLong
bindLong(index as Int, value as Long) as PreparedStatement throws SQLException
Binds a `Long` parameter.
public bindNull
bindNull(index as Int, sqlType as Int = Types.NULL) as PreparedStatement throws SQLException
Binds SQL `NULL`.
public bindString
bindString(index as Int, value as String) as PreparedStatement throws SQLException
Binds a `String` parameter.
public clearParameters
clearParameters() as Void
Clears every bound parameter.
public execute
execute() as Boolean throws SQLException
Executes the prepared statement.
public query
query() as ResultSet throws SQLException
Executes the prepared query.
public update
update() as Long throws SQLException
Executes the prepared update.
Methods inherited from Statement: addBatch, clearBatch, clearWarnings, execute, executeBatch, executeQuery, executeUpdate, query, update
Methods inherited from AutoClosable: close