Compare commits
No commits in common. "feee26cd2655f718ebef75aa488a14365e9d75e2" and "0c8591f238708486821ce58861bcdfeda7b8397a" have entirely different histories.
feee26cd26
...
0c8591f238
@ -27,7 +27,7 @@ class SQLite implements AdapterInterface, MigrateInterface, SqlAdapterInterface
|
||||
public function connect() : PdoObject
|
||||
{
|
||||
try {
|
||||
$pdo = new PdoObject\SqlitePdoObject($this->buildDataSourceName(), null, null);
|
||||
$pdo = new PdoObject($this->buildDataSourceName(), null, null);
|
||||
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
|
||||
$pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
|
||||
@ -64,7 +64,6 @@ class SQLite implements AdapterInterface, MigrateInterface, SqlAdapterInterface
|
||||
public function escapeIdentifier(string $segment, int $type) : string
|
||||
{
|
||||
switch($type) {
|
||||
default:
|
||||
case static::IDENTIFIER_DATABASE:
|
||||
case static::IDENTIFIER_TABLE:
|
||||
case static::IDENTIFIER_FIELD:
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Common\PdoObject;
|
||||
|
||||
class SqlPdoObject extends \Ulmus\Common\PdoObject
|
||||
{
|
||||
protected int $openedTransaction = 0;
|
||||
|
||||
public function beginTransaction(): bool
|
||||
{
|
||||
if ( 0 === ++$this->openedTransaction ) {
|
||||
return parent::beginTransaction();
|
||||
}
|
||||
|
||||
return $this->exec('SAVEPOINT transaction_'.$this->openedTransaction) !== false;
|
||||
}
|
||||
|
||||
public function commit() : bool
|
||||
{
|
||||
if ( 0 === --$this->openedTransaction) {
|
||||
return parent::commit();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function rollback() : bool
|
||||
{
|
||||
if (0 !== $this->openedTransaction) {
|
||||
return $this->exec('ROLLBACK TO transaction_' . $this->openedTransaction--) !== false;
|
||||
}
|
||||
|
||||
return parent::rollback();
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Common\PdoObject;
|
||||
|
||||
class SqlitePdoObject extends SqlPdoObject
|
||||
{
|
||||
public function beginTransaction(): bool
|
||||
{
|
||||
if ( 0 === ++$this->openedTransaction ) {
|
||||
return $this->beginImmediateTransaction();
|
||||
}
|
||||
|
||||
return $this->exec('SAVEPOINT transaction_'.$this->openedTransaction) !== false;
|
||||
}
|
||||
|
||||
protected function beginImmediateTransaction(): bool
|
||||
{
|
||||
return $this->exec("BEGIN IMMEDIATE TRANSACTION") !== false;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user