Package org.mariadb.jdbc

# Class FunctionStatement

java.lang.Object
org.mariadb.jdbc.Statement
org.mariadb.jdbc.BasePreparedStatement
org.mariadb.jdbc.ServerPreparedStatement
org.mariadb.jdbc.BaseCallableStatement
org.mariadb.jdbc.FunctionStatement

All Implemented Interfaces:
  `AutoCloseable`, `CallableStatement`, `PreparedStatement`, `Statement`, `Wrapper`

public class FunctionStatement extends BaseCallableStatement implements CallableStatement
Function callable statement implementation

## Field Summary

### Fields inherited from class org.mariadb.jdbc.BaseCallableStatement

`databaseName, outputParameters, parameterMetaData, procedureName`

### Fields inherited from class org.mariadb.jdbc.BasePreparedStatement

`batchParameters, canCachePrepStmts, parameters, prepareResult, sql`

### Fields inherited from class org.mariadb.jdbc.Statement

`autoGeneratedKeys, canUseServerMaxRows, canUseServerTimeout, clientParser, closed, closeOnCompletion, con, currResult, escape, fetchSize, lastSql, localInfileInputStream, lock, maxRows, queryTimeout, results, resultSetConcurrency, resultSetType`

### Fields inherited from interface java.sql.Statement

`CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO`

## Constructor Summary

Constructors
Constructor
Description
`FunctionStatement(Connection con, String databaseName, String procedureName, String arguments, ClosableLock lock, boolean canUseServerTimeout, boolean canUseServerMaxRows, boolean canCachePrepStmts, int resultSetType, int resultSetConcurrency)`
Constructor of function callable statement

## Method Summary

Modifier and Type
Method
Description
`protected void`
`executeInternal()`
Execute command with parameters
`protected void`
`handleParameterOutput()`
Handle output parameter result-set (only for CallableStatement)
`boolean`
`isFunction()`
Indicate if callable statement is a function or a stored procedure
`protected void`
`preValidParameters()`
Ensures that returning value is not taken as a parameter.
`void`
`registerOutParameter(int index, int sqlType)`
Registers the OUT parameter in ordinal position `parameterIndex` to the JDBC type `sqlType`.
`String`
`toString()`

### Methods inherited from class org.mariadb.jdbc.BaseCallableStatement

`checkOutputResult, clearParameters, getArray, getArray, getBigDecimal, getBigDecimal, getBigDecimal, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getDate, getDate, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getParameterMetaData, getRef, getRef, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getURL, getURL, outputResultFromRes, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setURL, wasNull`

### Methods inherited from class org.mariadb.jdbc.ServerPreparedStatement

`addBatch, close, execute, executeInternalPreparedBatch, executeLargeUpdate, executeQuery, executeUpdate, getMetaData, setLargeMaxRows, setMaxRows, setQueryTimeout, validParameters`

### Methods inherited from class org.mariadb.jdbc.BasePreparedStatement

`addBatch, clearBatch, execute, execute, execute, execute, executeBatch, executeBatchBulk, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getGeneratedKeys, getLastSql, getMeta, reset, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setParameter, setPrepareResult, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL, updateMeta`

### Methods inherited from class org.mariadb.jdbc.Statement

`abort, cancel, checkNotClosed, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, escapeTimeout, executeInternalBatchPipeline, executeInternalBatchStandard, fetchRemaining, getConnection, getFetchDirection, getFetchSize, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, parseCommandIfNeeded, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLocalInfileInputStream, setMaxFieldSize, setPoolable, unwrap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.sql.CallableStatement

`getArray, getArray, getBigDecimal, getBigDecimal, getBigDecimal, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getDate, getDate, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getURL, getURL, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setURL, wasNull`

### Methods inherited from interface java.sql.PreparedStatement

`addBatch, clearParameters, execute, executeLargeUpdate, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL`

### Methods inherited from interface java.sql.Statement

`addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout`

### Methods inherited from interface java.sql.Wrapper

`isWrapperFor, unwrap`

## Constructor Details

### FunctionStatement

public FunctionStatement(Connection con, String databaseName, String procedureName, String arguments, ClosableLock lock, boolean canUseServerTimeout, boolean canUseServerMaxRows, boolean canCachePrepStmts, int resultSetType, int resultSetConcurrency) throws SQLException
Constructor of function callable statement

Parameters:
  `con` - current connection
  `databaseName` - database
  `procedureName` - procedure
  `arguments` - arguments
  `lock` - thread lock object
  `canUseServerTimeout` - can use server timeout
  `canUseServerMaxRows` - can use server max rows
  `canCachePrepStmts` - can cache server prepared result
  `resultSetType` - result set type
  `resultSetConcurrency` - concurrency type
Throws:
  `SQLException` - if any error occurs

## Method Details

### isFunction

public boolean isFunction()
Description copied from class: `BaseCallableStatement`
Indicate if callable statement is a function or a stored procedure

Specified by:
  `isFunction` in class `BaseCallableStatement`
Returns:
  indicate if is a function

### handleParameterOutput

protected void handleParameterOutput() throws SQLException
Description copied from class: `ServerPreparedStatement`
Handle output parameter result-set (only for CallableStatement)

Overrides:
  `handleParameterOutput` in class `ServerPreparedStatement`
Throws:
  `SQLException` - if any error occurs

### registerOutParameter

public void registerOutParameter(int index, int sqlType) throws SQLException
Description copied from class: `BaseCallableStatement`
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 Java 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 `BaseCallableStatement.getObject(int)` retrieves the value.

Specified by:
  `registerOutParameter` in interface `CallableStatement`
Overrides:
  `registerOutParameter` in class `BaseCallableStatement`
Parameters:
  `index` - the first parameter is 1, the second is 2, and so on
  `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.
Throws:
  `SQLException` - if the parameterIndex is not valid; if a database access error occurs or this method is called on a closed `CallableStatement`
See Also:
  - `Types`

### executeInternal

protected void executeInternal() throws SQLException
Description copied from class: `ServerPreparedStatement`
Execute command with parameters

Overrides:
  `executeInternal` in class `ServerPreparedStatement`
Throws:
  `SQLException` - if any error occurs

### preValidParameters

protected void preValidParameters() throws SQLException
Ensures that returning value is not taken as a parameter.

Throws:
  `SQLException` - if any exception

### toString

public String toString()

Overrides:
  `toString` in class `ServerPreparedStatement`