All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ldbc.sql.CallableStatement.scala Maven / Gradle / Ivy

There is a newer version: 0.3.0-beta8
Show newest version
/**
 * 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.*

/**
 * The interface used to execute SQL stored procedures.  The JDBC API
 * provides a stored procedure SQL escape syntax that allows stored procedures
 * to be called in a standard way for all RDBMSs. This escape syntax has one
 * form that includes a result parameter and one that does not. If used, the result
 * parameter must be registered as an OUT parameter. The other parameters
 * can be used for input, output or both. Parameters are referred to
 * sequentially, by number, with the first parameter being 1.
 * 
 *   {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
 *   {call <procedure-name>[(<arg1>,<arg2>, ...)]}
 * 
*

* IN parameter values are set using the set methods inherited from * {@link PreparedStatement}. The type of all OUT parameters must be * registered prior to executing the stored procedure; their values * are retrieved after execution via the get methods provided here. *

* A CallableStatement can return one {@link ResultSet} object or * multiple ResultSet objects. Multiple * ResultSet objects are handled using operations * inherited from {@link Statement}. *

* For maximum portability, a call's ResultSet objects and * update counts should be processed prior to getting the values of output * parameters. * * @tparam F * the effect type */ trait CallableStatement[F[_]] extends PreparedStatement[F]: /** * Registers the OUT parameter in ordinal position * parameterIndex to the JDBC type * sqlType. All OUT parameters must be registered * before a stored procedure is executed. *

* The JDBC type specified by sqlType for an OUT * parameter determines the Scala type that must be used * in the get method to read the value of that parameter. *

* If the JDBC type expected to be returned to this output parameter * is specific to this particular database, sqlType * should be java.sql.Types.OTHER. The method * {@link #getObject} retrieves the value. * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @param sqlType the JDBC type code defined by java.sql.Types. * If the parameter is of JDBC type NUMERIC * or DECIMAL, the version of * registerOutParameter that accepts a scale value * should be used. */ def registerOutParameter(parameterIndex: Int, sqlType: Int): F[Unit] /** * Retrieves the value of the designated JDBC CHAR, * VARCHAR, or LONGVARCHAR parameter as a * String in the Sava programming language *

* For the fixed-length type JDBC CHAR, * the String object * returned has exactly the same value the SQL * CHAR value had in the * database, including any padding added by the database. * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, * the result * is None. */ def getString(parameterIndex: Int): F[Option[String]] /** * Retrieves the value of the designated JDBC BIT * or BOOLEAN parameter as a * Boolean in the Sava programming language * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, * the result is false. */ def getBoolean(parameterIndex: Int): F[Boolean] /** * Retrieves the value of the designated JDBC TINYINT parameter * as a byte in the Sava programming language * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getByte(parameterIndex: Int): F[Byte] /** * Retrieves the value of the designated JDBC SMALLINT parameter * as a short in the Sava programming language * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getShort(parameterIndex: Int): F[Short] /** * Retrieves the value of the designated JDBC INTEGER parameter * as an int in the Sava programming language * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getInt(parameterIndex: Int): F[Int] /** * Retrieves the value of the designated JDBC BIGINT parameter * as a long in the Sava programming language * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getLong(parameterIndex: Int): F[Long] /** * Retrieves the value of the designated JDBC FLOAT parameter * as a float in the Sava programming language * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getFloat(parameterIndex: Int): F[Float] /** * Retrieves the value of the designated JDBC DOUBLE parameter as a double * in the Sava programming language * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getDouble(parameterIndex: Int): F[Double] /** * Retrieves the value of the designated JDBC BINARY or * VARBINARY parameter as an array of byte * values in the Sava programming language * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is None. */ def getBytes(parameterIndex: Int): F[Option[Array[Byte]]] /** * Retrieves the value of the designated JDBC DATE parameter as a * java.time.LocalDate object. * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is None. */ def getDate(parameterIndex: Int): F[Option[LocalDate]] /** * Retrieves the value of the designated JDBC TIME parameter as a * java.time.LocalTime object. * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is null. */ def getTime(parameterIndex: Int): F[Option[LocalTime]] /** * Retrieves the value of the designated JDBC TIMESTAMP parameter as a * java.time.LocalDateTime object. * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL NULL, the result * is None. */ def getTimestamp(parameterIndex: Int): F[Option[LocalDateTime]] /** * Retrieves the value of the designated JDBC NUMERIC parameter as a * java.math.BigDecimal object with as many digits to the * right of the decimal point as the value contains. * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value in full precision. If the value is * SQL NULL, the result is None. */ def getBigDecimal(parameterIndex: Int): F[Option[BigDecimal]] /** * Retrieves the value of a JDBC CHAR, VARCHAR, * or LONGVARCHAR parameter as a String in * the Sava programming language *

* For the fixed-length type JDBC CHAR, * the String object * returned has exactly the same value the SQL * CHAR value had in the * database, including any padding added by the database. * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result * is None. */ def getString(parameterName: String): F[Option[String]] /** * Retrieves the value of a JDBC BIT or BOOLEAN * parameter as a * Boolean in the Sava programming language * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result * is false. */ def getBoolean(parameterName: String): F[Boolean] /** * Retrieves the value of a JDBC TINYINT parameter as a byte * in the Sava programming language * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getByte(parameterName: String): F[Byte] /** * Retrieves the value of a JDBC SMALLINT parameter as a short * in the Sava programming language * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result * is 0. */ def getShort(parameterName: String): F[Short] /** * Retrieves the value of a JDBC INTEGER parameter as an int * in the Sava programming language * * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, * the result is 0. */ def getInt(parameterName: String): F[Int] /** * Retrieves the value of a JDBC BIGINT parameter as a long * in the Sava programming language * * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, * the result is 0. */ def getLong(parameterName: String): F[Long] /** * Retrieves the value of a JDBC FLOAT parameter as a float * in the Sava programming language * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, * the result is 0. */ def getFloat(parameterName: String): F[Float] /** * Retrieves the value of a JDBC DOUBLE parameter as a double * in the Sava programming language * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, * the result is 0. */ def getDouble(parameterName: String): F[Double] /** * Retrieves the value of a JDBC BINARY or VARBINARY * parameter as an array of byte values in the Scala * programming language. * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result is * None. */ def getBytes(parameterName: String): F[Option[Array[Byte]]] /** * Retrieves the value of a JDBC DATE parameter as a * java.sql.Date object. * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result * is None. */ def getDate(parameterName: String): F[Option[LocalDate]] /** * Retrieves the value of a JDBC TIME parameter as a * java.sql.Time object. * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result * is null. */ def getTime(parameterName: String): F[Option[LocalTime]] /** * Retrieves the value of a JDBC TIMESTAMP parameter as a * java.sql.Timestamp object. * @param parameterName the name of the parameter * @return the parameter value. If the value is SQL NULL, the result * is None. */ def getTimestamp(parameterName: String): F[Option[LocalDateTime]] /** * Retrieves the value of a JDBC NUMERIC parameter as a * java.math.BigDecimal object with as many digits to the * right of the decimal point as the value contains. * @param parameterName the name of the parameter * @return the parameter value in full precision. If the value is * SQL NULL, the result is None. */ def getBigDecimal(parameterName: String): F[Option[BigDecimal]]





© 2015 - 2024 Weber Informatics LLC | Privacy Policy