Class CoreStatement

java.lang.Object
org.sqlite.core.CoreStatement
All Implemented Interfaces:
Codes
Direct Known Subclasses:
JDBC3Statement

public abstract class CoreStatement extends Object implements Codes
  • Field Details

    • conn

      public final SQLiteConnection conn
    • rs

      protected final CoreResultSet rs
    • pointer

      public SafeStmtPtr pointer
    • sql

      protected String sql
    • batchPos

      protected int batchPos
    • batch

      protected Object[] batch
    • resultsWaiting

      protected boolean resultsWaiting
  • Constructor Details

  • Method Details

    • getDatabase

      public DB getDatabase()
    • getConnectionConfig

      public SQLiteConnectionConfig getConnectionConfig()
    • checkOpen

      protected final void checkOpen() throws SQLException
      Throws:
      SQLException - If the database is not opened.
    • exec

      protected boolean exec() throws SQLException
      Calls sqlite3_step() and sets up results. Expects a clean stmt.
      Returns:
      True if the ResultSet has at least one row; false otherwise.
      Throws:
      SQLException - If the given SQL statement is null or no database is open.
    • exec

      protected boolean exec(String sql) throws SQLException
      Executes SQL statement and throws SQLExceptions if the given SQL statement is null or no database is open.
      Parameters:
      sql - SQL statement.
      Returns:
      True if the ResultSet has at least one row; false otherwise.
      Throws:
      SQLException - If the given SQL statement is null or no database is open.
    • internalClose

      protected void internalClose() throws SQLException
      Throws:
      SQLException
    • notifyFirstStatementExecuted

      protected void notifyFirstStatementExecuted()
    • executeQuery

      public abstract ResultSet executeQuery(String sql, boolean closeStmt) throws SQLException
      Throws:
      SQLException
    • checkIndex

      protected void checkIndex(int index) throws SQLException
      Throws:
      SQLException
    • clearGeneratedKeys

      protected void clearGeneratedKeys() throws SQLException
      Throws:
      SQLException
    • updateGeneratedKeys

      public void updateGeneratedKeys() throws SQLException
      SQLite's last_insert_rowid() function is DB-specific. However, in this implementation we ensure the Generated Key result set is statement-specific by executing the query immediately after an insert operation is performed. The caller is simply responsible for calling updateGeneratedKeys on the statement object right after execute in a synchronized(connection) block.
      Throws:
      SQLException
    • getGeneratedKeys

      public ResultSet getGeneratedKeys() throws SQLException
      This implementation uses SQLite's last_insert_rowid function to obtain the row ID. It cannot provide multiple values when inserting multiple rows. Suggestion is to use a RETURNING clause instead.
      Throws:
      SQLException
      See Also: