Class SQLiteRDBMSActionStrategy
java.lang.Object
com.kingsrook.qqq.backend.module.rdbms.strategy.BaseRDBMSActionStrategy
com.kingsrook.qqq.backend.module.sqlite.strategy.SQLiteRDBMSActionStrategy
- All Implemented Interfaces:
RDBMSActionStrategyInterface
SQLite specialization of the default RDBMS/JDBC action strategy
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.kingsrook.qqq.backend.module.rdbms.strategy.RDBMSActionStrategyInterface
RDBMSActionStrategyInterface.ResultSetProcessor -
Field Summary
Fields inherited from class com.kingsrook.qqq.backend.module.rdbms.strategy.BaseRDBMSActionStrategy
DEFAULT_PAGE_SIZE, PAGE_SIZE, STAT_BATCHES_RAN, STAT_QUERIES_RAN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbeginConsistentRead(Connection connection, ConsistentReadInput input) SQLite: with autocommit off, the driver issues BEGIN (deferred), and the first read - which we do here, so the snapshot is taken now rather than at the caller's first query - takes the read lock/snapshot.protected intbindParamObject(PreparedStatement statement, int index, Object value) bind temporal types as strings (see above comment re: sqlite temporal types)executeInsertForGeneratedIds(Connection connection, String sql, List<Object> params, QFieldMetaData primaryKeyField) per discussion (and rejected PR mentioned) on https://github.com/prrvchr/sqlite-jdbc sqlite jdbc by default will only return the latest generated serial.getFieldValueFromResultSet(QFieldType type, ResultSet resultSet, int i) deal with sqlite not having temporal types... so temporal values i guess are stored as strings, as that's how they come back to us - so the JDBC methods fail trying to getDate or whatever from them - but getting the values as strings, they parse nicely, so do that.SQLite requires DEFAULT VALUES when no columns are supplied.Methods inherited from class com.kingsrook.qqq.backend.module.rdbms.strategy.BaseRDBMSActionStrategy
appendCriterionToWhereClause, bindParam, bindParam, bindParam, bindParam, bindParam, bindParam, bindParam, bindParam, bindParam, bindParam, bindParam, bindParam, bindParamNull, bindParams, executeBatchUpdate, executeStatement, executeUpdate, executeUpdateForRowCount, getAggregateExpression, getBucketTimeZone, getColumnName, getGroupByBucketExpression, getPageSize, getSampledTableExpression, getStatistics, getSupportedAggregateCapabilities, incrementStatistic, isH2, prepareStatementAndBindParams, resetStatistics, setCollectStatistics, setPageSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kingsrook.qqq.backend.module.rdbms.strategy.RDBMSActionStrategyInterface
configureStatementForLargeResults, getIdentifierQuoteString, jsonMergeAssignment, jsonObjectPlaceholder, jsonPathExpression, jsonPathPredicate, supportsForUpdateSkipLocked
-
Constructor Details
-
SQLiteRDBMSActionStrategy
public SQLiteRDBMSActionStrategy()
-
-
Method Details
-
getInsertDefaultValuesClause
SQLite requires DEFAULT VALUES when no columns are supplied. -
getFieldValueFromResultSet
public Serializable getFieldValueFromResultSet(QFieldType type, ResultSet resultSet, int i) throws SQLException deal with sqlite not having temporal types... so temporal values i guess are stored as strings, as that's how they come back to us - so the JDBC methods fail trying to getDate or whatever from them - but getting the values as strings, they parse nicely, so do that.- Specified by:
getFieldValueFromResultSetin interfaceRDBMSActionStrategyInterface- Overrides:
getFieldValueFromResultSetin classBaseRDBMSActionStrategy- Throws:
SQLException
-
bindParamObject
protected int bindParamObject(PreparedStatement statement, int index, Object value) throws SQLException bind temporal types as strings (see above comment re: sqlite temporal types)- Overrides:
bindParamObjectin classBaseRDBMSActionStrategy- Throws:
SQLException
-
executeInsertForGeneratedIds
public List<Serializable> executeInsertForGeneratedIds(Connection connection, String sql, List<Object> params, QFieldMetaData primaryKeyField) throws SQLException per discussion (and rejected PR mentioned) on https://github.com/prrvchr/sqlite-jdbc sqlite jdbc by default will only return the latest generated serial. but we can get them all by appending this "RETURNING id" to the query, and then calling execute() (instead of executeUpdate()) and getResultSet (instead of getGeneratedKeys())- Specified by:
executeInsertForGeneratedIdsin interfaceRDBMSActionStrategyInterface- Overrides:
executeInsertForGeneratedIdsin classBaseRDBMSActionStrategy- Throws:
SQLException
-
beginConsistentRead
public ConsistentReadStart beginConsistentRead(Connection connection, ConsistentReadInput input) throws SQLException SQLite: with autocommit off, the driver issues BEGIN (deferred), and the first read - which we do here, so the snapshot is taken now rather than at the caller's first query - takes the read lock/snapshot. In WAL mode, writers then proceed without being seen; in rollback-journal mode, they are blocked until this transaction ends. Either way, one instant.- Specified by:
beginConsistentReadin interfaceRDBMSActionStrategyInterface- Overrides:
beginConsistentReadin classBaseRDBMSActionStrategy- Throws:
SQLException
-