- Completed SQLite pragma's missing code

This commit is contained in:
mcndave committed 2023-10-31 16:11:23 +00:00
1 parent 6c6733b503
commit 953fc35680
3 files changed
+17 -7

No files matched your search

+12 -4
View File
@@ -57,8 +57,8 @@ class SQLite implements AdapterInterface, MigrateInterface, SqlAdapterInterface
public function setup(array $configuration) : void
{
$this->path = $configuration['path'] ?? "";
$this->pragmaBegin = $configuration['pragma_begin'] ?? [];
$this->pragmaClose = $configuration['pragma_close'] ?? [];
$this->pragmaBegin = array_filter($configuration['pragma_begin'] ?? []);
$this->pragmaClose = array_filter($configuration['pragma_close'] ?? []);
}
# https://sqlite.org/lang_keywords.html
@@ -187,8 +187,16 @@ class SQLite implements AdapterInterface, MigrateInterface, SqlAdapterInterface
$builder = new QueryBuilder\SqliteQueryBuilder();
foreach($pragmaList as $pragma) {
list($key, $value) = explode('=', $pragma);
$pdo->query($builder->pragma($key, $value)->render());
list($key, $value) = explode('=', $pragma) + [ null, null ];
$sql = $builder->pragma($key, $value)->render();
$query = $pdo->query($sql);
if ( ! $query->execute() ) {
throw new \InvalidArgumentException(sprintf("Pragma query could not be executed : %s", $sql));
}
$builder->reset();
}
}