VENOM: Hardcode WIP (versustunez)
This commit is contained in:
parent
7b90160c48
commit
32a78ed1b9
21 changed files with 285 additions and 158 deletions
|
|
@ -71,4 +71,22 @@ class DatabaseHandler
|
|||
$stmt = $this->db->prepare($query);
|
||||
return $stmt->execute($args);
|
||||
}
|
||||
|
||||
// Returns a Select like this: SELECT id, name, ... FROM table || do what you want
|
||||
public static function createEasySelect(array $fields, string $table): string
|
||||
{
|
||||
return "SELECT " . implode(",", $fields) . " FROM " . $table;
|
||||
}
|
||||
|
||||
public static function getUpdateString(array $data, string $table, string $where): array
|
||||
{
|
||||
$string = [];
|
||||
$save = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$k = ":" . strtolower($key);
|
||||
$string[] = $key . "= " . $k;
|
||||
$save[$k] = $value;
|
||||
}
|
||||
return ["UPDATE " . $table . " SET " . implode(",", $string) . " " . $where, $save];
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,12 @@ use Venom\Venom;
|
|||
|
||||
interface Module
|
||||
{
|
||||
const NAME = "name";
|
||||
const AUTHOR = "author";
|
||||
const SECURE = "secure";
|
||||
const ROUTE = "routes";
|
||||
const DESC = "description";
|
||||
|
||||
public function register(Venom $venom): bool;
|
||||
|
||||
public function init(): void;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue