]>
git.bts.cx Git - cx.git/blob - cx/lib/db.php
4 static $db = new SQLite3(CX_DATABASE_FILE
);
8 function _cx_db_sql_exec($sql, ...$args) {
10 $statement = $db->prepare($sql);
12 foreach ($args as $i => $arg) {
14 $statement->bindValue($idx, $arg);
17 return $statement->execute();
20 function cx_db_exec($sql, ...$args) {
21 _cx_db_sql_exec($sql, ...$args);
22 return _cx_db()->lastInsertRowID();
25 function cx_db_query($sql, ...$args) {
26 $result_set = _cx_db_sql_exec($sql, ...$args);
27 while ($result = $result_set->fetchArray()) {