ldbc.sql.ResultSet.scala Maven / Gradle / Ivy
Show all versions of ldbc-sql_3 Show documentation
/**
* Copyright (c) 2023-2024 by Takahiko Tominaga
* This software is licensed under the MIT License (MIT).
* For more information see LICENSE or https://opensource.org/licenses/MIT
*/
package ldbc.sql
import java.time.*
/**
* A table of data representing a database result set, which is usually generated by executing a statement that queries the database.
*
* @tparam F
* The effect type
*/
trait ResultSet[F[_]]:
/**
* Moves the cursor forward one row from its current position.
* A ResultSet
cursor is initially positioned
* before the first row; the first call to the method
* next
makes the first row the current row; the
* second call makes the second row the current row, and so on.
*
* When a call to the next
method returns false
,
* the cursor is positioned after the last row. Any
* invocation of a ResultSet
method which requires a
* current row will result in a SQLException
being thrown.
* If the result set type is TYPE_FORWARD_ONLY
, it is vendor specified
* whether their JDBC driver implementation will return false
or
* throw an SQLException
on a
* subsequent call to next
.
*
*
If an input stream is open for the current row, a call
* to the method next
will
* implicitly close it. A ResultSet
object's
* warning chain is cleared when a new row is read.
*
* @return true
if the new current row is valid;
* false
if there are no more rows
*/
def next(): F[Boolean]
/**
* Releases this ResultSet
object's database and
* LDBC resources immediately instead of waiting for
* this to happen when it is automatically closed.
*
*
The closing of a ResultSet
object does not close the Blob
,
* Clob
or NClob
objects created by the ResultSet
. Blob
,
* Clob
or NClob
objects remain valid for at least the duration of the
* transaction in which they are created, unless their free
method is invoked.
*
* When a ResultSet
is closed, any ResultSetMetaData
* instances that were created by calling the getMetaData
* method remain accessible.
*
*
Note: A ResultSet
object
* is automatically closed by the
* Statement
object that generated it when
* that Statement
object is closed,
* re-executed, or is used to retrieve the next result from a
* sequence of multiple results.
*
* Calling the method close
on a ResultSet
* object that is already closed is a no-op.
*/
def close(): F[Unit]
/**
* Reports whether
* the last column read had a value of SQL NULL
.
* Note that you must first call one of the getter methods
* on a column to try to read its value and then call
* the method wasNull
to see if the value read was
* SQL NULL
.
*
* @return true
if the last column value read was SQL
* NULL
and false
otherwise
*/
def wasNull(): F[Boolean]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a String
in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getString(columnIndex: Int): F[String]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Boolean
in the Scala programming language.
*
*
If the designated column has a datatype of CHAR or VARCHAR
* and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT
* and contains a 0, a value of false
is returned. If the designated column has a datatype
* of CHAR or VARCHAR
* and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT
* and contains a 1, a value of true
is returned.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is false
*/
def getBoolean(columnIndex: Int): F[Boolean]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Byte
in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getByte(columnIndex: Int): F[Byte]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Short
in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getShort(columnIndex: Int): F[Short]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* an Int
in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getInt(columnIndex: Int): F[Int]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Long
in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getLong(columnIndex: Int): F[Long]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Float
in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getFloat(columnIndex: Int): F[Float]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Double
in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getDouble(columnIndex: Int): F[Double]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Byte
array in the Scala programming language.
* The bytes represent the raw values returned by the driver.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getBytes(columnIndex: Int): F[Array[Byte]]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a java.time.LocalDate
object in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getDate(columnIndex: Int): F[LocalDate]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a java.time.LocalTime
object in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getTime(columnIndex: Int): F[LocalTime]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a java.time.LocalDateTime
object in the Scala programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getTimestamp(columnIndex: Int): F[LocalDateTime]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a String
in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getString(columnLabel: String): F[String]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Boolean
in the Scala programming language.
*
*
If the designated column has a datatype of CHAR or VARCHAR
* and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT
* and contains a 0, a value of false
is returned. If the designated column has a datatype
* of CHAR or VARCHAR
* and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT
* and contains a 1, a value of true
is returned.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is false
*/
def getBoolean(columnLabel: String): F[Boolean]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Byte
in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getByte(columnLabel: String): F[Byte]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Short
in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getShort(columnLabel: String): F[Short]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* an Int
in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getInt(columnLabel: String): F[Int]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Long
in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getLong(columnLabel: String): F[Long]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Float
in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getFloat(columnLabel: String): F[Float]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a Double
in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is 0
*/
def getDouble(columnLabel: String): F[Double]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a byte
array in the Scala programming language.
* The bytes represent the raw values returned by the driver.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getBytes(columnLabel: String): F[Array[Byte]]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a java.time.LocalDate
object in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getDate(columnLabel: String): F[LocalDate]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a java.time.LocalTime
object in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value;
* if the value is SQL NULL
,
* the value returned is null
*/
def getTime(columnLabel: String): F[LocalTime]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as
* a java.time.LocalDateTime
object in the Scala programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL NULL
, the
* value returned is null
*/
def getTimestamp(columnLabel: String): F[LocalDateTime]
/**
* Retrieves the number, types and properties of
* this ResultSet
object's columns.
*
* @return the description of this ResultSet
object's columns
*/
def getMetaData(): F[ResultSetMetaData]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as a
* scala.math.BigDecimal
with full precision.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value (full precision);
* if the value is SQL null
, the value returned is
* None
in the Scala programming language.
*/
def getBigDecimal(columnIndex: Int): F[BigDecimal]
/**
* Retrieves the value of the designated column in the current row
* of this ResultSet
object as a
* scala.math.BigDecimal
with full precision.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value (full precision);
* if the value is SQL NULL
, the value returned is
* null
in the Scala programming language.
*/
def getBigDecimal(columnLabel: String): F[BigDecimal]
/**
* Retrieves whether the cursor is before the first row in
* this ResultSet
object.
*
* Note:Support for the isBeforeFirst
method
* is optional for ResultSet
s with a result
* set type of TYPE_FORWARD_ONLY
*
* @return true
if the cursor is before the first row;
* false
if the cursor is at any other position or the
* result set contains no rows
*/
def isBeforeFirst(): F[Boolean]
/**
* Retrieves whether the cursor is on the first row of
* this ResultSet
object.
*
* Note:Support for the isFirst
method
* is optional for ResultSet
s with a result
* set type of TYPE_FORWARD_ONLY
*
* @return true
if the cursor is on the first row;
* false
otherwise
*/
def isFirst(): F[Boolean]
/**
* Retrieves whether the cursor is after the last row in
* this ResultSet
object.
*
* Note:Support for the isAfterLast
method
* is optional for ResultSet
s with a result
* set type of TYPE_FORWARD_ONLY
*
* @return true
if the cursor is after the last row;
* false
if the cursor is at any other position or the
* result set contains no rows
*/
def isAfterLast(): F[Boolean]
/**
* Retrieves whether the cursor is on the last row of
* this ResultSet
object.
* Note: Calling the method isLast
may be expensive
* because the LDBC
* might need to fetch ahead one row in order to determine
* whether the current row is the last row in the result set.
*
* Note: Support for the isLast
method
* is optional for ResultSet
s with a result
* set type of TYPE_FORWARD_ONLY
*
* @return true
if the cursor is on the last row;
* false
otherwise
*/
def isLast(): F[Boolean]
/**
* Moves the cursor to the front of
* this ResultSet
object, just before the
* first row. This method has no effect if the result set contains no rows.
*/
def beforeFirst(): F[Unit]
/**
* Moves the cursor to the end of
* this ResultSet
object, just after the
* last row. This method has no effect if the result set contains no rows.
*/
def afterLast(): F[Unit]
/**
* Moves the cursor to the first row in
* this ResultSet
object.
*
* @return true
if the cursor is on a valid row;
* false
if there are no rows in the result set
*/
def first(): F[Boolean]
/**
* Moves the cursor to the last row in
* this ResultSet
object.
*
* @return true
if the cursor is on a valid row;
* false
if there are no rows in the result set
*/
def last(): F[Boolean]
/**
* Retrieves the current row number. The first row is number 1, the
* second number 2, and so on.
*
* Note:Support for the getRow
method
* is optional for ResultSet
s with a result
* set type of TYPE_FORWARD_ONLY
*
* @return the current row number; 0
if there is no current row
*/
def getRow(): F[Int]
/**
* Moves the cursor to the given row number in
* this ResultSet
object.
*
*
If the row number is positive, the cursor moves to
* the given row number with respect to the
* beginning of the result set. The first row is row 1, the second
* is row 2, and so on.
*
*
If the given row number is negative, the cursor moves to
* an absolute row position with respect to
* the end of the result set. For example, calling the method
* absolute(-1)
positions the
* cursor on the last row; calling the method absolute(-2)
* moves the cursor to the next-to-last row, and so on.
*
*
If the row number specified is zero, the cursor is moved to
* before the first row.
*
*
An attempt to position the cursor beyond the first/last row in
* the result set leaves the cursor before the first row or after
* the last row.
*
*
Note: Calling absolute(1)
is the same
* as calling first()
. Calling absolute(-1)
* is the same as calling last()
.
*
* @param row the number of the row to which the cursor should move.
* A value of zero indicates that the cursor will be positioned
* before the first row; a positive number indicates the row number
* counting from the beginning of the result set; a negative number
* indicates the row number counting from the end of the result set
* @return true
if the cursor is moved to a position in this
*/
def absolute(row: Int): F[Boolean]
/**
* Moves the cursor a relative number of rows, either positive or negative.
* Attempting to move beyond the first/last row in the
* result set positions the cursor before/after the
* the first/last row. Calling relative(0)
is valid, but does
* not change the cursor position.
*
*
Note: Calling the method relative(1)
* is identical to calling the method next()
and
* calling the method relative(-1)
is identical
* to calling the method previous()
.
*
* @param rows an int
specifying the number of rows to
* move from the current row; a positive number moves the cursor
* forward; a negative number moves the cursor backward
* @return true
if the cursor is on a row;
* false
otherwise
*/
def relative(rows: Int): F[Boolean]
/**
* Moves the cursor to the previous row in this
* ResultSet
object.
*
* When a call to the previous
method returns false
,
* the cursor is positioned before the first row. Any invocation of a
* ResultSet
method which requires a current row will result in a
* SQLException
being thrown.
*
*
* @return true
if the cursor is now positioned on a valid row;
* false
if the cursor is positioned before the first row
*/
def previous(): F[Boolean]
/**
* Retrieves the type of this ResultSet
object.
* The type is determined by the Statement
object
* that created the result set.
*
* @return ResultSet.TYPE_FORWARD_ONLY
,
* ResultSet.TYPE_SCROLL_INSENSITIVE
,
* or ResultSet.TYPE_SCROLL_SENSITIVE
*/
def getType(): F[Int]
/**
* Retrieves the concurrency mode of this ResultSet
object.
* The concurrency used is determined by the
* Statement
object that created the result set.
*
* @return the concurrency type, either
* ResultSet.CONCUR_READ_ONLY
* or ResultSet.CONCUR_UPDATABLE
*/
def getConcurrency(): F[Int]
object ResultSet:
/**
* The constant indicating the type for a ResultSet
object
* whose cursor may move only forward.
*/
val TYPE_FORWARD_ONLY: Int = 1003
/**
* The constant indicating the type for a ResultSet
object
* that is scrollable but generally not sensitive to changes to the data
* that underlies the ResultSet
.
*/
val TYPE_SCROLL_INSENSITIVE: Int = 1004
/**
* The constant indicating the type for a ResultSet
object
* that is scrollable and generally sensitive to changes to the data
* that underlies the ResultSet
.
*/
val TYPE_SCROLL_SENSITIVE: Int = 1005
/**
* The constant indicating the concurrency mode for a
* ResultSet
object that may NOT be updated.
*/
val CONCUR_READ_ONLY: Int = 1007
/**
* The constant indicating the concurrency mode for a
* ResultSet
object that may be updated.
*/
val CONCUR_UPDATABLE: Int = 1008
/**
* The constant indicating that open ResultSet
objects with this
* holdability will remain open when the current transaction is committed.
*/
val HOLD_CURSORS_OVER_COMMIT: Int = 1
/**
* The constant indicating that open ResultSet
objects with this
* holdability will be closed when the current transaction is committed.
*/
val CLOSE_CURSORS_AT_COMMIT: Int = 2