Stores functions used to create SQLite Statements.
- Source:
Methods
(static) deleteStatement(uniqueIndex, dataRowKeys) → {string}
Makes an SQLite Statement for a deletion by primary key match.
Parameters:
Name | Type | Description |
---|---|---|
uniqueIndex |
UniqueIndex | The uniqueIndex to delete on. |
dataRowKeys |
Array.<string> | The order of the uniqueIndex columns. |
- Source:
Returns:
- The SQLite deletion statement.
- Type
- string
(static) insertStatement(uniqueIndex, schema, dataRowKeys, upsert) → {string}
Makes an SQLite Statement for an insertion.
If dataRowKeys is missing a column that is in the schema, it is not added into the statement. This is so an insert adds the SQLite Column default value, and if there is an update, only the defined columns are changed.
Parameters:
Name | Type | Description |
---|---|---|
uniqueIndex |
UniqueIndex | The uniqueIndex to upsert. |
schema |
object | The schema of the database. |
dataRowKeys |
Array.<string> | The column names for the data row. |
upsert |
boolean | If true, updates if the data already exists. |
- Source:
Returns:
- The SQLite insert/upsert statement.
- Type
- string
(static) updateStatement(uniqueIndex, schema, dataRowKeys) → {string}
Makes an SQLite Statement for an update.
If dataRowKeys is missing a column that is in the schema, it is not added into the statement. This is so an insert adds the SQLite Column default value, and if there is an update, only the defined columns are changed.
Parameters:
Name | Type | Description |
---|---|---|
uniqueIndex |
UniqueIndex | The uniqueIndex to upsert. |
schema |
object | The schema of the database. |
dataRowKeys |
Array.<string> | The column names for the data row. |
- Source:
Returns:
- The SQLite insert/upsert statement.
- Type
- string
Example
// returns
// `UPDATE table SET "unique" = :a(unique) WHERE "unique" = :a(unique);`
updateStatement([{"asc": "unique"}], {"unique": "TEXT"}, ["unique"]);
(inner) makeUniqueIndexSet(uniqueIndex) → {Set.<string>}
Parameters:
Name | Type | Description |
---|---|---|
uniqueIndex |
UniqueIndex | The uniqueIndex. |
- Source:
Returns:
The set of uniqueIndex columns.
- Type
- Set.<string>