first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

52
class/class.Query.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
class Query
{
// SQL Query parts
public $fields = ' * ';
public $from = '';
public $where = ' 1 ';
public $order = '';
public $group = '';
public $having = '';
public $limit = '';
// Bound parameters
public $data = [];
public $types = [];
public function getQuery()
{
$query = "SELECT {$this->fields}\nFROM {$this->from}\nWHERE {$this->where}";
if ($this->group) {
$query .= "\nGROUP BY {$this->group}";
}
if ($this->order) {
$query .= "\nORDER BY {$this->order}";
}
if ($this->having) {
$query .= "\nHAVING {$this->having}";
}
if ($this->limit) {
$query .= "\nLIMIT {$this->limit}";
}
return $query;
}
public function execute()
{
$query = $this->getQuery();
return sqlQuery($query, $this->data, $this->types);
}
public function addData($data)
{
$this->data = array_merge($this->data, $data);
}
}