nulib/php/src/db/_private/_generic.php

25 lines
491 B
PHP

<?php
namespace nulib\db\_private;
use nulib\str;
class _generic extends _common {
const SCHEMA = [
];
static function isa(string $sql): bool {
return preg_match('/^drop\s+table\b/i', $sql);
}
static function parse(array $query, ?array &$bindings=null): string {
$sql = "";
foreach ($query as $value) {
if ($sql && !str::ends_with(" ", $sql) && !str::starts_with(" ", $value)) {
$sql .= " ";
}
$sql .= $value;
}
return $sql;
}
}