<?php
-use Friendica\Database\dba;
-
-function dbesc($str) {
- if (dba::$connected) {
- return(dba::escape($str));
- } else {
- return(str_replace("'","\\'",$str));
- }
-}
+use Friendica\Database\DBA;
/**
* @brief execute SQL query with printf style args - deprecated
*
* @param $args Query parameters (1 to N parameters of different types)
* @return array|bool Query array
+ * @deprecated
*/
function q($sql) {
$args = func_get_args();
unset($args[0]);
- if (!dba::$connected) {
+ if (!DBA::$connected) {
return false;
}
- $sql = dba::clean_query($sql);
- $sql = dba::any_value_fallback($sql);
+ $sql = DBA::cleanQuery($sql);
+ $sql = DBA::anyValueFallback($sql);
$stmt = @vsprintf($sql, $args);
- $ret = dba::p($stmt);
+ $ret = DBA::p($stmt);
if (is_bool($ret)) {
return $ret;
}
- $columns = dba::columnCount($ret);
+ $columns = DBA::columnCount($ret);
- $data = dba::inArray($ret);
+ $data = DBA::toArray($ret);
if ((count($data) == 0) && ($columns == 0)) {
return true;
return $data;
}
-
-function dba_timer() {
- return microtime(true);
-}