- A lot of work done on bug fixing. Added a new SQLite adapter
This commit is contained in:
1 parent
667df92e52
commit
c14644cdda
28 files changed
+727
-234
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Query\Sqlite;
|
||||
|
||||
class Pragma extends \Ulmus\Query\Fragment {
|
||||
|
||||
const SQL_TOKEN = "PRAGMA %s%s";
|
||||
|
||||
public int $order = 15;
|
||||
|
||||
public /* object|string */ $pragma;
|
||||
|
||||
public $value;
|
||||
|
||||
public bool $callable;
|
||||
|
||||
public function set(/* object|Stringable */ $pragma, /* ? mixed */ $value = null, bool $callable = false) : self
|
||||
{
|
||||
$this->pragma = $pragma;
|
||||
|
||||
if ($value) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
$this->callable = $callable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() : string
|
||||
{
|
||||
if ( isset($this->value) ) {
|
||||
$value = sprintf($this->callable ? " (%s)" : " = %s", $this->value);
|
||||
}
|
||||
|
||||
return $this->renderSegments([
|
||||
sprintf(static::SQL_TOKEN, $this->pragma, $value ?? "")
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user