Package org.sqlite.core
Class CoreStatement
java.lang.Object
org.sqlite.core.CoreStatement
- All Implemented Interfaces:
Codes
- Direct Known Subclasses:
JDBC3Statement
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Object[]
protected int
final SQLiteConnection
protected boolean
protected final CoreResultSet
protected String
Fields inherited from interface org.sqlite.core.Codes
SQLITE_ABORT, SQLITE_AUTH, SQLITE_BLOB, SQLITE_BUSY, SQLITE_CANTOPEN, SQLITE_CONSTRAINT, SQLITE_CORRUPT, SQLITE_DONE, SQLITE_EMPTY, SQLITE_ERROR, SQLITE_FLOAT, SQLITE_FULL, SQLITE_INTEGER, SQLITE_INTERNAL, SQLITE_INTERRUPT, SQLITE_IOERR, SQLITE_LOCKED, SQLITE_MISMATCH, SQLITE_MISUSE, SQLITE_NOLFS, SQLITE_NOMEM, SQLITE_NOTFOUND, SQLITE_NULL, SQLITE_OK, SQLITE_PERM, SQLITE_PROTOCOL, SQLITE_READONLY, SQLITE_ROW, SQLITE_SCHEMA, SQLITE_TEXT, SQLITE_TOOBIG
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkIndex
(int index) protected final void
protected void
protected boolean
exec()
Calls sqlite3_step() and sets up results.protected boolean
Executes SQL statement and throws SQLExceptions if the given SQL statement is null or no database is open.abstract ResultSet
executeQuery
(String sql, boolean closeStmt) This implementation uses SQLite's last_insert_rowid function to obtain the row ID.protected void
protected void
void
SQLite's last_insert_rowid() function is DB-specific.
-
Field Details
-
conn
-
rs
-
pointer
-
sql
-
batchPos
protected int batchPos -
batch
-
resultsWaiting
protected boolean resultsWaiting
-
-
Constructor Details
-
CoreStatement
-
-
Method Details
-
getDatabase
-
getConnectionConfig
-
checkOpen
- Throws:
SQLException
- If the database is not opened.
-
exec
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
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
- Throws:
SQLException
-
notifyFirstStatementExecuted
protected void notifyFirstStatementExecuted() -
executeQuery
- Throws:
SQLException
-
checkIndex
- Throws:
SQLException
-
clearGeneratedKeys
- Throws:
SQLException
-
updateGeneratedKeys
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
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:
-