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, isCommandInsert, parameters, prepareResult, sql
-
Fields inherited from class org.mariadb.jdbc.Statement
autoGeneratedKeys, canUseServerMaxRows, canUseServerTimeout, closed, closeOnCompletion, con, currResult, escape, fetchSize, 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, ReentrantLock lock, boolean canUseServerTimeout, boolean canUseServerMaxRows, boolean canCachePrepStmts, int resultSetType, int resultSetConcurrency)
Constructor of function callable statement
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
executeInternal()
Execute command with parametersprotected void
handleParameterOutput()
Handle output parameter result-set (only for CallableStatement)boolean
isFunction()
Indicate if callable statement is a function or a stored procedureprotected void
preValidParameters()
Ensures that returning value is not taken as a parameter.void
registerOutParameter(int index, int sqlType)
Registers the OUT parameter in ordinal positionparameterIndex
to the JDBC typesqlType
.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, executeBatch, executeLargeBatch, executeLargeUpdate, executeQuery, executeUpdate, getMetaData, reset, setLargeMaxRows, setMaxRows, setQueryTimeout, validParameters
-
Methods inherited from class org.mariadb.jdbc.BasePreparedStatement
addBatch, checkIfInsertCommand, execute, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getMeta, 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, setParameters, setPrepareResult, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL, updateMeta
-
Methods inherited from class org.mariadb.jdbc.Statement
abort, cancel, checkNotClosed, clearBatch, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, escapeTimeout, executeInternalBatchPipeline, executeInternalBatchStandard, fetchRemaining, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, isWrapperFor, 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 Detail
-
FunctionStatement
public FunctionStatement(Connection con, String databaseName, String procedureName, String arguments, ReentrantLock lock, boolean canUseServerTimeout, boolean canUseServerMaxRows, boolean canCachePrepStmts, int resultSetType, int resultSetConcurrency) throws SQLException
Constructor of function callable statement- Parameters:
con
- current connectiondatabaseName
- databaseprocedureName
- procedurearguments
- argumentslock
- thread lock objectcanUseServerTimeout
- can use server timeoutcanUseServerMaxRows
- can use server max rowscanCachePrepStmts
- can cache server prepared resultresultSetType
- result set typeresultSetConcurrency
- concurrency type- Throws:
SQLException
- if any error occurs
-
-
Method Detail
-
isFunction
public boolean isFunction()
Description copied from class:BaseCallableStatement
Indicate if callable statement is a function or a stored procedure- Specified by:
isFunction
in classBaseCallableStatement
- 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 classServerPreparedStatement
- 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 positionparameterIndex
to the JDBC typesqlType
. 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 theget
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 bejava.sql.Types.OTHER
. The methodBaseCallableStatement.getObject(int)
retrieves the value.- Specified by:
registerOutParameter
in interfaceCallableStatement
- Overrides:
registerOutParameter
in classBaseCallableStatement
- Parameters:
index
- the first parameter is 1, the second is 2, and so onsqlType
- the JDBC type code defined byjava.sql.Types
. If the parameter is of JDBC typeNUMERIC
orDECIMAL
, the version ofregisterOutParameter
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 closedCallableStatement
SQLFeatureNotSupportedException
- ifsqlType
is aARRAY
,BLOB
,CLOB
,DATALINK
,JAVA_OBJECT
,NCHAR
,NCLOB
,NVARCHAR
,LONGNVARCHAR
,REF
,ROWID
,SQLXML
orSTRUCT
data type and the JDBC driver does not support this data type- See Also:
Types
-
executeInternal
protected void executeInternal() throws SQLException
Description copied from class:ServerPreparedStatement
Execute command with parameters- Overrides:
executeInternal
in classServerPreparedStatement
- 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 classServerPreparedStatement
-
-