mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-02 03:32:42 +01:00
Continue making application fixes to Phabricator for changes to %Q semantics
Summary: Depends on D19789. Ref T13217. Continue updating things to use the new %Q-flavored conversions instead of smushing a bunch of strings together. Test Plan: Browsed around, far fewer errors. These changes are largely mechanical in nature. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13217 Differential Revision: https://secure.phabricator.com/D19790
This commit is contained in:
parent
98690ee326
commit
2f10d4adeb
12 changed files with 120 additions and 85 deletions
|
@ -809,15 +809,15 @@ final class PhabricatorAuthSessionEngine extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_selects) {
|
if ($cache_selects) {
|
||||||
$cache_selects = ', '.implode(', ', $cache_selects);
|
$cache_selects = qsprintf($conn, ', %LQ', $cache_selects);
|
||||||
} else {
|
} else {
|
||||||
$cache_selects = '';
|
$cache_selects = qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_joins) {
|
if ($cache_joins) {
|
||||||
$cache_joins = implode(' ', $cache_joins);
|
$cache_joins = qsprintf($conn, '%LJ', $cache_joins);
|
||||||
} else {
|
} else {
|
||||||
$cache_joins = '';
|
$cache_joins = qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($cache_selects, $cache_joins, $cache_map, $types_map);
|
return array($cache_selects, $cache_joins, $cache_map, $types_map);
|
||||||
|
|
|
@ -111,7 +111,7 @@ final class PhabricatorAuthSSHKeyQuery
|
||||||
$key->getType(),
|
$key->getType(),
|
||||||
$key->getHash());
|
$key->getHash());
|
||||||
}
|
}
|
||||||
$where[] = implode(' OR ', $sql);
|
$where[] = qsprintf($conn, '%LO', $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isActive !== null) {
|
if ($this->isActive !== null) {
|
||||||
|
|
|
@ -513,7 +513,6 @@ final class PhabricatorCalendarEventQuery
|
||||||
return 'PhabricatorCalendarApplication';
|
return 'PhabricatorCalendarApplication';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function willFilterPage(array $events) {
|
protected function willFilterPage(array $events) {
|
||||||
$instance_of_event_phids = array();
|
$instance_of_event_phids = array();
|
||||||
$recurring_events = array();
|
$recurring_events = array();
|
||||||
|
|
|
@ -453,7 +453,7 @@ final class DifferentialRevisionQuery
|
||||||
|
|
||||||
private function loadData() {
|
private function loadData() {
|
||||||
$table = $this->newResultObject();
|
$table = $this->newResultObject();
|
||||||
$conn_r = $table->establishConnection('r');
|
$conn = $table->establishConnection('r');
|
||||||
|
|
||||||
$selects = array();
|
$selects = array();
|
||||||
|
|
||||||
|
@ -469,13 +469,13 @@ final class DifferentialRevisionQuery
|
||||||
$this->authors = array_merge($basic_authors, $this->responsibles);
|
$this->authors = array_merge($basic_authors, $this->responsibles);
|
||||||
|
|
||||||
$this->reviewers = $basic_reviewers;
|
$this->reviewers = $basic_reviewers;
|
||||||
$selects[] = $this->buildSelectStatement($conn_r);
|
$selects[] = $this->buildSelectStatement($conn);
|
||||||
|
|
||||||
// Build the query where the responsible users are reviewers, or
|
// Build the query where the responsible users are reviewers, or
|
||||||
// projects they are members of are reviewers.
|
// projects they are members of are reviewers.
|
||||||
$this->authors = $basic_authors;
|
$this->authors = $basic_authors;
|
||||||
$this->reviewers = array_merge($basic_reviewers, $this->responsibles);
|
$this->reviewers = array_merge($basic_reviewers, $this->responsibles);
|
||||||
$selects[] = $this->buildSelectStatement($conn_r);
|
$selects[] = $this->buildSelectStatement($conn);
|
||||||
|
|
||||||
// Put everything back like it was.
|
// Put everything back like it was.
|
||||||
$this->authors = $basic_authors;
|
$this->authors = $basic_authors;
|
||||||
|
@ -486,21 +486,35 @@ final class DifferentialRevisionQuery
|
||||||
throw $ex;
|
throw $ex;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$selects[] = $this->buildSelectStatement($conn_r);
|
$selects[] = $this->buildSelectStatement($conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($selects) > 1) {
|
if (count($selects) > 1) {
|
||||||
|
$unions = null;
|
||||||
|
foreach ($selects as $select) {
|
||||||
|
if (!$unions) {
|
||||||
|
$unions = $select;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$unions = qsprintf(
|
||||||
|
$conn,
|
||||||
|
'%Q UNION DISTINCT %Q',
|
||||||
|
$unions,
|
||||||
|
$select);
|
||||||
|
}
|
||||||
|
|
||||||
$query = qsprintf(
|
$query = qsprintf(
|
||||||
$conn_r,
|
$conn,
|
||||||
'%Q %Q %Q',
|
'%Q %Q %Q',
|
||||||
implode(' UNION DISTINCT ', $selects),
|
$unions,
|
||||||
$this->buildOrderClause($conn_r, true),
|
$this->buildOrderClause($conn, true),
|
||||||
$this->buildLimitClause($conn_r));
|
$this->buildLimitClause($conn));
|
||||||
} else {
|
} else {
|
||||||
$query = head($selects);
|
$query = head($selects);
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryfx_all($conn_r, '%Q', $query);
|
return queryfx_all($conn, '%Q', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildSelectStatement(AphrontDatabaseConnection $conn_r) {
|
private function buildSelectStatement(AphrontDatabaseConnection $conn_r) {
|
||||||
|
|
|
@ -471,27 +471,28 @@ final class ManiphestTransactionEditor
|
||||||
// be worth evaluating is to use "CASE". Another approach is to disable
|
// be worth evaluating is to use "CASE". Another approach is to disable
|
||||||
// strict mode for this query.
|
// strict mode for this query.
|
||||||
|
|
||||||
$extra_columns = array(
|
$default_str = qsprintf($conn, '%s', '');
|
||||||
'phid' => '""',
|
$default_int = qsprintf($conn, '%d', 0);
|
||||||
'authorPHID' => '""',
|
|
||||||
'status' => '""',
|
|
||||||
'priority' => 0,
|
|
||||||
'title' => '""',
|
|
||||||
'description' => '""',
|
|
||||||
'dateCreated' => 0,
|
|
||||||
'dateModified' => 0,
|
|
||||||
'mailKey' => '""',
|
|
||||||
'viewPolicy' => '""',
|
|
||||||
'editPolicy' => '""',
|
|
||||||
'ownerOrdering' => '""',
|
|
||||||
'spacePHID' => '""',
|
|
||||||
'bridgedObjectPHID' => '""',
|
|
||||||
'properties' => '""',
|
|
||||||
'points' => 0,
|
|
||||||
'subtype' => '""',
|
|
||||||
);
|
|
||||||
|
|
||||||
$defaults = implode(', ', $extra_columns);
|
$extra_columns = array(
|
||||||
|
'phid' => $default_str,
|
||||||
|
'authorPHID' => $default_str,
|
||||||
|
'status' => $default_str,
|
||||||
|
'priority' => $default_int,
|
||||||
|
'title' => $default_str,
|
||||||
|
'description' => $default_str,
|
||||||
|
'dateCreated' => $default_int,
|
||||||
|
'dateModified' => $default_int,
|
||||||
|
'mailKey' => $default_str,
|
||||||
|
'viewPolicy' => $default_str,
|
||||||
|
'editPolicy' => $default_str,
|
||||||
|
'ownerOrdering' => $default_str,
|
||||||
|
'spacePHID' => $default_str,
|
||||||
|
'bridgedObjectPHID' => $default_str,
|
||||||
|
'properties' => $default_str,
|
||||||
|
'points' => $default_int,
|
||||||
|
'subtype' => $default_str,
|
||||||
|
);
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
|
@ -520,9 +521,9 @@ final class ManiphestTransactionEditor
|
||||||
|
|
||||||
$sql[] = qsprintf(
|
$sql[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'(%d, %Q, %f)',
|
'(%d, %LQ, %f)',
|
||||||
$id,
|
$id,
|
||||||
$defaults,
|
$extra_columns,
|
||||||
$subpriority);
|
$subpriority);
|
||||||
|
|
||||||
$offset++;
|
$offset++;
|
||||||
|
@ -531,10 +532,10 @@ final class ManiphestTransactionEditor
|
||||||
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
|
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
|
||||||
queryfx(
|
queryfx(
|
||||||
$conn,
|
$conn,
|
||||||
'INSERT INTO %T (id, %Q, subpriority) VALUES %LQ
|
'INSERT INTO %T (id, %LC, subpriority) VALUES %LQ
|
||||||
ON DUPLICATE KEY UPDATE subpriority = VALUES(subpriority)',
|
ON DUPLICATE KEY UPDATE subpriority = VALUES(subpriority)',
|
||||||
$task->getTableName(),
|
$task->getTableName(),
|
||||||
implode(', ', array_keys($extra_columns)),
|
array_keys($extra_columns),
|
||||||
$chunk);
|
$chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||||
|
|
||||||
$where = $this->buildWhereClause($conn);
|
$where = $this->buildWhereClause($conn);
|
||||||
|
|
||||||
$group_column = '';
|
$group_column = qsprintf($conn, '');
|
||||||
switch ($this->groupBy) {
|
switch ($this->groupBy) {
|
||||||
case self::GROUP_PROJECT:
|
case self::GROUP_PROJECT:
|
||||||
$group_column = qsprintf(
|
$group_column = qsprintf(
|
||||||
|
@ -601,10 +601,10 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$subclause) {
|
if (!$subclause) {
|
||||||
return '';
|
return qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return '('.implode(') OR (', $subclause).')';
|
return qsprintf($conn, '%LO', $subclause);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) {
|
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) {
|
||||||
|
@ -736,7 +736,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||||
return $joins;
|
return $joins;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
protected function buildGroupClause(AphrontDatabaseConnection $conn) {
|
||||||
$joined_multiple_rows =
|
$joined_multiple_rows =
|
||||||
($this->hasOpenParents !== null) ||
|
($this->hasOpenParents !== null) ||
|
||||||
($this->hasOpenSubtasks !== null) ||
|
($this->hasOpenSubtasks !== null) ||
|
||||||
|
@ -750,13 +750,13 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||||
// task IDs.
|
// task IDs.
|
||||||
if ($joined_multiple_rows) {
|
if ($joined_multiple_rows) {
|
||||||
if ($joined_project_name) {
|
if ($joined_project_name) {
|
||||||
return 'GROUP BY task.phid, projectGroup.dst';
|
return qsprintf($conn, 'GROUP BY task.phid, projectGroup.dst');
|
||||||
} else {
|
} else {
|
||||||
return 'GROUP BY task.phid';
|
return qsprintf($conn, 'GROUP BY task.phid');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -663,9 +663,9 @@ final class PhabricatorUser
|
||||||
if ($sql) {
|
if ($sql) {
|
||||||
queryfx(
|
queryfx(
|
||||||
$conn_w,
|
$conn_w,
|
||||||
'INSERT INTO %T (userID, token) VALUES %Q',
|
'INSERT INTO %T (userID, token) VALUES %LQ',
|
||||||
$table,
|
$table,
|
||||||
implode(', ', $sql));
|
$sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -557,8 +557,14 @@ final class PhabricatorDatabaseRef
|
||||||
$conn = $this->newManagementConnection();
|
$conn = $this->newManagementConnection();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$value = queryfx_one($conn, 'SELECT @@%Q', $key);
|
$value = queryfx_one($conn, 'SELECT @@%C', $key);
|
||||||
$value = $value['@@'.$key];
|
|
||||||
|
// NOTE: Although MySQL allows us to escape configuration values as if
|
||||||
|
// they are column names, the escaping is included in the column name
|
||||||
|
// of the return value: if we select "@@`x`", we get back a column named
|
||||||
|
// "@@`x`", not "@@x" as we might expect.
|
||||||
|
$value = head($value);
|
||||||
|
|
||||||
} catch (AphrontQueryException $ex) {
|
} catch (AphrontQueryException $ex) {
|
||||||
$value = null;
|
$value = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,13 +275,13 @@ final class PhabricatorEdgeEditor extends Phobject {
|
||||||
$conn_w->openTransaction();
|
$conn_w->openTransaction();
|
||||||
$this->openTransactions[] = $conn_w;
|
$this->openTransactions[] = $conn_w;
|
||||||
|
|
||||||
foreach (array_chunk($sql, 256) as $chunk) {
|
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
|
||||||
queryfx(
|
queryfx(
|
||||||
$conn_w,
|
$conn_w,
|
||||||
'INSERT INTO %T (src, type, dst, dateCreated, seq, dataID)
|
'INSERT INTO %T (src, type, dst, dateCreated, seq, dataID)
|
||||||
VALUES %Q ON DUPLICATE KEY UPDATE dataID = VALUES(dataID)',
|
VALUES %LQ ON DUPLICATE KEY UPDATE dataID = VALUES(dataID)',
|
||||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||||
implode(', ', $chunk));
|
$chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,9 +320,9 @@ final class PhabricatorEdgeEditor extends Phobject {
|
||||||
foreach (array_chunk($sql, 256) as $chunk) {
|
foreach (array_chunk($sql, 256) as $chunk) {
|
||||||
queryfx(
|
queryfx(
|
||||||
$conn_w,
|
$conn_w,
|
||||||
'DELETE FROM %T WHERE (%Q)',
|
'DELETE FROM %T WHERE %LO',
|
||||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||||
implode(' OR ', $chunk));
|
$chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,11 +322,11 @@ final class PhabricatorEdgeQuery extends PhabricatorQuery {
|
||||||
/**
|
/**
|
||||||
* @task internal
|
* @task internal
|
||||||
*/
|
*/
|
||||||
private function buildOrderClause($conn_r) {
|
private function buildOrderClause(AphrontDatabaseConnection $conn) {
|
||||||
if ($this->order == self::ORDER_NEWEST_FIRST) {
|
if ($this->order == self::ORDER_NEWEST_FIRST) {
|
||||||
return 'ORDER BY edge.dateCreated DESC, edge.seq DESC';
|
return qsprintf($conn, 'ORDER BY edge.dateCreated DESC, edge.seq DESC');
|
||||||
} else {
|
} else {
|
||||||
return 'ORDER BY edge.dateCreated ASC, edge.seq ASC';
|
return qsprintf($conn, 'ORDER BY edge.dateCreated ASC, edge.seq ASC');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,12 +123,19 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
AphrontDatabaseConnection $conn,
|
AphrontDatabaseConnection $conn,
|
||||||
$table_name) {
|
$table_name) {
|
||||||
|
|
||||||
|
$table_alias = $this->getPrimaryTableAlias();
|
||||||
|
if ($table_alias === null) {
|
||||||
|
$table_alias = qsprintf($conn, '');
|
||||||
|
} else {
|
||||||
|
$table_alias = qsprintf($conn, '%T', $table_alias);
|
||||||
|
}
|
||||||
|
|
||||||
return qsprintf(
|
return qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'%Q FROM %T %Q %Q %Q %Q %Q %Q %Q',
|
'%Q FROM %T %Q %Q %Q %Q %Q %Q %Q',
|
||||||
$this->buildSelectClause($conn),
|
$this->buildSelectClause($conn),
|
||||||
$table_name,
|
$table_name,
|
||||||
(string)$this->getPrimaryTableAlias(),
|
$table_alias,
|
||||||
$this->buildJoinClause($conn),
|
$this->buildJoinClause($conn),
|
||||||
$this->buildWhereClause($conn),
|
$this->buildWhereClause($conn),
|
||||||
$this->buildGroupClause($conn),
|
$this->buildGroupClause($conn),
|
||||||
|
@ -425,7 +432,7 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
} else {
|
} else {
|
||||||
// No paging is being applied to this query so we do not need to
|
// No paging is being applied to this query so we do not need to
|
||||||
// construct a paging clause.
|
// construct a paging clause.
|
||||||
return '';
|
return qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$keys = array();
|
$keys = array();
|
||||||
|
@ -655,24 +662,16 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
$conn,
|
$conn,
|
||||||
'%Q %Q %Q',
|
'%Q %Q %Q',
|
||||||
$field,
|
$field,
|
||||||
$reverse ? '>' : '<',
|
$reverse ? qsprintf($conn, '>') : qsprintf($conn, '<'),
|
||||||
$value);
|
$value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parts) {
|
if ($parts) {
|
||||||
if (count($parts) > 1) {
|
$clause[] = qsprintf($conn, '%LO', $parts);
|
||||||
$clause[] = '('.implode(') OR (', $parts).')';
|
|
||||||
} else {
|
|
||||||
$clause[] = head($parts);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($clause) {
|
if ($clause) {
|
||||||
if (count($clause) > 1) {
|
$clauses[] = qsprintf($conn, '%LA', $clause);
|
||||||
$clauses[] = '('.implode(') AND (', $clause).')';
|
|
||||||
} else {
|
|
||||||
$clauses[] = head($clause);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
|
@ -689,7 +688,11 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '('.implode(') OR (', $clauses).')';
|
if ($clauses) {
|
||||||
|
return qsprintf($conn, '%LO', $clauses);
|
||||||
|
}
|
||||||
|
|
||||||
|
return qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1315,7 +1318,7 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
return qsprintf(
|
return qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'GROUP BY %Q',
|
'GROUP BY %Q',
|
||||||
$this->getApplicationSearchObjectPHIDColumn());
|
$this->getApplicationSearchObjectPHIDColumn($conn));
|
||||||
} else {
|
} else {
|
||||||
return qsprintf($conn, '');
|
return qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
@ -1339,16 +1342,16 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
$alias = $constraint['alias'];
|
$alias = $constraint['alias'];
|
||||||
$index = $constraint['index'];
|
$index = $constraint['index'];
|
||||||
$cond = $constraint['cond'];
|
$cond = $constraint['cond'];
|
||||||
$phid_column = $this->getApplicationSearchObjectPHIDColumn();
|
$phid_column = $this->getApplicationSearchObjectPHIDColumn($conn);
|
||||||
switch ($cond) {
|
switch ($cond) {
|
||||||
case '=':
|
case '=':
|
||||||
// Figure out whether we need to do a LEFT JOIN or not. We need to
|
// Figure out whether we need to do a LEFT JOIN or not. We need to
|
||||||
// LEFT JOIN if we're going to select "IS NULL" rows.
|
// LEFT JOIN if we're going to select "IS NULL" rows.
|
||||||
$join_type = 'JOIN';
|
$join_type = qsprintf($conn, 'JOIN');
|
||||||
foreach ($constraint['constraints'] as $query_constraint) {
|
foreach ($constraint['constraints'] as $query_constraint) {
|
||||||
$op = $query_constraint->getOperator();
|
$op = $query_constraint->getOperator();
|
||||||
if ($op === PhabricatorQueryConstraint::OPERATOR_NULL) {
|
if ($op === PhabricatorQueryConstraint::OPERATOR_NULL) {
|
||||||
$join_type = 'LEFT JOIN';
|
$join_type = qsprintf($conn, 'LEFT JOIN');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2437,9 +2440,9 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
// this to a LEFT join. We'll use WHERE to select matching rows
|
// this to a LEFT join. We'll use WHERE to select matching rows
|
||||||
// later.
|
// later.
|
||||||
if ($has_null) {
|
if ($has_null) {
|
||||||
$join_type = 'LEFT';
|
$join_type = qsprintf($conn, 'LEFT');
|
||||||
} else {
|
} else {
|
||||||
$join_type = '';
|
$join_type = qsprintf($conn, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$joins[] = qsprintf(
|
$joins[] = qsprintf(
|
||||||
|
@ -2912,7 +2915,7 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
if ($alias) {
|
if ($alias) {
|
||||||
$col = qsprintf($conn, '%T.spacePHID', $alias);
|
$col = qsprintf($conn, '%T.spacePHID', $alias);
|
||||||
} else {
|
} else {
|
||||||
$col = 'spacePHID';
|
$col = qsprintf($conn, 'spacePHID');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($space_phids && $include_null) {
|
if ($space_phids && $include_null) {
|
||||||
|
|
|
@ -1149,11 +1149,10 @@ abstract class LiskDAO extends Phobject
|
||||||
$map[$key] = qsprintf($conn, '%C = %ns', $key, $value);
|
$map[$key] = qsprintf($conn, '%C = %ns', $key, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$map = implode(', ', $map);
|
|
||||||
|
|
||||||
$id = $this->getID();
|
$id = $this->getID();
|
||||||
$conn->query(
|
$conn->query(
|
||||||
'UPDATE %R SET %Q WHERE %C = '.(is_int($id) ? '%d' : '%s'),
|
'UPDATE %R SET %LQ WHERE %C = '.(is_int($id) ? '%d' : '%s'),
|
||||||
$this,
|
$this,
|
||||||
$map,
|
$map,
|
||||||
$this->getIDKeyForUse(),
|
$this->getIDKeyForUse(),
|
||||||
|
@ -1255,11 +1254,24 @@ abstract class LiskDAO extends Phobject
|
||||||
$parameter_exception);
|
$parameter_exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data = implode(', ', $data);
|
|
||||||
|
switch ($mode) {
|
||||||
|
case 'INSERT':
|
||||||
|
$verb = qsprintf($conn, 'INSERT');
|
||||||
|
break;
|
||||||
|
case 'REPLACE':
|
||||||
|
$verb = qsprintf($conn, 'REPLACE');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Insert mode verb "%s" is not recognized, use INSERT or REPLACE.',
|
||||||
|
$mode));
|
||||||
|
}
|
||||||
|
|
||||||
$conn->query(
|
$conn->query(
|
||||||
'%Q INTO %R (%LC) VALUES (%Q)',
|
'%Q INTO %R (%LC) VALUES (%LQ)',
|
||||||
$mode,
|
$verb,
|
||||||
$this,
|
$this,
|
||||||
$columns,
|
$columns,
|
||||||
$data);
|
$data);
|
||||||
|
|
Loading…
Reference in a new issue