Class DAOUtil

java.lang.Object
fr.paris.lutece.util.sql.DAOUtil
All Implemented Interfaces:
AutoCloseable

public class DAOUtil extends Object implements AutoCloseable
Prepared statement util class
Since:
version 1.3
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new DAOUtil object.
    DAOUtil(String sql, boolean logQueries)
    Creates a new DAOUtil object.
    DAOUtil(String strSQL, Plugin plugin)
    Creates a new DAOUtil object.
    DAOUtil(String strSQL, Plugin plugin, boolean bLogQueries)
    Creates a new DAOUtil object.
    DAOUtil(String sql, Integer autoGeneratedKeys)
    Creates a new DAOUtil object.
    DAOUtil(String strSQL, Integer autoGeneratedKeys, Plugin plugin)
    Creates a new DAOUtil object.
    DAOUtil(String strSQL, Integer autoGeneratedKeys, Plugin plugin, boolean bLogQueries)
    Creates a new DAOUtil object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a set of parameters to this PreparedStatement object's batch of commands.
    void
    Adds the given SQL command to the current list of commands for this Statement object.
    void
    Clears the current parameter values immediately.
    void
    int[]
    Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
    void
    Executes a query
    void
    Executes the update request and throws an error if the result is not 1
    final void
    Free connection
    getArray(int nIndex)
    Get an Array value
    getArray(String strColumnName)
    Get an Array value
    getAsciiString(int nIndex)
    Get an ascii value stream
    getAsciiString(String strColumnName)
    Get an ascii value stream
    getBigDecimal(int nIndex)
    Get a BigDecimal value
    getBigDecimal(String strColumnName)
    Get a BigDecimal value
    getBinaryStream(int nIndex)
    Gets a binary stream from a resultSet
    getBlob(int nIndex)
    Gets a blob from a resultset
    getBlob(String strColumnName)
    Gets a blob from a resultset
    boolean
    getBoolean(int nIndex)
    Gets the value of the designated column in the current row of this ResultSet object as a Boolean
    boolean
    getBoolean(String strColumnName)
    Gets the value of the designated column in the current row of this ResultSet object as a Boolean
    byte
    getByte(int nIndex)
    Gets a byte from a resultset
    byte
    getByte(String strColumnName)
    Gets a byte from a resultset
    byte[]
    getBytes(int nIndex)
    Gets a byte array from a resultset
    byte[]
    getBytes(String strColumnName)
    Gets a byte array from a resultset
    getCharacterStream(int nIndex)
    Get a character stream value
    getCharacterStream(String strColumnName)
    Get a character stream value
    getClob(int nIndex)
    Get a Clob value
    getClob(String strColumnName)
    Get a Clob value
    getDate(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.
    getDate(int nIndex, Calendar calendar)
    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.
    getDate(String strColumnName)
    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.
    getDate(String strColumnName, Calendar calendar)
    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.
    double
    getDouble(int nIndex)
    Gets the value of the designated column in the current row of this ResultSet object as a double
    double
    getDouble(String strColumnName)
    Gets the value of the designated column in the current row of this ResultSet object as a double
    float
    getFloat(int nIndex)
    Get a float value
    float
    getFloat(String strColumnName)
    Get a float value
    Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a BigDecimal
    byte
    getGeneratedKeyByte(int nIndex)
    Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a byte
    int
    getGeneratedKeyInt(int nIndex)
    Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a int
    long
    getGeneratedKeyLong(int nIndex)
    Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a long
    short
    Gets the value of the designated column in the current row of this GeneratedKeys ResultSet object as a short
    Get the GeneratedKeys ResultSet
    int
    getInt(int nIndex)
    Gets the value of the designated column in the current row of this ResultSet object as a int
    int
    getInt(String strColumnName)
    Gets the value of the designated column in the current row of this ResultSet object as a int
    long
    getLong(int nIndex)
    Gets the long value
    long
    getLong(String strColumnName)
    Gets the long value
    getNCharacterStream(int nIndex)
    Get a character stream value
    getNCharacterStream(String strColumnName)
    Get a character stream value
    getNClob(int nIndex)
    Get a NClob value
    getNClob(String strColumnName)
    Get a Clob value
    getNString(int nIndex)
    Get a String value
    getNString(String strColumnName)
    Get a Stringvalue
    getObject(int nIndex)
    Gets the value of the designated column in the current row of this ResultSet object as a Object
    <T> T
    getObject(int nIndex, Class<T> type)
    Gets the value of the designated column in the current row of this ResultSet object as a T
    getObject(int nIndex, Map<String,Class<?>> map)
    Gets the value of the designated column in the current row of this ResultSet object as a Object
    getObject(String strColumnName)
    Gets the value of the designated column in the current row of this ResultSet object as an Object
    <T> T
    getObject(String strColumnName, Class<T> type)
    Gets the value of the designated column in the current row of this ResultSet object as an Object
    getObject(String strColumnName, Map<String,Class<?>> map)
    Gets the value of the designated column in the current row of this ResultSet object as an Object
    getRef(int nIndex)
    Get a Ref value
    getRef(String strColumnName)
    Get a Ref value
    Get the ResultSet
    int
    Gives the number of rows returned by the execute update statement.
    getRowId(int nIndex)
    Get a RowId value
    getRowId(String strColumnName)
    Get a RowId value
    short
    getShort(int nIndex)
    Get a short value
    short
    getShort(String strColumnName)
    Get a short value
    getSQLXML(int nIndex)
    Get a SQLXML value
    getSQLXML(String strColumnName)
    Get a SQLXML value
    getString(int nIndex)
    Gets the value of the designated column in the current row of this ResultSet object as a string
    getString(String strColumnName)
    Gets the value of the designated column in the current row of this ResultSet object as a string
    getTime(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.
    getTime(int nIndex, Calendar calendar)
    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.
    getTime(String strColumnName)
    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.
    getTime(String strColumnName, Calendar calendar)
    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 timestamp
    getTimestamp(int nIndex, Calendar calendar)
    Gets the value of the designated column in the current row of this ResultSet object as a timestamp
    getTimestamp(String strColumnName)
    Gets the value of the designated column in the current row of this ResultSet object as a Timestamp
    getTimestamp(String strColumnName, Calendar calendar)
    Gets the value of the designated column in the current row of this ResultSet object as a Timestamp
    getURL(int nIndex)
    Get a URL value
    getURL(String strColumnName)
    Get a URL value
    boolean
    Indicates whether the cursor is on the last row of this ResultSet object.
    boolean
    Moves the cursor down one row from its current position in the ResultSet.
    boolean
    Moves the cursor down one row from its current position in the GeneratedKeys ResultSet.
    void
    setArray(int nIndex, String strTypename, Object[] elements)
    Set an Array value
    void
    setAsciiStream(int nIndex, InputStream stream)
    Fills the prepared statement with an ascii value stream
    void
    setAsciiStream(int nIndex, InputStream stream, int nLength)
    Fills the prepared statement with an ascii value stream
    void
    setAsciiStream(int nIndex, InputStream stream, long lLength)
    Fills the prepared statement with an ascii value stream
    void
    setBigDecimal(int nIndex, BigDecimal value)
    Fills the prepared Statement with a BigDecimal value
    void
    setBinaryStream(int nIndex, InputStream iStream)
    Fills the prepared statement with a binary value stream
    void
    setBinaryStream(int nIndex, InputStream iStream, int nBlength)
    Fills the prepared statement with a binary value stream
    void
    setBinaryStream(int nIndex, InputStream iStream, long nBlength)
    Fills the prepared statement with a binary value stream
    void
    setBlob(int nIndex, InputStream stream)
    Fills the prepared statement with a blob value from a stream
    void
    setBlob(int nIndex, InputStream stream, long nLength)
    Fills the prepared statement with a blob value from a stream
    void
    setBlob(int nIndex, Blob blob)
    Fills the prepared statement with a blob value
    void
    setBoolean(int nIndex, boolean bValue)
    Fills the prepared statement with a Boolean value
    void
    setByte(int nIndex, byte bValue)
    Fills the prepared statement with a byte value
    void
    setBytes(int nIndex, byte[] tbValue)
    Fills the prepared statement with a byte array value
    void
    setCharacterStream(int nIndex, Reader stream)
    Fills the prepared statement with a character stream
    void
    setCharacterStream(int nIndex, Reader stream, int nLength)
    Fills the prepared statement with a character stream
    void
    setCharacterStream(int nIndex, Reader stream, long nLength)
    Fills the prepared statement with a character stream
    void
    setClob(int nIndex, Reader stream)
    Fills the prepared statement with a Clob stream
    void
    setClob(int nIndex, Reader stream, long nLength)
    Fills the prepared statement with a Clob stream
    void
    setClob(int nIndex, Clob clob)
    Fills the prepared statement with a Clob
    void
    setClob(int nIndex, NClob clob)
    Fills the prepared statement with a NClob
    void
    setDate(int nIndex, Date date)
    Fills the prepared statement with a date value
    void
    setDate(int nIndex, Date date, Calendar calendar)
    Fills the prepared statement with a date value
    void
    setDouble(int nIndex, double dValue)
    Fills the prepared statement with a double value
    void
    setDoubleNull(int nIndex)
    Sets null value for a "double" column
    void
    setFloat(int nIndex, float fValue)
    Fills the prepared statement with a float value
    void
    setInt(int nIndex, int nValue)
    Fills the prepared statement with a int value
    void
    setIntNull(int nIndex)
    Fills the prepared statement with a int null value
    void
    setLong(int nIndex, long lValue)
    Sets a long value
    void
    setLongNull(int nIndex)
    Sets null value for a "long" column
    void
    setNCharacterStream(int nIndex, Reader stream)
    Fills the prepared statement with a character stream value
    void
    setNCharacterStream(int nIndex, Reader stream, long nLength)
    Fills the prepared statement with a character stream value
    void
    setNClob(int nIndex, Reader stream)
    Fills the prepared statement with a NClob stream
    void
    setNClob(int nIndex, Reader stream, long nLength)
    Fills the prepared statement with a NClob stream
    void
    setNString(int nIndex, String strValue)
    Fills the prepared statement with a String value
    void
    setNull(int nIndex, int nType)
    Fills the prepared statement with a null value
    void
    setNull(int nIndex, int nType, String strTypeName)
    Fills the prepared statement with a null value
    void
    setObject(int nIndex, Object value)
    Fills the prepared statement with an object value
    void
    setObject(int nIndex, Object value, int nType)
    Fills the prepared statement with an object value
    void
    setObject(int nIndex, Object value, int nType, int nScaleOrLength)
    Fills the prepared statement with an object value
    void
    setRef(int nIndex, Ref ref)
    Fills the prepared statement with an Ref value
    void
    setRowId(int nIndex, RowId rowId)
    Fills the prepared statement with a RowId value
    void
    setShort(int nIndex, short shortValue)
    Fills the prepared statement with a short value
    void
    setSQLXML(int nIndex, SQLXML value)
    Fills the prepared statement with a SQLXML value
    void
    setString(int nIndex, String strValue)
    Fills the prepared statement with a string value
    void
    setTime(int nIndex, Time time)
    Fills the prepared statement with a time value
    void
    setTime(int nIndex, Time time, Calendar calendar)
    Fills the prepared statement with a time value
    void
    setTimestamp(int nIndex, Timestamp ts)
    Fills the prepared statement with a timestamp value
    void
    setTimestamp(int nIndex, Timestamp ts, Calendar calendar)
    Fills the prepared statement with a timestamp value
    void
    setURL(int nIndex, URL url)
    Fills the prepared statement with a URL value

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • DAOUtil

      public DAOUtil(String sql)
      Creates a new DAOUtil object.
      Parameters:
      sql - Sql Query for prepared Statement
    • DAOUtil

      public DAOUtil(String sql, boolean logQueries)
      Creates a new DAOUtil object.
      Parameters:
      sql - Sql Query for prepared Statement
    • DAOUtil

      public DAOUtil(String strSQL, Plugin plugin)
      Creates a new DAOUtil object.
      Parameters:
      strSQL - sql query for prepared Statement
      plugin - The plugin using this database access
    • DAOUtil

      public DAOUtil(String strSQL, Plugin plugin, boolean bLogQueries)
      Creates a new DAOUtil object.
      Parameters:
      strSQL - sql query for prepared Statement
      plugin - The plugin using this database access
    • DAOUtil

      public DAOUtil(String sql, Integer autoGeneratedKeys)
      Creates a new DAOUtil object.
      Parameters:
      sql - Sql Query for prepared Statement
      autoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; For example one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS. See PreparedStatement#prepareStatement(String, int)
      Since:
      6.0.0
    • DAOUtil

      public DAOUtil(String strSQL, Integer autoGeneratedKeys, Plugin plugin)
      Creates a new DAOUtil object.
      Parameters:
      strSQL - sql query for prepared Statement
      autoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; For example one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS. See PreparedStatement#prepareStatement(String, int)
      plugin - The plugin using this database access
      Since:
      6.0.0
    • DAOUtil

      public DAOUtil(String strSQL, Integer autoGeneratedKeys, Plugin plugin, boolean bLogQueries)
      Creates a new DAOUtil object.
      Parameters:
      bLogQueries -
      strSQL - sql query for prepared Statement
      autoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; For example one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS. See PreparedStatement#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

      public void setDate(int nIndex, Date date)
      Fills the prepared statement with a date value
      Parameters:
      nIndex - parameter index
      date - date value
    • setDate

      public void setDate(int nIndex, Date date, Calendar calendar)
      Fills the prepared statement with a date value
      Parameters:
      nIndex - parameter index
      date - date value
      calendar - the calendar
      Since:
      5.1.1
      See Also:
    • setTime

      public void setTime(int nIndex, Time time)
      Fills the prepared statement with a time value
      Parameters:
      nIndex - parameter index
      time - time value
    • setTime

      public void setTime(int nIndex, Time time, Calendar calendar)
      Fills the prepared statement with a time value
      Parameters:
      nIndex - parameter index
      time - time value
      calendar - the calendat
      Since:
      5.1.1
      See Also:
    • setBinaryStream

      public void setBinaryStream(int nIndex, InputStream iStream, int nBlength)
      Fills the prepared statement with a binary value stream
      Parameters:
      nIndex - parameter index
      iStream - the java input stream which contains the binary parameter value
      nBlength - the number of bytes in the stream
    • setBinaryStream

      public void setBinaryStream(int nIndex, InputStream iStream, long nBlength)
      Fills the prepared statement with a binary value stream
      Parameters:
      nIndex - parameter index
      iStream - the java input stream which contains the binary parameter value
      nBlength - the number of bytes in the stream
      Since:
      5.1.1
      See Also:
    • setBinaryStream

      public void setBinaryStream(int nIndex, InputStream iStream)
      Fills the prepared statement with a binary value stream
      Parameters:
      nIndex - parameter index
      iStream - the java input stream which contains the binary parameter value
      Since:
      5.1.1
      See Also:
    • getBinaryStream

      public InputStream getBinaryStream(int nIndex)
      Gets a binary stream from a resultSet
      Parameters:
      nIndex - column index
      Returns:
      InputStream instance
    • getBlob

      public Blob getBlob(int nIndex)
      Gets a blob from a resultset
      Parameters:
      nIndex - column index
      Returns:
      Blob instance
    • getBlob

      public Blob getBlob(String strColumnName)
      Gets a blob from a resultset
      Parameters:
      strColumnName - column name
      Returns:
      Blob instance
    • setBlob

      public void setBlob(int nIndex, InputStream stream)
      Fills the prepared statement with a blob value from a stream
      Parameters:
      nIndex - the index
      stream - the value
      Since:
      5.1.1
      See Also:
    • setBlob

      public void setBlob(int nIndex, InputStream stream, long nLength)
      Fills the prepared statement with a blob value from a stream
      Parameters:
      nIndex - the index
      stream - the value
      nLength - the number of bytes to read
      Since:
      5.1.1
      See Also:
    • setBlob

      public void setBlob(int nIndex, Blob blob)
      Fills the prepared statement with a blob value
      Parameters:
      nIndex - the index
      blob - 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

      public byte[] getBytes(String strColumnName)
      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

      public byte getByte(String strColumnName)
      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 statement
      nValue - 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 statement
      bValue - 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 statement
      bValue - 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 statement
      tbValue - byte array value
    • setString

      public void setString(int nIndex, String strValue)
      Fills the prepared statement with a string value
      Parameters:
      nIndex - parameter index in the prepared statement
      strValue - string value
    • setTimestamp

      public void setTimestamp(int nIndex, Timestamp ts)
      Fills the prepared statement with a timestamp value
      Parameters:
      nIndex - parameter index in the prepared statement
      ts - timestamp value
    • setTimestamp

      public void setTimestamp(int nIndex, Timestamp ts, Calendar calendar)
      Fills the prepared statement with a timestamp value
      Parameters:
      nIndex - parameter index in the prepared statement
      ts - timestamp value
      calendar - 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 statement
      dValue - The value
    • setDoubleNull

      public void setDoubleNull(int nIndex)
      Sets null value for a "double" column
      Parameters:
      nIndex - the index
    • getDate

      public Date getDate(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.
      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

      public Date getDate(String strColumnName)
      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

      public Date getDate(int nIndex, Calendar calendar)
      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

      public Date getDate(String strColumnName, Calendar calendar)
      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

      public Time getTime(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.
      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

      public Time getTime(String strColumnName)
      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

      public Time getTime(int nIndex, Calendar calendar)
      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

      public Time getTime(String strColumnName, Calendar calendar)
      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

      public int getInt(String strColumnName)
      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

      public boolean getBoolean(String strColumnName)
      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

      public String getString(int nIndex)
      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

      public String getString(String strColumnName)
      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

      public Timestamp getTimestamp(int nIndex)
      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

      public Timestamp getTimestamp(String strColumnName)
      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

      public Timestamp getTimestamp(int nIndex, Calendar calendar)
      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

      public Timestamp getTimestamp(String strColumnName, Calendar calendar)
      Gets the value of the designated column in the current row of this ResultSet object as a Timestamp
      Parameters:
      strColumnName - column name
      calendar - the calendar
      Returns:
      the column value; if the value is SQL NULL, the value returned is NULL
      Since:
      5.1.1
      See Also:
    • getDouble

      public double getDouble(String strColumnName)
      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

      public Object getObject(int nIndex)
      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

      public <T> T getObject(int nIndex, Class<T> type)
      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

      public Object getObject(int nIndex, Map<String,Class<?>> map)
      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

      public ResultSet getResultSet()
      Get the ResultSet
      Returns:
      the resultSet
    • getGeneratedKeysResultSet

      public ResultSet getGeneratedKeysResultSet()
      Get the GeneratedKeys ResultSet
      Returns:
      the GeneratedKeys ResultSet
      Since:
      6.0.0
    • getObject

      public Object getObject(String strColumnName)
      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

      public <T> T getObject(String strColumnName, Class<T> type)
      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 name
      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

      public Object getObject(String strColumnName, Map<String,Class<?>> map)
      Gets the value of the designated column in the current row of this ResultSet object as an Object
      Parameters:
      strColumnName - column name
      map - 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

      public BigDecimal getGeneratedKeyBigDecimal(int nIndex)
      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 index
      lValue - the value
    • getLong

      public long getLong(int nIndex)
      Gets the long value
      Parameters:
      nIndex - the index
      Returns:
      the long value
    • getLong

      public long getLong(String strColumnName)
      Gets the long value
      Parameters:
      strColumnName - the column name
      Returns:
      the long value
    • setArray

      public void setArray(int nIndex, String strTypename, Object[] elements)
      Set an Array value
      Parameters:
      nIndex - the index
      strTypename - the type SQL name
      elements - the array value
      Since:
      5.1.1
      See Also:
    • getArray

      public Array getArray(int nIndex)
      Get an Array value
      Parameters:
      nIndex - the index
      Returns:
      the array value
      Since:
      5.1.1
      See Also:
    • getArray

      public Array getArray(String strColumnName)
      Get an Array value
      Parameters:
      strColumnName - the column name
      Returns:
      the array value
      Since:
      5.1.1
      See Also:
    • setAsciiStream

      public void setAsciiStream(int nIndex, InputStream stream)
      Fills the prepared statement with an ascii value stream
      Parameters:
      nIndex - the index
      stream - the stream
      Since:
      5.1.1
      See Also:
    • setAsciiStream

      public void setAsciiStream(int nIndex, InputStream stream, int nLength)
      Fills the prepared statement with an ascii value stream
      Parameters:
      nIndex - the index
      stream - the stream
      nLength - the number of bytes to read
      Since:
      5.1.1
      See Also:
    • setAsciiStream

      public void setAsciiStream(int nIndex, InputStream stream, long lLength)
      Fills the prepared statement with an ascii value stream
      Parameters:
      nIndex - the index
      stream - the stream
      lLength - the number of bytes to read
      Since:
      5.1.1
      See Also:
    • getAsciiString

      public InputStream getAsciiString(int nIndex)
      Get an ascii value stream
      Parameters:
      nIndex - the index
      Returns:
      the ascii stream
      Since:
      5.1.1
      See Also:
    • getAsciiString

      public InputStream getAsciiString(String strColumnName)
      Get an ascii value stream
      Parameters:
      strColumnName - the column name
      Returns:
      the ascii stream
      Since:
      5.1.1
      See Also:
    • setBigDecimal

      public void setBigDecimal(int nIndex, BigDecimal value)
      Fills the prepared Statement with a BigDecimal value
      Parameters:
      nIndex - the index
      value - the value
      Since:
      5.1.1
      See Also:
    • getBigDecimal

      public BigDecimal getBigDecimal(int nIndex)
      Get a BigDecimal value
      Parameters:
      nIndex - the index
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • getBigDecimal

      public BigDecimal getBigDecimal(String strColumnName)
      Get a BigDecimal value
      Parameters:
      strColumnName - the column name
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • setCharacterStream

      public void setCharacterStream(int nIndex, Reader stream)
      Fills the prepared statement with a character stream
      Parameters:
      nIndex - the index
      stream - the stream
      Since:
      5.1.1
      See Also:
    • setCharacterStream

      public void setCharacterStream(int nIndex, Reader stream, int nLength)
      Fills the prepared statement with a character stream
      Parameters:
      nIndex - the index
      stream - the stream
      nLength - the number of bytes to read
      Since:
      5.1.1
      See Also:
    • setCharacterStream

      public void setCharacterStream(int nIndex, Reader stream, long nLength)
      Fills the prepared statement with a character stream
      Parameters:
      nIndex - the index
      stream - the stream
      nLength - the number of bytes to read
      Since:
      5.1.1
      See Also:
    • getCharacterStream

      public Reader getCharacterStream(int nIndex)
      Get a character stream value
      Parameters:
      nIndex - the column index
      Returns:
      the stream value
      Since:
      5.1.1
      See Also:
    • getCharacterStream

      public Reader getCharacterStream(String strColumnName)
      Get a character stream value
      Parameters:
      strColumnName - the column index
      Returns:
      the stream value
      Since:
      5.1.1
      See Also:
    • setClob

      public void setClob(int nIndex, Reader stream)
      Fills the prepared statement with a Clob stream
      Parameters:
      nIndex - the index
      stream - the value
      Since:
      5.1.1
      See Also:
    • setClob

      public void setClob(int nIndex, Reader stream, long nLength)
      Fills the prepared statement with a Clob stream
      Parameters:
      nIndex - the index
      stream - the value
      nLength - the number of bytes to read
      Since:
      5.1.1
      See Also:
    • setClob

      public void setClob(int nIndex, Clob clob)
      Fills the prepared statement with a Clob
      Parameters:
      nIndex - the index
      clob - the value
      Since:
      5.1.1
      See Also:
    • getClob

      public Clob getClob(int nIndex)
      Get a Clob value
      Parameters:
      nIndex - the column index
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • getClob

      public Clob getClob(String strColumnName)
      Get a Clob value
      Parameters:
      strColumnName - the column index
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • setNClob

      public void setNClob(int nIndex, Reader stream)
      Fills the prepared statement with a NClob stream
      Parameters:
      nIndex - the index
      stream - the value
      Since:
      5.1.1
      See Also:
    • setNClob

      public void setNClob(int nIndex, Reader stream, long nLength)
      Fills the prepared statement with a NClob stream
      Parameters:
      nIndex - the index
      stream - the value
      nLength - the number of bytes to read
      Since:
      5.1.1
      See Also:
    • setClob

      public void setClob(int nIndex, NClob clob)
      Fills the prepared statement with a NClob
      Parameters:
      nIndex - the index
      clob - the value
      Since:
      5.1.1
      See Also:
    • getNClob

      public NClob getNClob(int nIndex)
      Get a NClob value
      Parameters:
      nIndex - the column index
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • getNClob

      public NClob getNClob(String strColumnName)
      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 index
      fValue - the value
      Since:
      5.1.1
      See Also:
    • getFloat

      public float getFloat(String strColumnName)
      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

      public void setNCharacterStream(int nIndex, Reader stream)
      Fills the prepared statement with a character stream value
      Parameters:
      nIndex - the index
      stream - the stream
      Since:
      5.1.1
      See Also:
    • setNCharacterStream

      public void setNCharacterStream(int nIndex, Reader stream, long nLength)
      Fills the prepared statement with a character stream value
      Parameters:
      nIndex - the index
      stream - the stream
      nLength - the number of characters to read
      Since:
      5.1.1
      See Also:
    • getNCharacterStream

      public Reader getNCharacterStream(int nIndex)
      Get a character stream value
      Parameters:
      nIndex - the index
      Returns:
      the stream
      Since:
      5.1.1
      See Also:
    • getNCharacterStream

      public Reader getNCharacterStream(String strColumnName)
      Get a character stream value
      Parameters:
      strColumnName - the column name
      Returns:
      the stream
      Since:
      5.1.1
      See Also:
    • setNString

      public void setNString(int nIndex, String strValue)
      Fills the prepared statement with a String value
      Parameters:
      nIndex - the index
      strValue - the value
      Since:
      5.1.1
      See Also:
    • getNString

      public String getNString(int nIndex)
      Get a String value
      Parameters:
      nIndex - the index
      Returns:
      the String
      Since:
      5.1.1
      See Also:
    • getNString

      public String getNString(String strColumnName)
      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 index
      nType - the SQL type code defined in java.sql.Types
      Since:
      5.1.1
      See Also:
    • setNull

      public void setNull(int nIndex, int nType, String strTypeName)
      Fills the prepared statement with a null value
      Parameters:
      nIndex - the index
      nType - the SQL type code defined in java.sql.Types
      strTypeName - the type name
      Since:
      5.1.1
      See Also:
    • setObject

      public void setObject(int nIndex, Object value)
      Fills the prepared statement with an object value
      Parameters:
      nIndex - the index
      value - the value
      Since:
      5.1.1
      See Also:
    • setObject

      public void setObject(int nIndex, Object value, int nType)
      Fills the prepared statement with an object value
      Parameters:
      nIndex - the index
      value - the value
      nType - the target SQL type (as defined in java.sql.Types)
      Since:
      5.1.1
      See Also:
    • setObject

      public void setObject(int nIndex, Object value, int nType, int nScaleOrLength)
      Fills the prepared statement with an object value
      Parameters:
      nIndex - the index
      value - the value
      nType - the target SQL type (as defined in java.sql.Types)
      nScaleOrLength - the scale or length
      Since:
      5.1.1
      See Also:
    • getRef

      public Ref getRef(int nIndex)
      Get a Ref value
      Parameters:
      nIndex - the index
      Returns:
      the ref
      Since:
      5.1.1
      See Also:
    • getRef

      public Ref getRef(String strColumnName)
      Get a Ref value
      Parameters:
      strColumnName - the column name
      Returns:
      the ref
      Since:
      5.1.1
      See Also:
    • setRef

      public void setRef(int nIndex, Ref ref)
      Fills the prepared statement with an Ref value
      Parameters:
      nIndex - the index
      ref - the Ref
      Since:
      5.1.1
      See Also:
    • setRowId

      public void setRowId(int nIndex, RowId rowId)
      Fills the prepared statement with a RowId value
      Parameters:
      nIndex - the index
      rowId - the value
      Since:
      5.1.1
      See Also:
    • getRowId

      public RowId getRowId(int nIndex)
      Get a RowId value
      Parameters:
      nIndex - the index
      Returns:
      the rowId
      Since:
      5.1.1
      See Also:
    • getRowId

      public RowId getRowId(String strColumnName)
      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 index
      shortValue - the value
      Since:
      5.1.1
      See Also:
    • getShort

      public short getShort(String strColumnName)
      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

      public void setSQLXML(int nIndex, SQLXML value)
      Fills the prepared statement with a SQLXML value
      Parameters:
      nIndex - the index
      value - the value
      Since:
      5.1.1
      See Also:
    • getSQLXML

      public SQLXML getSQLXML(String strColumnName)
      Get a SQLXML value
      Parameters:
      strColumnName - the column name
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • getSQLXML

      public SQLXML getSQLXML(int nIndex)
      Get a SQLXML value
      Parameters:
      nIndex - the column index
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • setURL

      public void setURL(int nIndex, URL url)
      Fills the prepared statement with a URL value
      Parameters:
      nIndex - the index
      url - the URL
      Since:
      5.1.1
      See Also:
    • getURL

      public URL getURL(String strColumnName)
      Get a URL value
      Parameters:
      strColumnName - the column name
      Returns:
      the value
      Since:
      5.1.1
      See Also:
    • getURL

      public URL getURL(int nIndex)
      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 this PreparedStatement object's batch of commands.
      Since:
      7.0.0
    • addBatch

      public void addBatch(String sql)
      Adds the given SQL command to the current list of commands for this Statement object. The commands in this list can be executed as a batch by calling the method executeBatch.

      Note:This method cannot be called on a PreparedStatement or CallableStatement.

      Parameters:
      sql - typically this is a SQL INSERT or UPDATE statement this method is called on a closed Statement, the driver does not support batch updates, the method is called on a PreparedStatement or CallableStatement
      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:
      close in interface AutoCloseable
    • 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