dbms_primeidc_init...1
This commit is contained in:
parent
d680586c65
commit
f307b3c4be
@ -57,7 +57,7 @@ abstract class Model
|
||||
private function reset(): void
|
||||
{
|
||||
$this->_wheres = [];
|
||||
$this->_querys = ["SELECT" => "SELECT *", "JOIN" => "", "ORDERBY" => "", "LIKE" => "", "LIMIT" => ""];
|
||||
$this->_querys = ["SELECT" => "SELECT *", "JOIN" => "", "ORDERBY" => "", "LIMIT" => ""];
|
||||
}
|
||||
final public function getLastQuery(): string
|
||||
{
|
||||
@ -116,10 +116,27 @@ abstract class Model
|
||||
{
|
||||
$this->whereIn($column, $values, $delimeter, $range);
|
||||
}
|
||||
final public function like(string $column, string $value, string $option = "both"): void
|
||||
{
|
||||
switch ($option) {
|
||||
case 'before':
|
||||
$value = "%{$value}";
|
||||
break;
|
||||
case 'after':
|
||||
$value = "{$value}%";
|
||||
break;
|
||||
default:
|
||||
$value = "%{$value}%";
|
||||
break;
|
||||
}
|
||||
$this->_wheres[] = "{$column} LIKE '{$value}'";
|
||||
}
|
||||
|
||||
final public function execute(string $query): bool|PDOStatement
|
||||
{
|
||||
echo "\n<BR>Query:" . $query . "\n<BR>";
|
||||
if ($this->_debug) {
|
||||
echo "\n<BR>Query:" . $query . "\n<BR>";
|
||||
}
|
||||
$this->_lastQuery = $query;
|
||||
$stmt = $this->getConnect()->prepare($query);
|
||||
$stmt->execute();
|
||||
@ -154,21 +171,6 @@ abstract class Model
|
||||
{
|
||||
$this->_querys["JOIN"] = " {$type} JOIN {$table} ON {$match}";
|
||||
}
|
||||
final public function like(string $column, string $value, string $option = "both"): void
|
||||
{
|
||||
switch ($option) {
|
||||
case 'before':
|
||||
$value = "%{$value}";
|
||||
break;
|
||||
case 'after':
|
||||
$value = "{$value}%";
|
||||
break;
|
||||
default:
|
||||
$value = "%{$value}%";
|
||||
break;
|
||||
}
|
||||
$this->_querys["LIKE"] = "{$column} LIKE '{$value}'";
|
||||
}
|
||||
final public function orderBy(string $column, string $direction = "DESC"): void
|
||||
{
|
||||
$this->_querys["ORDERBY"] = " ORDER BY {$column} {$direction}";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user