Package org.mariadb.jdbc
Class MariaDbProcedureStatement
java.lang.Object
org.mariadb.jdbc.MariaDbStatement
org.mariadb.jdbc.BasePrepareStatement
org.mariadb.jdbc.ServerSidePreparedStatement
org.mariadb.jdbc.CallableProcedureStatement
org.mariadb.jdbc.MariaDbProcedureStatement
- All Implemented Interfaces:
AutoCloseable
,Cloneable
,CallableStatement
,PreparedStatement
,Statement
,Wrapper
,CloneableCallableStatement
public class MariaDbProcedureStatement
extends CallableProcedureStatement
implements CloneableCallableStatement
-
Field Summary
FieldsFields inherited from class org.mariadb.jdbc.CallableProcedureStatement
hasInOutParameters, outputParameterMapper, parameterMetadata, params
Fields inherited from class org.mariadb.jdbc.ServerSidePreparedStatement
parameterCount
Fields inherited from class org.mariadb.jdbc.BasePrepareStatement
autoGeneratedKeys, hasLongData, SPEC_ISO_ZONED_DATE_TIME
Fields inherited from class org.mariadb.jdbc.MariaDbStatement
canUseServerTimeout, closed, connection, executing, fetchSize, lock, maxRows, options, protocol, queryTimeout, results, resultSetConcurrency, resultSetScrollType
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
ConstructorsConstructorDescriptionMariaDbProcedureStatement
(String query, MariaDbConnection connection, String procedureName, String database, int resultSetType, int resultSetConcurrency) Specific implementation of CallableStatement to handle function call, represent by call like {?= call procedure-name[(arg1,arg2, ...)]}. -
Method Summary
Modifier and TypeMethodDescriptionclone
(MariaDbConnection connection) Clone statement.boolean
execute()
int[]
Submits a batch of send to the database for execution and if all send execute successfully, returns an array of update counts.protected SelectResultSet
private void
private void
void
setParameter
(int parameterIndex, ParameterHolder holder) private void
private void
Valid that all parameters are set.Methods inherited from class org.mariadb.jdbc.CallableProcedureStatement
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, registerOutParameter, 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, setParametersVariables, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setURL, wasNull
Methods inherited from class org.mariadb.jdbc.ServerSidePreparedStatement
addBatch, addBatch, clearBatch, clearParameters, close, executeInternal, executeLargeBatch, executeQuery, executeUpdate, getMetaData, getParameterCount, getServerThreadId, toString, validParameters
Methods inherited from class org.mariadb.jdbc.BasePrepareStatement
executeLargeUpdate, 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, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
Methods inherited from class org.mariadb.jdbc.MariaDbStatement
cancel, checkClose, checkCloseOnCompletion, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatchEpilogue, executeBatchExceptionEpilogue, executeEpilogue, executeExceptionEpilogue, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeQueryPrologue, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, setTimerTask, skipMoreResults, testExecute, 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, 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, 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, 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
-
Field Details
-
outputResultSet
-
-
Constructor Details
-
MariaDbProcedureStatement
public MariaDbProcedureStatement(String query, MariaDbConnection connection, String procedureName, String database, int resultSetType, int resultSetConcurrency) throws SQLException Specific implementation of CallableStatement to handle function call, represent by call like {?= call procedure-name[(arg1,arg2, ...)]}.- Parameters:
query
- queryconnection
- current connectionprocedureName
- procedure namedatabase
- databaseresultSetType
- a result set type; one ofResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency
- a concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
- Throws:
SQLException
- exception
-
-
Method Details
-
setParamsAccordingToSetArguments
private void setParamsAccordingToSetArguments() -
setInputOutputParameterMap
private void setInputOutputParameterMap() -
getOutputResult
- Specified by:
getOutputResult
in classCallableProcedureStatement
- Throws:
SQLException
-
clone
public MariaDbProcedureStatement clone(MariaDbConnection connection) throws CloneNotSupportedException Clone statement.- Specified by:
clone
in interfaceCloneableCallableStatement
- Overrides:
clone
in classCallableProcedureStatement
- Parameters:
connection
- connection- Returns:
- Clone statement.
- Throws:
CloneNotSupportedException
- if any error occur.
-
retrieveOutputResult
- Throws:
SQLException
-
setParameter
- Overrides:
setParameter
in classServerSidePreparedStatement
- Throws:
SQLException
-
execute
- Specified by:
execute
in interfacePreparedStatement
- Overrides:
execute
in classServerSidePreparedStatement
- Throws:
SQLException
-
validAllParameters
Valid that all parameters are set.- Throws:
SQLException
- if set parameters is not right
-
executeBatch
Description copied from class:ServerSidePreparedStatement
Submits a batch of send to the database for execution and if all send execute successfully, returns an array of update counts. The
int
elements of the array that is returned are ordered to correspond to the send in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the methodexecuteBatch
may be one of the following:- A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
- A value of
SUCCESS_NO_INFO
-- indicates that the command was processed successfully but that the number of rows affected is unknown. If one of the send in a batch update fails to execute properly, this method throws aBatchUpdateException
, and a JDBC driver may or may not continue to process the remaining send in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process send or never continuing to process send. If the driver continues processing after a failure, the array returned by the methodBatchUpdateException.getUpdateCounts
will contain as many elements as there are send in the batch, and at least one of the elements will be the following: - A value of
EXECUTE_FAILED
-- indicates that the command failed to execute successfully and occurs only if a driver continues to process send after a command fails
The possible implementations and return values have been modified in the Java 2 SDK, Standard Edition, version 1.3 to accommodate the option of continuing to proccess send in a batch update after a
BatchUpdateException
object has been thrown.- Specified by:
executeBatch
in interfaceStatement
- Overrides:
executeBatch
in classServerSidePreparedStatement
- Returns:
- an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which send were added to the batch.
- Throws:
SQLException
- if a database access error occurs, this method is called on a closedStatement
or the driver does not support batch statements. ThrowsBatchUpdateException
(a subclass ofSQLException
) if one of the send sent to the database fails to execute properly or attempts to return a result set.- See Also:
-