diff --git a/extdbms/lib/Core/Model.php b/extdbms/lib/Core/Model.php
index 142a53b..b2909e0 100644
--- a/extdbms/lib/Core/Model.php
+++ b/extdbms/lib/Core/Model.php
@@ -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
Query:" . $query . "\n
";
+ if ($this->_debug) {
+ echo "\n
Query:" . $query . "\n
";
+ }
$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}";