mirror of
https://github.com/friendica/friendica
synced 2024-11-18 23:03:40 +00:00
dc3d2d5988
* "dba" is now "DBA". This hadn't been respected at some places * Cleaning up unneeded stuff
44 lines
790 B
PHP
44 lines
790 B
PHP
<?php
|
|
|
|
use Friendica\Database\DBA;
|
|
|
|
/**
|
|
* @brief execute SQL query with printf style args - deprecated
|
|
*
|
|
* Please use the DBA:: functions instead:
|
|
* DBA::select, DBA::exists, DBA::insert
|
|
* DBA::delete, DBA::update, DBA::p, DBA::e
|
|
*
|
|
* @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) {
|
|
return false;
|
|
}
|
|
|
|
$sql = DBA::cleanQuery($sql);
|
|
$sql = DBA::anyValueFallback($sql);
|
|
|
|
$stmt = @vsprintf($sql, $args);
|
|
|
|
$ret = DBA::p($stmt);
|
|
|
|
if (is_bool($ret)) {
|
|
return $ret;
|
|
}
|
|
|
|
$columns = DBA::columnCount($ret);
|
|
|
|
$data = DBA::toArray($ret);
|
|
|
|
if ((count($data) == 0) && ($columns == 0)) {
|
|
return true;
|
|
}
|
|
|
|
return $data;
|
|
}
|