Class NamedPreparedStatement
java.lang.Object
org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement
- All Implemented Interfaces:
AutoCloseable,PreparedStatement,Statement,Wrapper
Prepared statement with named indexes.
-
Field Summary
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
ConstructorsConstructorDescriptionNamedPreparedStatement(Connection connection, String sqlQuery) Create a named prepared statement.NamedPreparedStatement(Connection connection, String sqlQuery, String returningColumnName) Create a named prepared statement with a specified column value to be returned.NamedPreparedStatement(Connection connection, String sqlQuery, Map<String, Integer> repetition) Create a named prepared statement with repeated indexes.NamedPreparedStatement(Connection connection, String sqlQuery, Map<String, Integer> repetition, String returningColumnName) Create a named prepared statement with repeated indexes and a specified column value to be returned. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()voidvoidcancel()voidvoidvoidvoidclose()voidbooleanexecute()booleanbooleanbooleanbooleanint[]executeQuery(String sql) intintexecuteUpdate(String sql) intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndexes) intexecuteUpdate(String sql, String[] columnNames) intintintintbooleanbooleangetMoreResults(int current) intintintintintbooleanisClosed()booleanbooleanbooleanisWrapperFor(Class<?> iface) voidvoidsetAsciiStream(int parameterIndex, InputStream inputStream) voidsetAsciiStream(int parameterIndex, InputStream inputStream, int length) voidsetAsciiStream(int parameterIndex, InputStream inputStream, long length) voidsetBigDecimal(int parameterIndex, BigDecimal bigDecimal) voidsetBinaryStream(int parameterIndex, InputStream inputStream) voidsetBinaryStream(int parameterIndex, InputStream inputStream, int length) voidsetBinaryStream(int parameterIndex, InputStream inputStream, long length) voidsetBinaryStream(String name, InputStream inputStream, long length) Sets the designated parameter to the given input stream, which will have the specified number of bytes.voidsetBlob(int parameterIndex, InputStream inputStream) voidsetBlob(int parameterIndex, InputStream inputStream, long length) voidvoidsetBoolean(int parameterIndex, boolean value) voidsetBoolean(String name, boolean value) Setbooleanvalue for the named index.voidsetByte(int parameterIndex, byte value) voidsetBytes(int parameterIndex, byte[] bytes) voidSets the designated parameter to the given array of bytes.voidsetCharacterStream(int parameterIndex, Reader reader) voidsetCharacterStream(int parameterIndex, Reader reader, int length) voidsetCharacterStream(int parameterIndex, Reader reader, long length) voidvoidvoidvoidsetCursorName(String name) voidvoidvoidsetDouble(int parameterIndex, double value) voidsetEscapeProcessing(boolean enable) voidsetFetchDirection(int direction) voidsetFetchSize(int rows) voidsetFloat(int parameterIndex, float value) voidsetInt(int parameterIndex, int value) voidSetintvalue for the named index.voidsetLong(int parameterIndex, long value) voidSetlongvalue for the named index.voidsetMaxFieldSize(int max) voidsetMaxRows(int max) voidsetNCharacterStream(int parameterIndex, Reader value) voidsetNCharacterStream(int parameterIndex, Reader value, long length) voidvoidvoidvoidsetNString(int parameterIndex, String value) voidsetNString(String name, String value) Set unicodeStringvalue for the named index.voidsetNull(int parameterIndex, int sqlType) voidvoidSets the designated parameter to SQL NULLvoidvoidvoidvoidvoidsetPoolable(boolean poolable) voidsetQueryTimeout(int seconds) voidvoidvoidsetShort(int parameterIndex, short value) voidvoidvoidSetStringvalue for the named index.voidReplace repeated indexes with the list of values.voidvoidvoidsetTimestamp(int parameterIndex, Timestamp timestamp) voidsetTimestamp(int parameterIndex, Timestamp timestamp, Calendar cal) voidsetTimeStamp(String name, Timestamp timestamp, Calendar calendar) SetTimeStampvalue for the named index.voidsetUnicodeStream(int parameterIndex, InputStream inputStream, int length) void<T> TMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.PreparedStatement
executeLargeUpdate, setObject, setObjectMethods inherited from interface java.sql.Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getLargeMaxRows, getLargeUpdateCount, isSimpleIdentifier, setLargeMaxRows
-
Constructor Details
-
NamedPreparedStatement
public NamedPreparedStatement(Connection connection, String sqlQuery, Map<String, Integer> repetition) throws SQLExceptionCreate a named prepared statement with repeated indexes.- Parameters:
connection- Database connection to be used.sqlQuery- Underlying SQL query.repetition- Repetition of given index.- Throws:
SQLException- SQL Exception.
-
NamedPreparedStatement
Create a named prepared statement.- Parameters:
connection- Database connection to be used.sqlQuery- Underlying SQL query.- Throws:
SQLException- SQL Exception.
-
NamedPreparedStatement
public NamedPreparedStatement(Connection connection, String sqlQuery, String returningColumnName) throws SQLException Create a named prepared statement with a specified column value to be returned.- Parameters:
connection- Database connection to be used.sqlQuery- Underlying SQL query.returningColumnName- Name of the unique column to be returned upon query success.- Throws:
SQLException- SQL Exception.
-
NamedPreparedStatement
public NamedPreparedStatement(Connection connection, String sqlQuery, Map<String, Integer> repetition, String returningColumnName) throws SQLExceptionCreate a named prepared statement with repeated indexes and a specified column value to be returned.- Parameters:
connection- Database connection to be used.sqlQuery- Underlying SQL query.repetition- Repetition of given index.returningColumnName- Name of the column to be returned upon query success.- Throws:
SQLException- SQL Exception.
-
-
Method Details
-
setLong
Setlongvalue for the named index.- Parameters:
name- Name of the index.value- Value to be replaced.- Throws:
SQLException- SQL Exception.
-
setInt
Setintvalue for the named index.- Parameters:
name- Name of the index.value- Value to be replaced.- Throws:
SQLException- SQL Exception.
-
setString
SetStringvalue for the named index.- Parameters:
name- Name of the index.value- Value to be replaced.- Throws:
SQLException- SQL Exception
-
setString
Replace repeated indexes with the list of values.- Parameters:
name- Name of the index.values- Values to be replaced.- Throws:
SQLException- SQL Exception.
-
setObject
- Throws:
SQLException
-
setTimeStamp
SetTimeStampvalue for the named index.- Parameters:
name- Name of the index.timestamp- value to be replaced.calendar- value to be replaced.- Throws:
SQLException- SQL Exception.
-
setBoolean
Setbooleanvalue for the named index.- Parameters:
name- Name of the index.value- Value to be replaced.- Throws:
SQLException- SQL Exception.
-
setNString
Set unicodeStringvalue for the named index.- Parameters:
name- Name of the index.value- Value to be replaced.- Throws:
SQLException- SQL Exception
-
setBinaryStream
Sets the designated parameter to the given input stream, which will have the specified number of bytes.- Parameters:
name- Name of the index.inputStream- The java input stream which contains the binary parameter value.length- The number of bytes in the stream.- Throws:
SQLException- If name does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closedPreparedStatement.
-
setBytes
Sets the designated parameter to the given array of bytes.- Parameters:
name- Name of the index.value- The byte array containing the parameter value.- Throws:
SQLException- If name does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closedPreparedStatement.
-
setNull
Sets the designated parameter to SQL NULL- Parameters:
name- Name of the index.sqlType- The SQL type code defined injava.sql.Types.- Throws:
SQLException- If name does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closedPreparedStatement.
-
executeQuery
- Specified by:
executeQueryin interfacePreparedStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfacePreparedStatement- Throws:
SQLException
-
setNull
- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLException
-
setBoolean
- Specified by:
setBooleanin interfacePreparedStatement- Throws:
SQLException
-
setByte
- Specified by:
setBytein interfacePreparedStatement- Throws:
SQLException
-
setShort
- Specified by:
setShortin interfacePreparedStatement- Throws:
SQLException
-
setInt
- Specified by:
setIntin interfacePreparedStatement- Throws:
SQLException
-
setLong
- Specified by:
setLongin interfacePreparedStatement- Throws:
SQLException
-
setFloat
- Specified by:
setFloatin interfacePreparedStatement- Throws:
SQLException
-
setDouble
- Specified by:
setDoublein interfacePreparedStatement- Throws:
SQLException
-
setBigDecimal
- Specified by:
setBigDecimalin interfacePreparedStatement- Throws:
SQLException
-
setString
- Specified by:
setStringin interfacePreparedStatement- Throws:
SQLException
-
setBytes
- Specified by:
setBytesin interfacePreparedStatement- Throws:
SQLException
-
setDate
- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLException
-
setTime
- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLException
-
setTimestamp
- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setUnicodeStream
public void setUnicodeStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - Specified by:
setUnicodeStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException - Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
clearParameters
- Specified by:
clearParametersin interfacePreparedStatement- Throws:
SQLException
-
setObject
- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setObject
- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfacePreparedStatement- Throws:
SQLException
-
addBatch
- Specified by:
addBatchin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setRef
- Specified by:
setRefin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setArray
- Specified by:
setArrayin interfacePreparedStatement- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaDatain interfacePreparedStatement- Throws:
SQLException
-
setDate
- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLException
-
setTime
- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLException
-
setTimestamp
- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLException
-
setNull
- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLException
-
setURL
- Specified by:
setURLin interfacePreparedStatement- Throws:
SQLException
-
getParameterMetaData
- Specified by:
getParameterMetaDatain interfacePreparedStatement- Throws:
SQLException
-
setRowId
- Specified by:
setRowIdin interfacePreparedStatement- Throws:
SQLException
-
setNString
- Specified by:
setNStringin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNClob
- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setSQLXML
- Specified by:
setSQLXMLin interfacePreparedStatement- Throws:
SQLException
-
setObject
public void setObject(int parameterIndex, Object object, int targetSqlType, int scaleOrLength) throws SQLException - Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, InputStream inputStream, long length) throws SQLException - Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException - Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
executeQuery
- Specified by:
executeQueryin interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Throws:
SQLException
-
getMaxFieldSize
- Specified by:
getMaxFieldSizein interfaceStatement- Throws:
SQLException
-
setMaxFieldSize
- Specified by:
setMaxFieldSizein interfaceStatement- Throws:
SQLException
-
getMaxRows
- Specified by:
getMaxRowsin interfaceStatement- Throws:
SQLException
-
setMaxRows
- Specified by:
setMaxRowsin interfaceStatement- Throws:
SQLException
-
setEscapeProcessing
- Specified by:
setEscapeProcessingin interfaceStatement- Throws:
SQLException
-
getQueryTimeout
- Specified by:
getQueryTimeoutin interfaceStatement- Throws:
SQLException
-
setQueryTimeout
- Specified by:
setQueryTimeoutin interfaceStatement- Throws:
SQLException
-
cancel
- Specified by:
cancelin interfaceStatement- Throws:
SQLException
-
getWarnings
- Specified by:
getWarningsin interfaceStatement- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException
-
setCursorName
- Specified by:
setCursorNamein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSet
- Specified by:
getResultSetin interfaceStatement- Throws:
SQLException
-
getUpdateCount
- Specified by:
getUpdateCountin interfaceStatement- Throws:
SQLException
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
setFetchDirection
- Specified by:
setFetchDirectionin interfaceStatement- Throws:
SQLException
-
getFetchDirection
- Specified by:
getFetchDirectionin interfaceStatement- Throws:
SQLException
-
setFetchSize
- Specified by:
setFetchSizein interfaceStatement- Throws:
SQLException
-
getFetchSize
- Specified by:
getFetchSizein interfaceStatement- Throws:
SQLException
-
getResultSetConcurrency
- Specified by:
getResultSetConcurrencyin interfaceStatement- Throws:
SQLException
-
getResultSetType
- Specified by:
getResultSetTypein interfaceStatement- Throws:
SQLException
-
addBatch
- Specified by:
addBatchin interfaceStatement- Throws:
SQLException
-
clearBatch
- Specified by:
clearBatchin interfaceStatement- Throws:
SQLException
-
executeBatch
- Specified by:
executeBatchin interfaceStatement- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceStatement- Throws:
SQLException
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getGeneratedKeys
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSetHoldability
- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceStatement- Throws:
SQLException
-
setPoolable
- Specified by:
setPoolablein interfaceStatement- Throws:
SQLException
-
isPoolable
- Specified by:
isPoolablein interfaceStatement- Throws:
SQLException
-
closeOnCompletion
- Specified by:
closeOnCompletionin interfaceStatement- Throws:
SQLException
-
isCloseOnCompletion
- Specified by:
isCloseOnCompletionin interfaceStatement- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-