Cheetah
db.inc.php
Go to the documentation of this file.
1 <?php
2 
8 require_once("header.inc.php");
9 require_once(CH_DIRECTORY_PATH_INC . 'utils.inc.php');
10 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbDb.php');
11 
18 
19 $GLOBALS['site']['title'] = getParam('site_title');
20 $GLOBALS['site']['email'] = getParam('site_email');
21 $GLOBALS['site']['email_notify'] = getParam('site_email_notify');
22 
23 date_default_timezone_set(getParam('site_timezone'));
24 $GLOBALS['MySQL']->setTimezone(getParam('site_timezone'));
25 
29 function db_list_tables()
30 {
31  return $GLOBALS['MySQL']->listTables();
32 }
33 
39 function db_res($query, $bindings = [])
40 {
41  return $GLOBALS['MySQL']->res($query, $bindings);
42 }
43 
47 function db_last_id()
48 {
49  return $GLOBALS['MySQL']->lastId();
50 }
51 
56 function db_affected_rows($oStmt = null)
57 {
58  return $GLOBALS['MySQL']->getAffectedRows($oStmt);
59 }
60 
66 function db_res_assoc_arr($query, $bindings = [])
67 {
68  return $GLOBALS['MySQL']->getAll($query, $bindings);
69 }
70 
76 function db_arr($query, $bindings = [])
77 {
78  return $GLOBALS['MySQL']->getRow($query, $bindings, PDO::FETCH_BOTH);
79 }
80 
86 function db_assoc_arr($query, $bindings = [])
87 {
88  return $GLOBALS['MySQL']->getRow($query, $bindings);
89 }
90 
98 function db_value($query, $bindings = [], $error_checking = true, $index = 0)
99 {
100  return $GLOBALS['MySQL']->getOne($query, $bindings, $index);
101 }
102 
109 function fill_array($res)
110 {
111  return $GLOBALS['MySQL']->fillArray($res, PDO::FETCH_BOTH);
112 }
113 
120 function fill_assoc_array($res)
121 {
122  return $GLOBALS['MySQL']->fillArray($res, PDO::FETCH_ASSOC);
123 }
124 
130 function getParam($sParamName, $bUseCache = true)
131 {
132  return $GLOBALS['MySQL']->getParam($sParamName, $bUseCache);
133 }
134 
140 {
141  return $GLOBALS['MySQL']->getOne("SELECT `desc` FROM `sys_options` WHERE `Name` = ?", [$sParamName]);
142 }
143 
150 {
151  return $GLOBALS['MySQL']->setParam($sParamName, $sParamValue);
152 }
db_assoc_arr
db_assoc_arr($query, $bindings=[])
Definition: db.inc.php:86
db_res_assoc_arr
db_res_assoc_arr($query, $bindings=[])
Definition: db.inc.php:66
db_list_tables
db_list_tables()
Definition: db.inc.php:29
php
$sParamValue
$sParamValue
Definition: actions.inc.php:16
db_arr
db_arr($query, $bindings=[])
Definition: db.inc.php:76
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
$sParamName
$sParamName
Definition: actions.inc.php:15
db_last_id
db_last_id()
Definition: db.inc.php:47
fill_array
fill_array($res)
Definition: db.inc.php:109
db_affected_rows
db_affected_rows($oStmt=null)
Definition: db.inc.php:56
$GLOBALS
$GLOBALS['MySQL']
Definition: db.inc.php:17
getParamDesc
getParamDesc($sParamName)
Definition: db.inc.php:139
fill_assoc_array
fill_assoc_array($res)
Definition: db.inc.php:120
setParam
setParam($sParamName, $sParamValue)
Definition: db.inc.php:149
db_res
db_res($query, $bindings=[])
Definition: db.inc.php:39
db_value
db_value($query, $bindings=[], $error_checking=true, $index=0)
Definition: db.inc.php:98
ChWsbDb\getInstance
static getInstance()
Definition: ChWsbDb.php:82