just another orm...
View the Project on GitHub tflori/orm
» API Reference » ORM\Dbal\Sqlite
Extends: ORM\Dbal\Dbal
public function __construct(
\ORM\EntityManager $entityManager,
array $options = [],
)
Parameter | Type | Description |
---|---|---|
$entityManager |
ORM\EntityManager | |
$options |
array |
ORM\Dbal\Sqlite::__construct
public function beginTransaction(): bool
Returns | bool |
ORM\Dbal\Sqlite::beginTransaction
public function commit(bool $all = false): bool
Actually nothing will be committed if there are savepoints. Instead the counter will be decreased and the commited savepoint will still be rolled back when you call rollback afterwards.
Hopefully that gives a hint why save points are no transactions and what the limitations are.
Begin transaction
updates / inserts for transaction1
Create savepoint transaction1
updates / inserts for transaction2
Create savepoint transaction2
updates / inserts for transaction3
<no commit here but you called commit for transaction3>
updates / inserts for transaction2
rollback of transaction2 to savepoint of transaction1
update / inserts for transaction1
commit of transaction1
Returns | bool |
Parameter | Type | Description |
---|---|---|
$all |
bool | Commit all opened transactions and savepoints |
ORM\Dbal\Sqlite::commit
public function delete(string $table, array $where): int
Where conditions can be an array of key => value pairs to check for equality or an array of expressions.
Examples:
$dbal->delete('someTable', ['id' => 23])
$dbal->delete('user', ['name = \'john\'', 'OR email=\'john.doe@example.com\''])
Tip: Use the query builder to construct where conditions:
$em->query('user')->where('name', 'john')->orWhere('email', '...')->delete();
Returns | int | The number of deleted rows |
Parameter | Type | Description |
---|---|---|
$table |
string | The table where to delete rows |
$where |
array | An array of where conditions |
ORM\Dbal\Sqlite::delete
public function deleteEntity(\ORM\Entity $entity): bool
This method does not delete from the map - you can still receive the entity via fetch.
Returns | bool |
Parameter | Type | Description |
---|---|---|
$entity |
ORM\Entity |
ORM\Dbal\Sqlite::deleteEntity
public function describe(string $table): \ORM\Dbal\Table|\ORM\Dbal\Column[]
Returns | ORM\Dbal\Table|ORM\Dbal\Column[] | |
Throws | ORM\Exception\UnsupportedDriver | |
Throws | ORM\Exception |
Parameter | Type | Description |
---|---|---|
$table |
string |
ORM\Dbal\Sqlite::describe
public function escapeIdentifier(string $identifier): string
Returns | string |
Parameter | Type | Description |
---|---|---|
$identifier |
string | Identifier to quote |
ORM\Dbal\Sqlite::escapeIdentifier
public function escapeValue(mixed $value): string
Returns | string | |
Throws | ORM\Exception\NotScalar |
Parameter | Type | Description |
---|---|---|
$value |
mixed | The variable that should be returned in SQL syntax |
ORM\Dbal\Sqlite::escapeValue
public function insert(mixed $table, array $rows): mixed
Returns | mixed |
Parameter | Type | Description |
---|---|---|
$table |
mixed | |
$rows |
array |
ORM\Dbal\Sqlite::insert
public function insertAndSync(\ORM\Entity $entities): bool
The entities have to be from same type otherwise a InvalidArgument will be thrown.
Returns | bool | |
Throws | ORM\Exception\InvalidArgument |
Parameter | Type | Description |
---|---|---|
$entities |
ORM\Entity |
ORM\Dbal\Sqlite::insertAndSync
public function insertAndSyncWithAutoInc(\ORM\Entity $entities): int|bool
The entities have to be from same type otherwise a InvalidArgument will be thrown.
Returns | int|bool | |
Throws | ORM\Exception\UnsupportedDriver | |
Throws | ORM\Exception\InvalidArgument |
Parameter | Type | Description |
---|---|---|
$entities |
ORM\Entity |
ORM\Dbal\Sqlite::insertAndSyncWithAutoInc
public function insertEntities(\ORM\Entity $entities): bool
The entities have to be from same type otherwise a InvalidArgument will be thrown.
Returns | bool |
Parameter | Type | Description |
---|---|---|
$entities |
ORM\Entity |
ORM\Dbal\Sqlite::insertEntities
public function rollback(): bool
Returns | bool |
ORM\Dbal\Sqlite::rollback
public function setOption(string $option, mixed $value): $this
Returns | $this |
Parameter | Type | Description |
---|---|---|
$option |
string | |
$value |
mixed |
ORM\Dbal\Sqlite::setOption
public function update(
string $table,
array $where,
array $updates,
array $joins = [],
): int
Simple usage: update('table', ['id' => 23], ['name' => 'John Doe'])
For advanced queries with parenthesis, joins (if supported from your DBMS) etc. use QueryBuilder:
$em->query('table')
->where('birth_date', '>', EM::raw('DATE_SUB(NOW(), INTERVAL 18 YEARS)'))
->update(['teenager' => true]);
Returns | int | The number of affected rows |
Throws | ORM\Exception\UnsupportedDriver |
Parameter | Type | Description |
---|---|---|
$table |
string | The table to update |
$where |
array | An array of where conditions |
$updates |
array | An array of columns to update |
$joins |
array | For internal use from query builder only |
ORM\Dbal\Sqlite::update