@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3function queryfx(AphrontDatabaseConnection $conn, $sql /* , ... */) {
4 $argv = func_get_args();
5 $query = call_user_func_array('qsprintf', $argv);
6
7 $conn->setLastActiveEpoch(time());
8 $conn->executeQuery($query);
9}
10
11function queryfx_all(AphrontDatabaseConnection $conn, $sql /* , ... */) {
12 $argv = func_get_args();
13 call_user_func_array('queryfx', $argv);
14 return $conn->selectAllResults();
15}
16
17function queryfx_one(AphrontDatabaseConnection $conn, $sql /* , ... */) {
18 $argv = func_get_args();
19 $ret = call_user_func_array('queryfx_all', $argv);
20 if (count($ret) > 1) {
21 throw new AphrontCountQueryException(
22 pht('Query returned more than one row.'));
23 } else if (count($ret)) {
24 return reset($ret);
25 }
26 return null;
27}