VENOM: Hardcode WIP (versustunez)

This commit is contained in:
engineerTrooper 2020-12-22 18:07:13 +01:00
commit 32a78ed1b9
21 changed files with 285 additions and 158 deletions

View file

@ -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];
}
}

View file

@ -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;