diff options
author | root <root@diekershoff.homeunix.net> | 2011-01-11 14:57:33 +0100 |
---|---|---|
committer | root <root@diekershoff.homeunix.net> | 2011-01-11 14:57:33 +0100 |
commit | e972375403bd019c58478c687443b8c8c68e55d9 (patch) | |
tree | 4430c8cb484faab37ddb91e350b8aa0d3eae7494 /include/dba.php | |
parent | b500f7ffac6214dd07ec315a52ec06455cce435f (diff) | |
parent | 9493c29810181408512096b5ee16c769ab1888b9 (diff) | |
download | volse-hubzilla-e972375403bd019c58478c687443b8c8c68e55d9.tar.gz volse-hubzilla-e972375403bd019c58478c687443b8c8c68e55d9.tar.bz2 volse-hubzilla-e972375403bd019c58478c687443b8c8c68e55d9.zip |
Merge branch 'master' of git://github.com/friendika/friendika
Diffstat (limited to 'include/dba.php')
-rw-r--r-- | include/dba.php | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/include/dba.php b/include/dba.php index ae3a4957b..e58abb1a1 100644 --- a/include/dba.php +++ b/include/dba.php @@ -46,7 +46,7 @@ class dba { elseif($result === true) $mesg = 'true'; else - $mesg = $result->num_rows.' results' . EOL; + $mesg = $result->num_rows . ' results' . EOL; $str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg . EOL; @@ -114,7 +114,10 @@ function dbg($state) { if(! function_exists('dbesc')) { function dbesc($str) { global $db; - return($db->escape($str)); + if($db) + return($db->escape($str)); + else + return(str_replace("'","\\'",$str)); }} @@ -129,11 +132,29 @@ function q($sql) { global $db; $args = func_get_args(); unset($args[0]); - $ret = $db->q(vsprintf($sql,$args)); - return $ret; + + if($db) { + $ret = $db->q(vsprintf($sql,$args)); + return $ret; + } + + /** + * + * This will happen occasionally trying to store the + * session data after abnormal program termination + * + */ + + logger('dba: no database: ' . print_r($args,true)); + return false; + }} -// raw db query, no arguments +/** + * + * Raw db query, no arguments + * + */ if(! function_exists('dbq')) { function dbq($sql) { |