Package fr.paris.lutece.util.sql
Class DAOUtil
java.lang.Object
fr.paris.lutece.util.sql.DAOUtil
- All Implemented Interfaces:
AutoCloseable
Prepared statement util class
- Since:
- version 1.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new DAOUtil object.Creates a new DAOUtil object.Creates a new DAOUtil object.Creates a new DAOUtil object.Creates a new DAOUtil object.Creates a new DAOUtil object.Creates a new DAOUtil object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()Adds a set of parameters to thisPreparedStatementobject's batch of commands.voidAdds the given SQL command to the current list of commands for thisStatementobject.voidClears the current parameter values immediately.voidclose()int[]Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.voidExecutes a queryvoidExecutes the update request and throws an error if the result is not 1final voidfree()Free connectiongetArray(int nIndex) Get an Array valueGet an Array valuegetAsciiString(int nIndex) Get an ascii value streamgetAsciiString(String strColumnName) Get an ascii value streamgetBigDecimal(int nIndex) Get a BigDecimal valuegetBigDecimal(String strColumnName) Get a BigDecimal valuegetBinaryStream(int nIndex) Gets a binary stream from a resultSetgetBlob(int nIndex) Gets a blob from a resultsetGets a blob from a resultsetbooleangetBoolean(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a BooleanbooleangetBoolean(String strColumnName) Gets the value of the designated column in the current row of this ResultSet object as a BooleanbytegetByte(int nIndex) Gets a byte from a resultsetbyteGets a byte from a resultsetbyte[]getBytes(int nIndex) Gets a byte array from a resultsetbyte[]Gets a byte array from a resultsetgetCharacterStream(int nIndex) Get a character stream valuegetCharacterStream(String strColumnName) Get a character stream valuegetClob(int nIndex) Get a Clob valueGet a Clob valuegetDate(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.doublegetDouble(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a doubledoubleGets the value of the designated column in the current row of this ResultSet object as a doublefloatgetFloat(int nIndex) Get a float valuefloatGet a float valuegetGeneratedKeyBigDecimal(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a BigDecimalbytegetGeneratedKeyByte(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a byteintgetGeneratedKeyInt(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a intlonggetGeneratedKeyLong(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a longshortgetGeneratedKeyShort(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a shortGet the GeneratedKeys ResultSetintgetInt(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a intintGets the value of the designated column in the current row of this ResultSet object as a intlonggetLong(int nIndex) Gets the long valuelongGets the long valuegetNCharacterStream(int nIndex) Get a character stream valuegetNCharacterStream(String strColumnName) Get a character stream valuegetNClob(int nIndex) Get a NClob valueGet a Clob valuegetNString(int nIndex) Get a String valuegetNString(String strColumnName) Get a StringvaluegetObject(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a Object<T> TGets the value of the designated column in the current row of this ResultSet object as a TGets the value of the designated column in the current row of this ResultSet object as a ObjectGets the value of the designated column in the current row of this ResultSet object as an Object<T> TGets the value of the designated column in the current row of this ResultSet object as an ObjectGets the value of the designated column in the current row of this ResultSet object as an ObjectgetRef(int nIndex) Get a Ref valueGet a Ref valueGet the ResultSetintGives the number of rows returned by the execute update statement.getRowId(int nIndex) Get a RowId valueGet a RowId valueshortgetShort(int nIndex) Get a short valueshortGet a short valuegetSQLXML(int nIndex) Get a SQLXML valueGet a SQLXML valuegetString(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a stringGets the value of the designated column in the current row of this ResultSet object as a stringgetTime(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.getTimestamp(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a timestampgetTimestamp(int nIndex, Calendar calendar) Gets the value of the designated column in the current row of this ResultSet object as a timestampgetTimestamp(String strColumnName) Gets the value of the designated column in the current row of this ResultSet object as a TimestampgetTimestamp(String strColumnName, Calendar calendar) Gets the value of the designated column in the current row of this ResultSet object as a TimestampgetURL(int nIndex) Get a URL valueGet a URL valuebooleanisLast()Indicates whether the cursor is on the last row of this ResultSet object.booleannext()Moves the cursor down one row from its current position in the ResultSet.booleanMoves the cursor down one row from its current position in the GeneratedKeys ResultSet.voidSet an Array valuevoidsetAsciiStream(int nIndex, InputStream stream) Fills the prepared statement with an ascii value streamvoidsetAsciiStream(int nIndex, InputStream stream, int nLength) Fills the prepared statement with an ascii value streamvoidsetAsciiStream(int nIndex, InputStream stream, long lLength) Fills the prepared statement with an ascii value streamvoidsetBigDecimal(int nIndex, BigDecimal value) Fills the prepared Statement with a BigDecimal valuevoidsetBinaryStream(int nIndex, InputStream iStream) Fills the prepared statement with a binary value streamvoidsetBinaryStream(int nIndex, InputStream iStream, int nBlength) Fills the prepared statement with a binary value streamvoidsetBinaryStream(int nIndex, InputStream iStream, long nBlength) Fills the prepared statement with a binary value streamvoidsetBlob(int nIndex, InputStream stream) Fills the prepared statement with a blob value from a streamvoidsetBlob(int nIndex, InputStream stream, long nLength) Fills the prepared statement with a blob value from a streamvoidFills the prepared statement with a blob valuevoidsetBoolean(int nIndex, boolean bValue) Fills the prepared statement with a Boolean valuevoidsetByte(int nIndex, byte bValue) Fills the prepared statement with a byte valuevoidsetBytes(int nIndex, byte[] tbValue) Fills the prepared statement with a byte array valuevoidsetCharacterStream(int nIndex, Reader stream) Fills the prepared statement with a character streamvoidsetCharacterStream(int nIndex, Reader stream, int nLength) Fills the prepared statement with a character streamvoidsetCharacterStream(int nIndex, Reader stream, long nLength) Fills the prepared statement with a character streamvoidFills the prepared statement with a Clob streamvoidFills the prepared statement with a Clob streamvoidFills the prepared statement with a ClobvoidFills the prepared statement with a NClobvoidFills the prepared statement with a date valuevoidFills the prepared statement with a date valuevoidsetDouble(int nIndex, double dValue) Fills the prepared statement with a double valuevoidsetDoubleNull(int nIndex) Sets null value for a "double" columnvoidsetFloat(int nIndex, float fValue) Fills the prepared statement with a float valuevoidsetInt(int nIndex, int nValue) Fills the prepared statement with a int valuevoidsetIntNull(int nIndex) Fills the prepared statement with a int null valuevoidsetLong(int nIndex, long lValue) Sets a long valuevoidsetLongNull(int nIndex) Sets null value for a "long" columnvoidsetNCharacterStream(int nIndex, Reader stream) Fills the prepared statement with a character stream valuevoidsetNCharacterStream(int nIndex, Reader stream, long nLength) Fills the prepared statement with a character stream valuevoidFills the prepared statement with a NClob streamvoidFills the prepared statement with a NClob streamvoidsetNString(int nIndex, String strValue) Fills the prepared statement with a String valuevoidsetNull(int nIndex, int nType) Fills the prepared statement with a null valuevoidFills the prepared statement with a null valuevoidFills the prepared statement with an object valuevoidFills the prepared statement with an object valuevoidFills the prepared statement with an object valuevoidFills the prepared statement with an Ref valuevoidFills the prepared statement with a RowId valuevoidsetShort(int nIndex, short shortValue) Fills the prepared statement with a short valuevoidFills the prepared statement with a SQLXML valuevoidFills the prepared statement with a string valuevoidFills the prepared statement with a time valuevoidFills the prepared statement with a time valuevoidsetTimestamp(int nIndex, Timestamp ts) Fills the prepared statement with a timestamp valuevoidsetTimestamp(int nIndex, Timestamp ts, Calendar calendar) Fills the prepared statement with a timestamp valuevoidFills the prepared statement with a URL value
-
Field Details
-
MSG_EXCEPTION_SELECT_ERROR
- See Also:
-
-
Constructor Details
-
DAOUtil
Creates a new DAOUtil object.- Parameters:
sql- Sql Query for prepared Statement
-
DAOUtil
Creates a new DAOUtil object.- Parameters:
sql- Sql Query for prepared Statement
-
DAOUtil
Creates a new DAOUtil object.- Parameters:
strSQL- sql query for prepared Statementplugin- The plugin using this database access
-
DAOUtil
Creates a new DAOUtil object.- Parameters:
strSQL- sql query for prepared Statementplugin- The plugin using this database access
-
DAOUtil
Creates a new DAOUtil object.- Parameters:
sql- Sql Query for prepared StatementautoGeneratedKeys- a flag indicating whether auto-generated keys should be returned; For example one ofStatement.RETURN_GENERATED_KEYSorStatement.NO_GENERATED_KEYS. SeePreparedStatement#prepareStatement(String, int)- Since:
- 6.0.0
-
DAOUtil
Creates a new DAOUtil object.- Parameters:
strSQL- sql query for prepared StatementautoGeneratedKeys- a flag indicating whether auto-generated keys should be returned; For example one ofStatement.RETURN_GENERATED_KEYSorStatement.NO_GENERATED_KEYS. SeePreparedStatement#prepareStatement(String, int)plugin- The plugin using this database access- Since:
- 6.0.0
-
DAOUtil
Creates a new DAOUtil object.- Parameters:
bLogQueries-strSQL- sql query for prepared StatementautoGeneratedKeys- a flag indicating whether auto-generated keys should be returned; For example one ofStatement.RETURN_GENERATED_KEYSorStatement.NO_GENERATED_KEYS. SeePreparedStatement#prepareStatement(String, int)plugin- The plugin using this database access- Since:
- 6.0.0
-
-
Method Details
-
executeUpdate
public void executeUpdate()Executes the update request and throws an error if the result is not 1 -
executeQuery
public void executeQuery()Executes a query -
free
public final void free()Free connection -
isLast
public boolean isLast()Indicates whether the cursor is on the last row of this ResultSet object.- Returns:
- true if the cursor is on the last row; false otherwise
-
setDate
Fills the prepared statement with a date value- Parameters:
nIndex- parameter indexdate- date value
-
setDate
Fills the prepared statement with a date value- Parameters:
nIndex- parameter indexdate- date valuecalendar- the calendar- Since:
- 5.1.1
- See Also:
-
setTime
Fills the prepared statement with a time value- Parameters:
nIndex- parameter indextime- time value
-
setTime
Fills the prepared statement with a time value- Parameters:
nIndex- parameter indextime- time valuecalendar- the calendat- Since:
- 5.1.1
- See Also:
-
setBinaryStream
Fills the prepared statement with a binary value stream- Parameters:
nIndex- parameter indexiStream- the java input stream which contains the binary parameter valuenBlength- the number of bytes in the stream
-
setBinaryStream
Fills the prepared statement with a binary value stream- Parameters:
nIndex- parameter indexiStream- the java input stream which contains the binary parameter valuenBlength- the number of bytes in the stream- Since:
- 5.1.1
- See Also:
-
setBinaryStream
Fills the prepared statement with a binary value stream- Parameters:
nIndex- parameter indexiStream- the java input stream which contains the binary parameter value- Since:
- 5.1.1
- See Also:
-
getBinaryStream
Gets a binary stream from a resultSet- Parameters:
nIndex- column index- Returns:
- InputStream instance
-
getBlob
Gets a blob from a resultset- Parameters:
nIndex- column index- Returns:
- Blob instance
-
getBlob
Gets a blob from a resultset- Parameters:
strColumnName- column name- Returns:
- Blob instance
-
setBlob
Fills the prepared statement with a blob value from a stream- Parameters:
nIndex- the indexstream- the value- Since:
- 5.1.1
- See Also:
-
setBlob
Fills the prepared statement with a blob value from a stream- Parameters:
nIndex- the indexstream- the valuenLength- the number of bytes to read- Since:
- 5.1.1
- See Also:
-
setBlob
Fills the prepared statement with a blob value- Parameters:
nIndex- the indexblob- the value- Since:
- 5.1.1
- See Also:
-
getBytes
public byte[] getBytes(int nIndex) Gets a byte array from a resultset- Parameters:
nIndex- column index- Returns:
- byte[] instance
-
getBytes
Gets a byte array from a resultset- Parameters:
strColumnName- column name- Returns:
- byte[] instance
-
getByte
public byte getByte(int nIndex) Gets a byte from a resultset- Parameters:
nIndex- column index- Returns:
- byte instance
- Since:
- 5.1.1
- See Also:
-
getByte
Gets a byte from a resultset- Parameters:
strColumnName- column name- Returns:
- byte instance
- Since:
- 5.1.1
- See Also:
-
setInt
public void setInt(int nIndex, int nValue) Fills the prepared statement with a int value- Parameters:
nIndex- parameter index in the prepared statementnValue- int value
-
setBoolean
public void setBoolean(int nIndex, boolean bValue) Fills the prepared statement with a Boolean value- Parameters:
nIndex- parameter index in the prepared statementbValue- Boolean value
-
setByte
public void setByte(int nIndex, byte bValue) Fills the prepared statement with a byte value- Parameters:
nIndex- parameter index in the prepared statementbValue- byte value- Since:
- 5.1.1
- See Also:
-
setBytes
public void setBytes(int nIndex, byte[] tbValue) Fills the prepared statement with a byte array value- Parameters:
nIndex- parameter index in the prepared statementtbValue- byte array value
-
setString
Fills the prepared statement with a string value- Parameters:
nIndex- parameter index in the prepared statementstrValue- string value
-
setTimestamp
Fills the prepared statement with a timestamp value- Parameters:
nIndex- parameter index in the prepared statementts- timestamp value
-
setTimestamp
Fills the prepared statement with a timestamp value- Parameters:
nIndex- parameter index in the prepared statementts- timestamp valuecalendar- the calendar- Since:
- 5.1.1
- See Also:
-
setDouble
public void setDouble(int nIndex, double dValue) Fills the prepared statement with a double value- Parameters:
nIndex- parameter index in the prepared statementdValue- The value
-
setDoubleNull
public void setDoubleNull(int nIndex) Sets null value for a "double" column- Parameters:
nIndex- the index
-
getDate
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is null
-
getDate
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.- Parameters:
strColumnName- name of the column, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is null
-
getDate
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.- Parameters:
nIndex- the first column is 1, the second is 2, ...calendar- the calendar- Returns:
- the column value; if the value is SQL NULL, the value returned is null
- Since:
- 5.1.1
- See Also:
-
getDate
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.- Parameters:
strColumnName- name of the column, ...calendar- the calendar- Returns:
- the column value; if the value is SQL NULL, the value returned is null
- Since:
- 5.1.1
- See Also:
-
getTime
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is null
-
getTime
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.- Parameters:
strColumnName- name of the column, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is null
-
getTime
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.- Parameters:
nIndex- the first column is 1, the second is 2, ...calendar- the calendar- Returns:
- the column value; if the value is SQL NULL, the value returned is null
- Since:
- 5.1.1
- See Also:
-
getTime
Gets the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.- Parameters:
strColumnName- name of the column, ...calendar- the calendar- Returns:
- the column value; if the value is SQL NULL, the value returned is null
- Since:
- 5.1.1
- See Also:
-
getInt
public int getInt(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a int- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
-
getInt
Gets the value of the designated column in the current row of this ResultSet object as a int- Parameters:
strColumnName- column name- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
-
getBoolean
public boolean getBoolean(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a Boolean- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is FALSE
-
getBoolean
Gets the value of the designated column in the current row of this ResultSet object as a Boolean- Parameters:
strColumnName- column name- Returns:
- the column value; if the value is SQL NULL, the value returned is FALSE
-
getString
Gets the value of the designated column in the current row of this ResultSet object as a string- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
-
getString
Gets the value of the designated column in the current row of this ResultSet object as a string- Parameters:
strColumnName- column name- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
-
getTimestamp
Gets the value of the designated column in the current row of this ResultSet object as a timestamp- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
-
getTimestamp
Gets the value of the designated column in the current row of this ResultSet object as a Timestamp- Parameters:
strColumnName- column name- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
-
getTimestamp
Gets the value of the designated column in the current row of this ResultSet object as a timestamp- Parameters:
nIndex- the first column is 1, the second is 2, ...calendar- the calendar- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
- Since:
- 5.1.1
- See Also:
-
getTimestamp
Gets the value of the designated column in the current row of this ResultSet object as a Timestamp- Parameters:
strColumnName- column namecalendar- the calendar- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
- Since:
- 5.1.1
- See Also:
-
getDouble
Gets the value of the designated column in the current row of this ResultSet object as a double- Parameters:
strColumnName- column name- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
-
getDouble
public double getDouble(int nIndex) Gets the value of the designated column in the current row of this ResultSet object as a double- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
-
getObject
Gets the value of the designated column in the current row of this ResultSet object as a Object- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
-
getObject
Gets the value of the designated column in the current row of this ResultSet object as a T- Type Parameters:
T- the return type- Parameters:
nIndex- the first column is 1, the second is 2, ...type- the type- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
- Since:
- 5.1.1
- See Also:
-
getObject
Gets the value of the designated column in the current row of this ResultSet object as a Object- Parameters:
nIndex- the first column is 1, the second is 2, ...map- the type map- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
- Since:
- 5.1.1
- See Also:
-
getResultSet
Get the ResultSet- Returns:
- the resultSet
-
getGeneratedKeysResultSet
Get the GeneratedKeys ResultSet- Returns:
- the GeneratedKeys ResultSet
- Since:
- 6.0.0
-
getObject
Gets the value of the designated column in the current row of this ResultSet object as an Object- Parameters:
strColumnName- column name- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
-
getObject
Gets the value of the designated column in the current row of this ResultSet object as an Object- Type Parameters:
T- the return type- Parameters:
strColumnName- column nametype- the type- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
- Since:
- 5.1.1
- See Also:
-
getObject
Gets the value of the designated column in the current row of this ResultSet object as an Object- Parameters:
strColumnName- column namemap- type map- Returns:
- the column value; if the value is SQL NULL, the value returned is NULL
- Since:
- 5.1.1
- See Also:
-
next
public boolean next()Moves the cursor down one row from its current position in the ResultSet.- Returns:
- true if the new current row is valid; false if there are no more rows
-
nextGeneratedKey
public boolean nextGeneratedKey()Moves the cursor down one row from its current position in the GeneratedKeys ResultSet.- Returns:
- true if the new current row is valid; false if there are no more rows
- Since:
- 6.0.0
-
getGeneratedKeyByte
public byte getGeneratedKeyByte(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a byte- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
- Since:
- 6.0.0
-
getGeneratedKeyShort
public short getGeneratedKeyShort(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a short- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
- Since:
- 6.0.0
-
getGeneratedKeyInt
public int getGeneratedKeyInt(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a int- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
- Since:
- 6.0.0
-
getGeneratedKeyLong
public long getGeneratedKeyLong(int nIndex) Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a long- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
- Since:
- 6.0.0
-
getGeneratedKeyBigDecimal
Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a BigDecimal- Parameters:
nIndex- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL NULL, the value returned is 0
- Since:
- 6.0.0
-
setIntNull
public void setIntNull(int nIndex) Fills the prepared statement with a int null value- Parameters:
nIndex- parameter index
-
setLongNull
public void setLongNull(int nIndex) Sets null value for a "long" column- Parameters:
nIndex- the index
-
setLong
public void setLong(int nIndex, long lValue) Sets a long value- Parameters:
nIndex- the indexlValue- the value
-
getLong
public long getLong(int nIndex) Gets the long value- Parameters:
nIndex- the index- Returns:
- the long value
-
getLong
Gets the long value- Parameters:
strColumnName- the column name- Returns:
- the long value
-
setArray
Set an Array value- Parameters:
nIndex- the indexstrTypename- the type SQL nameelements- the array value- Since:
- 5.1.1
- See Also:
-
getArray
Get an Array value- Parameters:
nIndex- the index- Returns:
- the array value
- Since:
- 5.1.1
- See Also:
-
getArray
Get an Array value- Parameters:
strColumnName- the column name- Returns:
- the array value
- Since:
- 5.1.1
- See Also:
-
setAsciiStream
Fills the prepared statement with an ascii value stream- Parameters:
nIndex- the indexstream- the stream- Since:
- 5.1.1
- See Also:
-
setAsciiStream
Fills the prepared statement with an ascii value stream- Parameters:
nIndex- the indexstream- the streamnLength- the number of bytes to read- Since:
- 5.1.1
- See Also:
-
setAsciiStream
Fills the prepared statement with an ascii value stream- Parameters:
nIndex- the indexstream- the streamlLength- the number of bytes to read- Since:
- 5.1.1
- See Also:
-
getAsciiString
Get an ascii value stream- Parameters:
nIndex- the index- Returns:
- the ascii stream
- Since:
- 5.1.1
- See Also:
-
getAsciiString
Get an ascii value stream- Parameters:
strColumnName- the column name- Returns:
- the ascii stream
- Since:
- 5.1.1
- See Also:
-
setBigDecimal
Fills the prepared Statement with a BigDecimal value- Parameters:
nIndex- the indexvalue- the value- Since:
- 5.1.1
- See Also:
-
getBigDecimal
Get a BigDecimal value- Parameters:
nIndex- the index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
getBigDecimal
Get a BigDecimal value- Parameters:
strColumnName- the column name- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
setCharacterStream
Fills the prepared statement with a character stream- Parameters:
nIndex- the indexstream- the stream- Since:
- 5.1.1
- See Also:
-
setCharacterStream
Fills the prepared statement with a character stream- Parameters:
nIndex- the indexstream- the streamnLength- the number of bytes to read- Since:
- 5.1.1
- See Also:
-
setCharacterStream
Fills the prepared statement with a character stream- Parameters:
nIndex- the indexstream- the streamnLength- the number of bytes to read- Since:
- 5.1.1
- See Also:
-
getCharacterStream
Get a character stream value- Parameters:
nIndex- the column index- Returns:
- the stream value
- Since:
- 5.1.1
- See Also:
-
getCharacterStream
Get a character stream value- Parameters:
strColumnName- the column index- Returns:
- the stream value
- Since:
- 5.1.1
- See Also:
-
setClob
Fills the prepared statement with a Clob stream- Parameters:
nIndex- the indexstream- the value- Since:
- 5.1.1
- See Also:
-
setClob
Fills the prepared statement with a Clob stream- Parameters:
nIndex- the indexstream- the valuenLength- the number of bytes to read- Since:
- 5.1.1
- See Also:
-
setClob
Fills the prepared statement with a Clob- Parameters:
nIndex- the indexclob- the value- Since:
- 5.1.1
- See Also:
-
getClob
Get a Clob value- Parameters:
nIndex- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
getClob
Get a Clob value- Parameters:
strColumnName- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
setNClob
Fills the prepared statement with a NClob stream- Parameters:
nIndex- the indexstream- the value- Since:
- 5.1.1
- See Also:
-
setNClob
Fills the prepared statement with a NClob stream- Parameters:
nIndex- the indexstream- the valuenLength- the number of bytes to read- Since:
- 5.1.1
- See Also:
-
setClob
Fills the prepared statement with a NClob- Parameters:
nIndex- the indexclob- the value- Since:
- 5.1.1
- See Also:
-
getNClob
Get a NClob value- Parameters:
nIndex- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
getNClob
Get a Clob value- Parameters:
strColumnName- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
setFloat
public void setFloat(int nIndex, float fValue) Fills the prepared statement with a float value- Parameters:
nIndex- the indexfValue- the value- Since:
- 5.1.1
- See Also:
-
getFloat
Get a float value- Parameters:
strColumnName- the column name- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
getFloat
public float getFloat(int nIndex) Get a float value- Parameters:
nIndex- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
setNCharacterStream
Fills the prepared statement with a character stream value- Parameters:
nIndex- the indexstream- the stream- Since:
- 5.1.1
- See Also:
-
setNCharacterStream
Fills the prepared statement with a character stream value- Parameters:
nIndex- the indexstream- the streamnLength- the number of characters to read- Since:
- 5.1.1
- See Also:
-
getNCharacterStream
Get a character stream value- Parameters:
nIndex- the index- Returns:
- the stream
- Since:
- 5.1.1
- See Also:
-
getNCharacterStream
Get a character stream value- Parameters:
strColumnName- the column name- Returns:
- the stream
- Since:
- 5.1.1
- See Also:
-
setNString
Fills the prepared statement with a String value- Parameters:
nIndex- the indexstrValue- the value- Since:
- 5.1.1
- See Also:
-
getNString
Get a String value- Parameters:
nIndex- the index- Returns:
- the String
- Since:
- 5.1.1
- See Also:
-
getNString
Get a Stringvalue- Parameters:
strColumnName- the column name- Returns:
- the stream
- Since:
- 5.1.1
- See Also:
-
setNull
public void setNull(int nIndex, int nType) Fills the prepared statement with a null value- Parameters:
nIndex- the indexnType- the SQL type code defined in java.sql.Types- Since:
- 5.1.1
- See Also:
-
setNull
Fills the prepared statement with a null value- Parameters:
nIndex- the indexnType- the SQL type code defined in java.sql.TypesstrTypeName- the type name- Since:
- 5.1.1
- See Also:
-
setObject
Fills the prepared statement with an object value- Parameters:
nIndex- the indexvalue- the value- Since:
- 5.1.1
- See Also:
-
setObject
Fills the prepared statement with an object value- Parameters:
nIndex- the indexvalue- the valuenType- the target SQL type (as defined in java.sql.Types)- Since:
- 5.1.1
- See Also:
-
setObject
Fills the prepared statement with an object value- Parameters:
nIndex- the indexvalue- the valuenType- the target SQL type (as defined in java.sql.Types)nScaleOrLength- the scale or length- Since:
- 5.1.1
- See Also:
-
getRef
Get a Ref value- Parameters:
nIndex- the index- Returns:
- the ref
- Since:
- 5.1.1
- See Also:
-
getRef
Get a Ref value- Parameters:
strColumnName- the column name- Returns:
- the ref
- Since:
- 5.1.1
- See Also:
-
setRef
Fills the prepared statement with an Ref value- Parameters:
nIndex- the indexref- the Ref- Since:
- 5.1.1
- See Also:
-
setRowId
Fills the prepared statement with a RowId value- Parameters:
nIndex- the indexrowId- the value- Since:
- 5.1.1
- See Also:
-
getRowId
Get a RowId value- Parameters:
nIndex- the index- Returns:
- the rowId
- Since:
- 5.1.1
- See Also:
-
getRowId
Get a RowId value- Parameters:
strColumnName- the column name- Returns:
- the rowId
- Since:
- 5.1.1
- See Also:
-
setShort
public void setShort(int nIndex, short shortValue) Fills the prepared statement with a short value- Parameters:
nIndex- the indexshortValue- the value- Since:
- 5.1.1
- See Also:
-
getShort
Get a short value- Parameters:
strColumnName- the column name- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
getShort
public short getShort(int nIndex) Get a short value- Parameters:
nIndex- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
setSQLXML
Fills the prepared statement with a SQLXML value- Parameters:
nIndex- the indexvalue- the value- Since:
- 5.1.1
- See Also:
-
getSQLXML
Get a SQLXML value- Parameters:
strColumnName- the column name- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
getSQLXML
Get a SQLXML value- Parameters:
nIndex- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
setURL
Fills the prepared statement with a URL value- Parameters:
nIndex- the indexurl- the URL- Since:
- 5.1.1
- See Also:
-
getURL
Get a URL value- Parameters:
strColumnName- the column name- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
getURL
Get a URL value- Parameters:
nIndex- the column index- Returns:
- the value
- Since:
- 5.1.1
- See Also:
-
addBatch
public void addBatch()Adds a set of parameters to thisPreparedStatementobject's batch of commands.- Since:
- 7.0.0
-
addBatch
Adds the given SQL command to the current list of commands for thisStatementobject. The commands in this list can be executed as a batch by calling the methodexecuteBatch.Note:This method cannot be called on a
PreparedStatementorCallableStatement.- Parameters:
sql- typically this is a SQLINSERTorUPDATEstatement this method is called on a closedStatement, the driver does not support batch updates, the method is called on aPreparedStatementorCallableStatement- Since:
- 7.0.0
- See Also:
-
clearParameters
public void clearParameters()Clears the current parameter values immediately.In general, parameter values remain in force for repeated use of a statement. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling the method
clearParameters.- Since:
- 7.0.0
-
executeBatch
public int[] executeBatch()Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.- Returns:
- The elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch.
- Since:
- 7.0.0
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getReturnedRowCount
public int getReturnedRowCount()Gives the number of rows returned by the execute update statement. In all other cases, the value will be -1.- Returns:
- The number of rows returned by the execute update statement
-