Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14230669
D19789.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
77 KB
Referenced Files
None
Subscribers
None
D19789.diff
View Options
diff --git a/src/applications/auth/query/PhabricatorAuthInviteQuery.php b/src/applications/auth/query/PhabricatorAuthInviteQuery.php
--- a/src/applications/auth/query/PhabricatorAuthInviteQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthInviteQuery.php
@@ -59,26 +59,26 @@
return $invites;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->emailAddresses !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'emailAddress IN (%Ls)',
$this->emailAddresses);
}
@@ -90,21 +90,21 @@
}
$where[] = qsprintf(
- $conn_r,
+ $conn,
'verificationHash IN (%Ls)',
$hashes);
}
if ($this->authorPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'authorPHID IN (%Ls)',
$this->authorPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
--- a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
@@ -54,26 +54,26 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
- if ($this->providerClasses) {
+ if ($this->providerClasses !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'providerClass IN (%Ls)',
$this->providerClasses);
}
@@ -84,16 +84,16 @@
break;
case self::STATUS_ENABLED:
$where[] = qsprintf(
- $conn_r,
+ $conn,
'isEnabled = 1');
break;
default:
throw new Exception(pht("Unknown status '%s'!", $status));
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/auth/query/PhabricatorAuthSessionQuery.php b/src/applications/auth/query/PhabricatorAuthSessionQuery.php
--- a/src/applications/auth/query/PhabricatorAuthSessionQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthSessionQuery.php
@@ -65,44 +65,44 @@
return $sessions;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
- if ($this->identityPHIDs) {
+ if ($this->identityPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'userPHID IN (%Ls)',
$this->identityPHIDs);
}
- if ($this->sessionKeys) {
+ if ($this->sessionKeys !== null) {
$hashes = array();
foreach ($this->sessionKeys as $session_key) {
$hashes[] = PhabricatorHash::weakDigest($session_key);
}
$where[] = qsprintf(
- $conn_r,
+ $conn,
'sessionKey IN (%Ls)',
$hashes);
}
- if ($this->sessionTypes) {
+ if ($this->sessionTypes !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'type IN (%Ls)',
$this->sessionTypes);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventInviteeQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventInviteeQuery.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventInviteeQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventInviteeQuery.php
@@ -49,47 +49,47 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->eventPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'eventPHID IN (%Ls)',
$this->eventPHIDs);
}
if ($this->inviteePHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'inviteePHID IN (%Ls)',
$this->inviteePHIDs);
}
if ($this->inviterPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'inviterPHID IN (%Ls)',
$this->inviterPHIDs);
}
if ($this->statuses !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'status = %d',
$this->statuses);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
@@ -509,10 +509,6 @@
return parent::shouldGroupQueryResultRows();
}
- protected function getApplicationSearchObjectPHIDColumn() {
- return 'event.phid';
- }
-
public function getQueryApplicationClass() {
return 'PhabricatorCalendarApplication';
}
diff --git a/src/applications/chatlog/query/PhabricatorChatLogChannelQuery.php b/src/applications/chatlog/query/PhabricatorChatLogChannelQuery.php
--- a/src/applications/chatlog/query/PhabricatorChatLogChannelQuery.php
+++ b/src/applications/chatlog/query/PhabricatorChatLogChannelQuery.php
@@ -33,14 +33,14 @@
return $logs;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
if ($this->channelIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->channelIDs);
@@ -48,12 +48,12 @@
if ($this->channels) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'channelName IN (%Ls)',
$this->channels);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/chatlog/query/PhabricatorChatLogQuery.php b/src/applications/chatlog/query/PhabricatorChatLogQuery.php
--- a/src/applications/chatlog/query/PhabricatorChatLogQuery.php
+++ b/src/applications/chatlog/query/PhabricatorChatLogQuery.php
@@ -55,26 +55,26 @@
return $events;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- if ($this->maximumEpoch) {
+ if ($this->maximumEpoch !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'epoch <= %d',
$this->maximumEpoch);
}
- if ($this->channelIDs) {
+ if ($this->channelIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'channelID IN (%Ld)',
$this->channelIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/config/query/PhabricatorConfigEntryQuery.php b/src/applications/config/query/PhabricatorConfigEntryQuery.php
--- a/src/applications/config/query/PhabricatorConfigEntryQuery.php
+++ b/src/applications/config/query/PhabricatorConfigEntryQuery.php
@@ -31,26 +31,26 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/conpherence/query/ConpherenceFulltextQuery.php b/src/applications/conpherence/query/ConpherenceFulltextQuery.php
--- a/src/applications/conpherence/query/ConpherenceFulltextQuery.php
+++ b/src/applications/conpherence/query/ConpherenceFulltextQuery.php
@@ -38,19 +38,19 @@
return $rows;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->threadPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'i.threadPHID IN (%Ls)',
$this->threadPHIDs);
}
if ($this->previousTransactionPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'i.previousTransactionPHID IN (%Ls)',
$this->previousTransactionPHIDs);
}
@@ -61,12 +61,12 @@
$compiled_query = $compiler->compileQuery($tokens);
$where[] = qsprintf(
- $conn_r,
+ $conn,
'MATCH(i.corpus) AGAINST (%s IN BOOLEAN MODE)',
$compiled_query);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function buildOrderByClause(AphrontDatabaseConnection $conn_r) {
diff --git a/src/applications/conpherence/query/ConpherenceParticipantCountQuery.php b/src/applications/conpherence/query/ConpherenceParticipantCountQuery.php
--- a/src/applications/conpherence/query/ConpherenceParticipantCountQuery.php
+++ b/src/applications/conpherence/query/ConpherenceParticipantCountQuery.php
@@ -57,7 +57,7 @@
}
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function buildGroupByClause(AphrontDatabaseConnection $conn) {
diff --git a/src/applications/conpherence/query/ConpherenceParticipantQuery.php b/src/applications/conpherence/query/ConpherenceParticipantQuery.php
--- a/src/applications/conpherence/query/ConpherenceParticipantQuery.php
+++ b/src/applications/conpherence/query/ConpherenceParticipantQuery.php
@@ -38,7 +38,7 @@
$this->participantPHIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function buildOrderClause(AphrontDatabaseConnection $conn) {
diff --git a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php
--- a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php
+++ b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php
@@ -124,46 +124,47 @@
return $daemons;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->notIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id NOT IN (%Ld)',
$this->notIDs);
}
if ($this->getStatusConstants()) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'status IN (%Ls)',
$this->getStatusConstants());
}
if ($this->daemonClasses !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'daemon IN (%Ls)',
$this->daemonClasses);
}
if ($this->daemonIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'daemonID IN (%Ls)',
$this->daemonIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
- return $this->formatWhereClause($where);
+ $where[] = $this->buildPagingClause($conn);
+
+ return $this->formatWhereClause($conn, $where);
}
private function getStatusConstants() {
diff --git a/src/applications/differential/query/DifferentialInlineCommentQuery.php b/src/applications/differential/query/DifferentialInlineCommentQuery.php
--- a/src/applications/differential/query/DifferentialInlineCommentQuery.php
+++ b/src/applications/differential/query/DifferentialInlineCommentQuery.php
@@ -107,31 +107,31 @@
return head($this->execute());
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
// Only find inline comments.
$where[] = qsprintf(
- $conn_r,
+ $conn,
'changesetID IS NOT NULL');
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->revisionPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'revisionPHID IN (%Ls)',
$this->revisionPHIDs);
}
@@ -139,28 +139,28 @@
if ($this->drafts === null) {
if ($this->deletedDrafts) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'(authorPHID = %s) OR (transactionPHID IS NOT NULL)',
$this->getViewer()->getPHID());
} else {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'(authorPHID = %s AND isDeleted = 0)
OR (transactionPHID IS NOT NULL)',
$this->getViewer()->getPHID());
}
} else if ($this->drafts) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'(authorPHID = %s AND isDeleted = 0) AND (transactionPHID IS NULL)',
$this->getViewer()->getPHID());
} else {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'transactionPHID IS NOT NULL');
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function adjustInlinesForChangesets(
diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php
--- a/src/applications/differential/query/DifferentialRevisionQuery.php
+++ b/src/applications/differential/query/DifferentialRevisionQuery.php
@@ -542,26 +542,26 @@
/**
* @task internal
*/
- private function buildJoinsClause($conn_r) {
+ private function buildJoinsClause(AphrontDatabaseConnection $conn) {
$joins = array();
if ($this->pathIDs) {
$path_table = new DifferentialAffectedPath();
$joins[] = qsprintf(
- $conn_r,
+ $conn,
'JOIN %T p ON p.revisionID = r.id',
$path_table->getTableName());
}
if ($this->commitHashes) {
$joins[] = qsprintf(
- $conn_r,
+ $conn,
'JOIN %T hash_rel ON hash_rel.revisionID = r.id',
ArcanistDifferentialRevisionHash::TABLE_NAME);
}
if ($this->ccs) {
$joins[] = qsprintf(
- $conn_r,
+ $conn,
'JOIN %T e_ccs ON e_ccs.src = r.phid '.
'AND e_ccs.type = %s '.
'AND e_ccs.dst in (%Ls)',
@@ -572,7 +572,7 @@
if ($this->reviewers) {
$joins[] = qsprintf(
- $conn_r,
+ $conn,
'JOIN %T reviewer ON reviewer.revisionPHID = r.phid
AND reviewer.reviewerStatus != %s
AND reviewer.reviewerPHID in (%Ls)',
@@ -583,7 +583,7 @@
if ($this->draftAuthors) {
$joins[] = qsprintf(
- $conn_r,
+ $conn,
'JOIN %T has_draft ON has_draft.srcPHID = r.phid
AND has_draft.type = %s
AND has_draft.dstPHID IN (%Ls)',
@@ -594,21 +594,21 @@
if ($this->commitPHIDs) {
$joins[] = qsprintf(
- $conn_r,
+ $conn,
'JOIN %T commits ON commits.revisionID = r.id',
DifferentialRevision::TABLE_COMMIT);
}
- $joins[] = $this->buildJoinClauseParts($conn_r);
+ $joins[] = $this->buildJoinClauseParts($conn);
- return $this->formatJoinClause($joins);
+ return $this->formatJoinClause($conn, $joins);
}
/**
* @task internal
*/
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->pathIDs) {
@@ -616,32 +616,32 @@
$repo_info = igroup($this->pathIDs, 'repositoryID');
foreach ($repo_info as $repository_id => $paths) {
$path_clauses[] = qsprintf(
- $conn_r,
+ $conn,
'(p.repositoryID = %d AND p.pathID IN (%Ld))',
$repository_id,
ipull($paths, 'pathID'));
}
- $path_clauses = '('.implode(' OR ', $path_clauses).')';
+ $path_clauses = qsprintf($conn, '%LO', $path_clauses);
$where[] = $path_clauses;
}
if ($this->authors) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.authorPHID IN (%Ls)',
$this->authors);
}
if ($this->revIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.id IN (%Ld)',
$this->revIDs);
}
if ($this->repositoryPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.repositoryPHID IN (%Ls)',
$this->repositoryPHIDs);
}
@@ -651,67 +651,67 @@
foreach ($this->commitHashes as $info) {
list($type, $hash) = $info;
$hash_clauses[] = qsprintf(
- $conn_r,
+ $conn,
'(hash_rel.type = %s AND hash_rel.hash = %s)',
$type,
$hash);
}
- $hash_clauses = '('.implode(' OR ', $hash_clauses).')';
+ $hash_clauses = qsprintf($conn, '%LO', $hash_clauses);
$where[] = $hash_clauses;
}
if ($this->commitPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'commits.commitPHID IN (%Ls)',
$this->commitPHIDs);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.phid IN (%Ls)',
$this->phids);
}
if ($this->branches) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.branchName in (%Ls)',
$this->branches);
}
if ($this->updatedEpochMin !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.dateModified >= %d',
$this->updatedEpochMin);
}
if ($this->updatedEpochMax !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.dateModified <= %d',
$this->updatedEpochMax);
}
if ($this->createdEpochMin !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.dateCreated >= %d',
$this->createdEpochMin);
}
if ($this->createdEpochMax !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.dateCreated <= %d',
$this->createdEpochMax);
}
if ($this->statuses !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.status in (%Ls)',
$this->statuses);
}
@@ -725,13 +725,14 @@
DifferentialLegacyQuery::STATUS_CLOSED);
}
$where[] = qsprintf(
- $conn_r,
+ $conn,
'r.status in (%Ls)',
$statuses);
}
- $where[] = $this->buildWhereClauseParts($conn_r);
- return $this->formatWhereClause($where);
+ $where[] = $this->buildWhereClauseParts($conn);
+
+ return $this->formatWhereClause($conn, $where);
}
diff --git a/src/applications/diffusion/query/DiffusionLintCountQuery.php b/src/applications/diffusion/query/DiffusionLintCountQuery.php
--- a/src/applications/diffusion/query/DiffusionLintCountQuery.php
+++ b/src/applications/diffusion/query/DiffusionLintCountQuery.php
@@ -70,7 +70,7 @@
}
protected function buildCustomWhereClause(
- AphrontDatabaseConnection $conn_r,
+ AphrontDatabaseConnection $conn,
$part) {
$where = array();
@@ -79,19 +79,19 @@
if ($this->codes !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'code IN (%Ls)',
$this->codes);
}
if ($this->branchIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'branchID IN (%Ld)',
$this->branchIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function processPaths() {
diff --git a/src/applications/diffusion/query/DiffusionSymbolQuery.php b/src/applications/diffusion/query/DiffusionSymbolQuery.php
--- a/src/applications/diffusion/query/DiffusionSymbolQuery.php
+++ b/src/applications/diffusion/query/DiffusionSymbolQuery.php
@@ -192,52 +192,52 @@
/**
* @task internal
*/
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if (isset($this->context)) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'symbolContext = %s',
$this->context);
}
if ($this->name) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'symbolName = %s',
$this->name);
}
if ($this->namePrefix) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'symbolName LIKE %>',
$this->namePrefix);
}
if ($this->repositoryPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'repositoryPHID IN (%Ls)',
$this->repositoryPHIDs);
}
if ($this->language) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'symbolLanguage = %s',
$this->language);
}
if ($this->type) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'symbolType = %s',
$this->type);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
diff --git a/src/applications/diviner/query/DivinerAtomQuery.php b/src/applications/diviner/query/DivinerAtomQuery.php
--- a/src/applications/diviner/query/DivinerAtomQuery.php
+++ b/src/applications/diviner/query/DivinerAtomQuery.php
@@ -299,40 +299,40 @@
return $atoms;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->bookPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'bookPHID IN (%Ls)',
$this->bookPHIDs);
}
if ($this->types) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'type IN (%Ls)',
$this->types);
}
if ($this->names) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'name IN (%Ls)',
$this->names);
}
@@ -347,7 +347,7 @@
}
$where[] = qsprintf(
- $conn_r,
+ $conn,
'titleSlugHash in (%Ls)',
$hashes);
}
@@ -366,46 +366,46 @@
if ($contexts && $with_null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'context IN (%Ls) OR context IS NULL',
$contexts);
} else if ($contexts) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'context IN (%Ls)',
$contexts);
} else if ($with_null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'context IS NULL');
}
}
if ($this->indexes) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'atomIndex IN (%Ld)',
$this->indexes);
}
if ($this->isDocumentable !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'isDocumentable = %d',
(int)$this->isDocumentable);
}
if ($this->isGhost !== null) {
if ($this->isGhost) {
- $where[] = qsprintf($conn_r, 'graphHash IS NULL');
+ $where[] = qsprintf($conn, 'graphHash IS NULL');
} else {
- $where[] = qsprintf($conn_r, 'graphHash IS NOT NULL');
+ $where[] = qsprintf($conn, 'graphHash IS NOT NULL');
}
}
if ($this->nodeHashes) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'nodeHash IN (%Ls)',
$this->nodeHashes);
}
@@ -415,21 +415,21 @@
// the column has binary collation. Eventually, this should move into
// fulltext.
$where[] = qsprintf(
- $conn_r,
+ $conn,
'CONVERT(name USING utf8) LIKE %~',
$this->nameContains);
}
if ($this->repositoryPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'repositoryPHID IN (%Ls)',
$this->repositoryPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
/**
diff --git a/src/applications/diviner/query/DivinerBookQuery.php b/src/applications/diviner/query/DivinerBookQuery.php
--- a/src/applications/diviner/query/DivinerBookQuery.php
+++ b/src/applications/diviner/query/DivinerBookQuery.php
@@ -116,54 +116,54 @@
return $books;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if (strlen($this->nameLike)) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'name LIKE %~',
$this->nameLike);
}
if ($this->names !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'name IN (%Ls)',
$this->names);
}
if (strlen($this->namePrefix)) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'name LIKE %>',
$this->namePrefix);
}
if ($this->repositoryPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'repositoryPHID IN (%Ls)',
$this->repositoryPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/files/query/PhabricatorFileChunkQuery.php b/src/applications/files/query/PhabricatorFileChunkQuery.php
--- a/src/applications/files/query/PhabricatorFileChunkQuery.php
+++ b/src/applications/files/query/PhabricatorFileChunkQuery.php
@@ -86,26 +86,26 @@
return $chunks;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->chunkHandles !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'chunkHandle IN (%Ls)',
$this->chunkHandles);
}
if ($this->rangeStart !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'byteEnd > %d',
$this->rangeStart);
}
if ($this->rangeEnd !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'byteStart < %d',
$this->rangeEnd);
}
@@ -113,18 +113,18 @@
if ($this->isComplete !== null) {
if ($this->isComplete) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'dataFilePHID IS NOT NULL');
} else {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'dataFilePHID IS NULL');
}
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/flag/query/PhabricatorFlagQuery.php b/src/applications/flag/query/PhabricatorFlagQuery.php
--- a/src/applications/flag/query/PhabricatorFlagQuery.php
+++ b/src/applications/flag/query/PhabricatorFlagQuery.php
@@ -123,40 +123,40 @@
return $flags;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ownerPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'flag.ownerPHID IN (%Ls)',
$this->ownerPHIDs);
}
if ($this->types) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'flag.type IN (%Ls)',
$this->types);
}
if ($this->objectPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'flag.objectPHID IN (%Ls)',
$this->objectPHIDs);
}
if ($this->colors) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'flag.color IN (%Ld)',
$this->colors);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/fund/query/FundBackerQuery.php b/src/applications/fund/query/FundBackerQuery.php
--- a/src/applications/fund/query/FundBackerQuery.php
+++ b/src/applications/fund/query/FundBackerQuery.php
@@ -68,47 +68,47 @@
return $backers;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->initiativePHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'initiativePHID IN (%Ls)',
$this->initiativePHIDs);
}
if ($this->backerPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'backerPHID IN (%Ls)',
$this->backerPHIDs);
}
if ($this->statuses !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'status IN (%Ls)',
$this->statuses);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/herald/query/HeraldRuleQuery.php b/src/applications/herald/query/HeraldRuleQuery.php
--- a/src/applications/herald/query/HeraldRuleQuery.php
+++ b/src/applications/herald/query/HeraldRuleQuery.php
@@ -175,68 +175,68 @@
return $rules;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.phid IN (%Ls)',
$this->phids);
}
if ($this->authorPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.authorPHID IN (%Ls)',
$this->authorPHIDs);
}
if ($this->ruleTypes) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.ruleType IN (%Ls)',
$this->ruleTypes);
}
if ($this->contentTypes) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.contentType IN (%Ls)',
$this->contentTypes);
}
if ($this->disabled !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.isDisabled = %d',
(int)$this->disabled);
}
if ($this->datasourceQuery) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.name LIKE %>',
$this->datasourceQuery);
}
if ($this->triggerObjectPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'rule.triggerObjectPHID IN (%Ls)',
$this->triggerObjectPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function validateRuleAuthors(array $rules) {
diff --git a/src/applications/herald/query/HeraldTranscriptQuery.php b/src/applications/herald/query/HeraldTranscriptQuery.php
--- a/src/applications/herald/query/HeraldTranscriptQuery.php
+++ b/src/applications/herald/query/HeraldTranscriptQuery.php
@@ -91,33 +91,33 @@
return $transcripts;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->objectPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'objectPHID in (%Ls)',
$this->objectPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/legalpad/query/LegalpadDocumentSignatureQuery.php b/src/applications/legalpad/query/LegalpadDocumentSignatureQuery.php
--- a/src/applications/legalpad/query/LegalpadDocumentSignatureQuery.php
+++ b/src/applications/legalpad/query/LegalpadDocumentSignatureQuery.php
@@ -86,61 +86,61 @@
return $signatures;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->documentPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'documentPHID IN (%Ls)',
$this->documentPHIDs);
}
if ($this->signerPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'signerPHID IN (%Ls)',
$this->signerPHIDs);
}
if ($this->documentVersions !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'documentVersion IN (%Ld)',
$this->documentVersions);
}
if ($this->secretKeys !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'secretKey IN (%Ls)',
$this->secretKeys);
}
if ($this->nameContains !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'signerName LIKE %~',
$this->nameContains);
}
if ($this->emailContains !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'signerEmail LIKE %~',
$this->emailContains);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerClientQuery.php b/src/applications/oauthserver/query/PhabricatorOAuthServerClientQuery.php
--- a/src/applications/oauthserver/query/PhabricatorOAuthServerClientQuery.php
+++ b/src/applications/oauthserver/query/PhabricatorOAuthServerClientQuery.php
@@ -37,33 +37,33 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->creatorPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'creatorPHID IN (%Ls)',
$this->creatorPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/phlux/query/PhluxVariableQuery.php b/src/applications/phlux/query/PhluxVariableQuery.php
--- a/src/applications/phlux/query/PhluxVariableQuery.php
+++ b/src/applications/phlux/query/PhluxVariableQuery.php
@@ -37,33 +37,33 @@
return $table->loadAllFromArray($rows);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->keys !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'variableKey IN (%Ls)',
$this->keys);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function getDefaultOrderVector() {
diff --git a/src/applications/pholio/query/PholioImageQuery.php b/src/applications/pholio/query/PholioImageQuery.php
--- a/src/applications/pholio/query/PholioImageQuery.php
+++ b/src/applications/pholio/query/PholioImageQuery.php
@@ -61,40 +61,40 @@
return $images;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->mockIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'mockID IN (%Ld)',
$this->mockIDs);
}
if ($this->obsolete !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'isObsolete = %d',
$this->obsolete);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function willFilterPage(array $images) {
diff --git a/src/applications/phortune/query/PhortuneAccountQuery.php b/src/applications/phortune/query/PhortuneAccountQuery.php
--- a/src/applications/phortune/query/PhortuneAccountQuery.php
+++ b/src/applications/phortune/query/PhortuneAccountQuery.php
@@ -99,7 +99,7 @@
$this->memberPHIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function buildJoinClause(AphrontDatabaseConnection $conn) {
diff --git a/src/applications/phortune/query/PhortuneCartQuery.php b/src/applications/phortune/query/PhortuneCartQuery.php
--- a/src/applications/phortune/query/PhortuneCartQuery.php
+++ b/src/applications/phortune/query/PhortuneCartQuery.php
@@ -213,7 +213,7 @@
}
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/phortune/query/PhortuneChargeQuery.php b/src/applications/phortune/query/PhortuneChargeQuery.php
--- a/src/applications/phortune/query/PhortuneChargeQuery.php
+++ b/src/applications/phortune/query/PhortuneChargeQuery.php
@@ -134,7 +134,7 @@
$this->statuses);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/phortune/query/PhortuneMerchantQuery.php b/src/applications/phortune/query/PhortuneMerchantQuery.php
--- a/src/applications/phortune/query/PhortuneMerchantQuery.php
+++ b/src/applications/phortune/query/PhortuneMerchantQuery.php
@@ -114,7 +114,7 @@
$where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function buildJoinClause(AphrontDatabaseConnection $conn) {
diff --git a/src/applications/phortune/query/PhortunePaymentProviderConfigQuery.php b/src/applications/phortune/query/PhortunePaymentProviderConfigQuery.php
--- a/src/applications/phortune/query/PhortunePaymentProviderConfigQuery.php
+++ b/src/applications/phortune/query/PhortunePaymentProviderConfigQuery.php
@@ -85,7 +85,7 @@
$where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/phortune/query/PhortuneProductQuery.php b/src/applications/phortune/query/PhortuneProductQuery.php
--- a/src/applications/phortune/query/PhortuneProductQuery.php
+++ b/src/applications/phortune/query/PhortuneProductQuery.php
@@ -105,12 +105,12 @@
PhabricatorHash::digestForIndex($ref));
}
}
- $where[] = implode(' OR ', $sql);
+ $where[] = qsprintf($conn, '%LO', $sql);
}
$where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/phortune/query/PhortunePurchaseQuery.php b/src/applications/phortune/query/PhortunePurchaseQuery.php
--- a/src/applications/phortune/query/PhortunePurchaseQuery.php
+++ b/src/applications/phortune/query/PhortunePurchaseQuery.php
@@ -100,7 +100,7 @@
$this->cartPHIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/phortune/query/PhortuneSubscriptionQuery.php b/src/applications/phortune/query/PhortuneSubscriptionQuery.php
--- a/src/applications/phortune/query/PhortuneSubscriptionQuery.php
+++ b/src/applications/phortune/query/PhortuneSubscriptionQuery.php
@@ -182,7 +182,7 @@
$this->statuses);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/phragment/query/PhragmentFragmentQuery.php b/src/applications/phragment/query/PhragmentFragmentQuery.php
--- a/src/applications/phragment/query/PhragmentFragmentQuery.php
+++ b/src/applications/phragment/query/PhragmentFragmentQuery.php
@@ -55,47 +55,47 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->paths) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'path IN (%Ls)',
$this->paths);
}
if ($this->leadingPath) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'path LIKE %>',
$this->leadingPath);
}
if ($this->depths) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'depth IN (%Ld)',
$this->depths);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function didFilterPage(array $page) {
diff --git a/src/applications/phragment/query/PhragmentFragmentVersionQuery.php b/src/applications/phragment/query/PhragmentFragmentVersionQuery.php
--- a/src/applications/phragment/query/PhragmentFragmentVersionQuery.php
+++ b/src/applications/phragment/query/PhragmentFragmentVersionQuery.php
@@ -49,47 +49,47 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->fragmentPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'fragmentPHID IN (%Ls)',
$this->fragmentPHIDs);
}
if ($this->sequences) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'sequence IN (%Ld)',
$this->sequences);
}
if ($this->sequenceBefore !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'sequence < %d',
$this->sequenceBefore);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function willFilterPage(array $page) {
diff --git a/src/applications/phragment/query/PhragmentSnapshotChildQuery.php b/src/applications/phragment/query/PhragmentSnapshotChildQuery.php
--- a/src/applications/phragment/query/PhragmentSnapshotChildQuery.php
+++ b/src/applications/phragment/query/PhragmentSnapshotChildQuery.php
@@ -55,40 +55,40 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->snapshotPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'snapshotPHID IN (%Ls)',
$this->snapshotPHIDs);
}
if ($this->fragmentPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'fragmentPHID IN (%Ls)',
$this->fragmentPHIDs);
}
if ($this->fragmentVersionPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'fragmentVersionPHID IN (%Ls)',
$this->fragmentVersionPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function willFilterPage(array $page) {
diff --git a/src/applications/phragment/query/PhragmentSnapshotQuery.php b/src/applications/phragment/query/PhragmentSnapshotQuery.php
--- a/src/applications/phragment/query/PhragmentSnapshotQuery.php
+++ b/src/applications/phragment/query/PhragmentSnapshotQuery.php
@@ -43,40 +43,40 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
- if ($this->primaryFragmentPHIDs) {
+ if ($this->primaryFragmentPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'primaryFragmentPHID IN (%Ls)',
$this->primaryFragmentPHIDs);
}
- if ($this->names) {
+ if ($this->names !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'name IN (%Ls)',
$this->names);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function willFilterPage(array $page) {
diff --git a/src/applications/phrequent/query/PhrequentUserTimeQuery.php b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
--- a/src/applications/phrequent/query/PhrequentUserTimeQuery.php
+++ b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
@@ -116,7 +116,7 @@
$where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getOrderableColumns() {
diff --git a/src/applications/releeph/query/ReleephBranchQuery.php b/src/applications/releeph/query/ReleephBranchQuery.php
--- a/src/applications/releeph/query/ReleephBranchQuery.php
+++ b/src/applications/releeph/query/ReleephBranchQuery.php
@@ -103,26 +103,26 @@
return $branches;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->productIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'releephProjectID IN (%Ld)',
$this->productIDs);
}
@@ -133,16 +133,16 @@
break;
case self::STATUS_OPEN:
$where[] = qsprintf(
- $conn_r,
+ $conn,
'isActive = 1');
break;
default:
throw new Exception(pht("Unknown status constant '%s'!", $status));
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/releeph/query/ReleephProductQuery.php b/src/applications/releeph/query/ReleephProductQuery.php
--- a/src/applications/releeph/query/ReleephProductQuery.php
+++ b/src/applications/releeph/query/ReleephProductQuery.php
@@ -83,40 +83,40 @@
return $projects;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->active !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'isActive = %d',
(int)$this->active);
}
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ls)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->repositoryPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'repositoryPHID IN (%Ls)',
$this->repositoryPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getOrderableColumns() {
diff --git a/src/applications/releeph/query/ReleephRequestQuery.php b/src/applications/releeph/query/ReleephRequestQuery.php
--- a/src/applications/releeph/query/ReleephRequestQuery.php
+++ b/src/applications/releeph/query/ReleephRequestQuery.php
@@ -147,54 +147,54 @@
return $requests;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->branchIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'branchID IN (%Ld)',
$this->branchIDs);
}
if ($this->requestedCommitPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'requestCommitPHID IN (%Ls)',
$this->requestedCommitPHIDs);
}
if ($this->requestorPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'requestUserPHID IN (%Ls)',
$this->requestorPHIDs);
}
if ($this->requestedObjectPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'requestedObjectPHID IN (%Ls)',
$this->requestedObjectPHIDs);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function getKeepStatusConstants() {
diff --git a/src/applications/search/query/PhabricatorSavedQueryQuery.php b/src/applications/search/query/PhabricatorSavedQueryQuery.php
--- a/src/applications/search/query/PhabricatorSavedQueryQuery.php
+++ b/src/applications/search/query/PhabricatorSavedQueryQuery.php
@@ -37,33 +37,33 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->engineClassNames !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'engineClassName IN (%Ls)',
$this->engineClassNames);
}
if ($this->queryKeys !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'queryKey IN (%Ls)',
$this->queryKeys);
}
- $where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildPagingClause($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
public function getQueryApplicationClass() {
diff --git a/src/applications/tokens/query/PhabricatorTokenCountQuery.php b/src/applications/tokens/query/PhabricatorTokenCountQuery.php
--- a/src/applications/tokens/query/PhabricatorTokenCountQuery.php
+++ b/src/applications/tokens/query/PhabricatorTokenCountQuery.php
@@ -24,17 +24,17 @@
return ipull($rows, 'tokenCount', 'objectPHID');
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->objectPHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'objectPHID IN (%Ls)',
$this->objectPHIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
}
diff --git a/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php b/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php
--- a/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php
+++ b/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php
@@ -57,46 +57,48 @@
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
- return $this->formatWhereClause($this->buildWhereClauseComponents($conn_r));
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
+ return $this->formatWhereClause(
+ $conn,
+ $this->buildWhereClauseComponents($conn));
}
protected function buildWhereClauseComponents(
- AphrontDatabaseConnection $conn_r) {
+ AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'xcomment.id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'xcomment.phid IN (%Ls)',
$this->phids);
}
if ($this->authorPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'xcomment.authorPHID IN (%Ls)',
$this->authorPHIDs);
}
if ($this->transactionPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'xcomment.transactionPHID IN (%Ls)',
$this->transactionPHIDs);
}
if ($this->isDeleted !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'xcomment.isDeleted = %d',
(int)$this->isDeleted);
}
@@ -104,11 +106,11 @@
if ($this->hasTransaction !== null) {
if ($this->hasTransaction) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'xcomment.transactionPHID IS NOT NULL');
} else {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'xcomment.transactionPHID IS NULL');
}
}
diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
--- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
+++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
@@ -209,39 +209,47 @@
}
protected function buildCustomWhereClause(
- AphrontDatabaseConnection $conn_w,
+ AphrontDatabaseConnection $conn,
$phase) {
$where = array();
switch ($phase) {
case self::PHASE_LEASED:
- $where[] = 'leaseOwner IS NOT NULL';
- $where[] = 'leaseExpires >= UNIX_TIMESTAMP()';
+ $where[] = qsprintf(
+ $conn,
+ 'leaseOwner IS NOT NULL');
+ $where[] = qsprintf(
+ $conn,
+ 'leaseExpires >= UNIX_TIMESTAMP()');
break;
case self::PHASE_UNLEASED:
- $where[] = 'leaseOwner IS NULL';
+ $where[] = qsprintf(
+ $conn,
+ 'leaseOwner IS NULL');
break;
case self::PHASE_EXPIRED:
- $where[] = 'leaseExpires < UNIX_TIMESTAMP()';
+ $where[] = qsprintf(
+ $conn,
+ 'leaseExpires < UNIX_TIMESTAMP()');
break;
default:
throw new Exception(pht("Unknown phase '%s'!", $phase));
}
if ($this->ids !== null) {
- $where[] = qsprintf($conn_w, 'id IN (%Ld)', $this->ids);
+ $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
}
if ($this->objectPHIDs !== null) {
- $where[] = qsprintf($conn_w, 'objectPHID IN (%Ls)', $this->objectPHIDs);
+ $where[] = qsprintf($conn, 'objectPHID IN (%Ls)', $this->objectPHIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function buildUpdateWhereClause(
- AphrontDatabaseConnection $conn_w,
+ AphrontDatabaseConnection $conn,
$phase,
array $rows) {
@@ -257,25 +265,25 @@
'Trying to lease tasks selected in the leased phase! This is '.
'intended to be impossible.'));
case self::PHASE_UNLEASED:
- $where[] = qsprintf($conn_w, 'leaseOwner IS NULL');
- $where[] = qsprintf($conn_w, 'id IN (%Ld)', ipull($rows, 'id'));
+ $where[] = qsprintf($conn, 'leaseOwner IS NULL');
+ $where[] = qsprintf($conn, 'id IN (%Ld)', ipull($rows, 'id'));
break;
case self::PHASE_EXPIRED:
$in = array();
foreach ($rows as $row) {
$in[] = qsprintf(
- $conn_w,
+ $conn,
'(id = %d AND leaseOwner = %s)',
$row['id'],
$row['leaseOwner']);
}
- $where[] = qsprintf($conn_w, '(%Q)', implode(' OR ', $in));
+ $where[] = qsprintf($conn, '%LO', $in);
break;
default:
throw new Exception(pht('Unknown phase "%s"!', $phase));
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function buildOrderClause(AphrontDatabaseConnection $conn_w, $phase) {
diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php
--- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php
+++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php
@@ -48,59 +48,59 @@
return $this;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id in (%Ld)',
$this->ids);
}
if ($this->objectPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'objectPHID IN (%Ls)',
$this->objectPHIDs);
}
if ($this->dateModifiedSince !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'dateModified > %d',
$this->dateModifiedSince);
}
if ($this->dateCreatedBefore !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'dateCreated < %d',
$this->dateCreatedBefore);
}
if ($this->classNames !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'taskClass IN (%Ls)',
$this->classNames);
}
if ($this->minFailureCount !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'failureCount >= %d',
$this->minFailureCount);
}
if ($this->maxFailureCount !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'failureCount <= %d',
$this->maxFailureCount);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
protected function buildOrderClause(AphrontDatabaseConnection $conn_r) {
diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
--- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
+++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
@@ -160,52 +160,52 @@
return implode(' ', $joins);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
't.id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
't.phid IN (%Ls)',
$this->phids);
}
if ($this->versionMin !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
't.triggerVersion >= %d',
$this->versionMin);
}
if ($this->versionMax !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
't.triggerVersion <= %d',
$this->versionMax);
}
if ($this->nextEpochMin !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'e.nextEventEpoch >= %d',
$this->nextEpochMin);
}
if ($this->nextEpochMax !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'e.nextEventEpoch <= %d',
$this->nextEpochMax);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
private function buildOrderClause(AphrontDatabaseConnection $conn_r) {
diff --git a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
--- a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
+++ b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
@@ -290,19 +290,19 @@
/**
* @task internal
*/
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = array();
if ($this->sourcePHIDs) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'edge.src IN (%Ls)',
$this->sourcePHIDs);
}
if ($this->edgeTypes) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'edge.type IN (%Ls)',
$this->edgeTypes);
}
@@ -310,12 +310,12 @@
if ($this->destPHIDs) {
// potentially complain if $this->edgeType was not set
$where[] = qsprintf(
- $conn_r,
+ $conn,
'edge.dst IN (%Ls)',
$this->destPHIDs);
}
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
diff --git a/src/infrastructure/query/PhabricatorOffsetPagedQuery.php b/src/infrastructure/query/PhabricatorOffsetPagedQuery.php
--- a/src/infrastructure/query/PhabricatorOffsetPagedQuery.php
+++ b/src/infrastructure/query/PhabricatorOffsetPagedQuery.php
@@ -27,15 +27,15 @@
return $this->limit;
}
- protected function buildLimitClause(AphrontDatabaseConnection $conn_r) {
+ protected function buildLimitClause(AphrontDatabaseConnection $conn) {
if ($this->limit && $this->offset) {
- return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, $this->limit);
+ return qsprintf($conn, 'LIMIT %d, %d', $this->offset, $this->limit);
} else if ($this->limit) {
- return qsprintf($conn_r, 'LIMIT %d', $this->limit);
+ return qsprintf($conn, 'LIMIT %d', $this->limit);
} else if ($this->offset) {
- return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, PHP_INT_MAX);
+ return qsprintf($conn, 'LIMIT %d, %d', $this->offset, PHP_INT_MAX);
} else {
- return '';
+ return qsprintf($conn, '');
}
}
diff --git a/src/infrastructure/query/PhabricatorQuery.php b/src/infrastructure/query/PhabricatorQuery.php
--- a/src/infrastructure/query/PhabricatorQuery.php
+++ b/src/infrastructure/query/PhabricatorQuery.php
@@ -15,29 +15,20 @@
/**
* @task format
*/
- protected function formatWhereClause(array $parts) {
- $parts = $this->flattenSubclause($parts);
- if (!$parts) {
- return '';
- }
-
- return 'WHERE '.$this->formatWhereSubclause($parts);
- }
-
+ protected function formatWhereClause(
+ AphrontDatabaseConnection $conn,
+ array $parts) {
- /**
- * @task format
- */
- protected function formatWhereSubclause(array $parts) {
$parts = $this->flattenSubclause($parts);
if (!$parts) {
- return null;
+ return qsprintf($conn, '');
}
- return '('.implode(') AND (', $parts).')';
+ return qsprintf($conn, 'WHERE %LA', $parts);
}
+
/**
* @task format
*/
@@ -57,39 +48,32 @@
/**
* @task format
*/
- protected function formatJoinClause(array $parts) {
- $parts = $this->flattenSubclause($parts);
- if (!$parts) {
- return '';
- }
-
- return implode(' ', $parts);
- }
-
+ protected function formatJoinClause(
+ AphrontDatabaseConnection $conn,
+ array $parts) {
- /**
- * @task format
- */
- protected function formatHavingClause(array $parts) {
$parts = $this->flattenSubclause($parts);
if (!$parts) {
- return '';
+ return qsprintf($conn, '');
}
- return 'HAVING '.$this->formatHavingSubclause($parts);
+ return qsprintf($conn, '%LJ', $parts);
}
/**
* @task format
*/
- protected function formatHavingSubclause(array $parts) {
+ protected function formatHavingClause(
+ AphrontDatabaseConnection $conn,
+ array $parts) {
+
$parts = $this->flattenSubclause($parts);
if (!$parts) {
- return null;
+ return qsprintf($conn, '');
}
- return '('.implode(') AND (', $parts).')';
+ return qsprintf($conn, 'HAVING %LA', $parts);
}
diff --git a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
@@ -195,15 +195,15 @@
}
}
- final protected function buildLimitClause(AphrontDatabaseConnection $conn_r) {
+ final protected function buildLimitClause(AphrontDatabaseConnection $conn) {
if ($this->shouldLimitResults()) {
$limit = $this->getRawResultLimit();
if ($limit) {
- return qsprintf($conn_r, 'LIMIT %d', $limit);
+ return qsprintf($conn, 'LIMIT %d', $limit);
}
}
- return '';
+ return qsprintf($conn, '');
}
protected function shouldLimitResults() {
@@ -306,7 +306,7 @@
*/
protected function buildJoinClause(AphrontDatabaseConnection $conn) {
$joins = $this->buildJoinClauseParts($conn);
- return $this->formatJoinClause($joins);
+ return $this->formatJoinClause($conn, $joins);
}
@@ -328,7 +328,7 @@
*/
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
$where = $this->buildWhereClauseParts($conn);
- return $this->formatWhereClause($where);
+ return $this->formatWhereClause($conn, $where);
}
@@ -352,7 +352,7 @@
*/
protected function buildHavingClause(AphrontDatabaseConnection $conn) {
$having = $this->buildHavingClauseParts($conn);
- return $this->formatHavingClause($having);
+ return $this->formatHavingClause($conn, $having);
}
@@ -371,13 +371,13 @@
*/
protected function buildGroupClause(AphrontDatabaseConnection $conn) {
if (!$this->shouldGroupQueryResultRows()) {
- return '';
+ return qsprintf($conn, '');
}
return qsprintf(
$conn,
'GROUP BY %Q',
- $this->getApplicationSearchObjectPHIDColumn());
+ $this->getApplicationSearchObjectPHIDColumn($conn));
}
@@ -1134,7 +1134,7 @@
}
}
- return qsprintf($conn, 'ORDER BY %Q', implode(', ', $sql));
+ return qsprintf($conn, 'ORDER BY %LQ', $sql);
}
@@ -1244,17 +1244,18 @@
* See @{method:getPrimaryTableAlias} if the column needs to be qualified with
* a table alias.
*
- * @return string Column name.
+ * @param AphrontDatabaseConnection Connection executing queries.
+ * @return PhutilQueryString Column name.
* @task appsearch
*/
- protected function getApplicationSearchObjectPHIDColumn() {
+ protected function getApplicationSearchObjectPHIDColumn(
+ AphrontDatabaseConnection $conn) {
+
if ($this->getPrimaryTableAlias()) {
- $prefix = $this->getPrimaryTableAlias().'.';
+ return qsprintf($conn, '%T.phid', $this->getPrimaryTableAlias());
} else {
- $prefix = '';
+ return qsprintf($conn, 'phid');
}
-
- return $prefix.'phid';
}
@@ -1308,15 +1309,15 @@
* @task appsearch
*/
protected function buildApplicationSearchGroupClause(
- AphrontDatabaseConnection $conn_r) {
+ AphrontDatabaseConnection $conn) {
if ($this->getApplicationSearchMayJoinMultipleRows()) {
return qsprintf(
- $conn_r,
+ $conn,
'GROUP BY %Q',
$this->getApplicationSearchObjectPHIDColumn());
} else {
- return '';
+ return qsprintf($conn, '');
}
}
@@ -1410,7 +1411,7 @@
}
}
- $phid_column = $this->getApplicationSearchObjectPHIDColumn();
+ $phid_column = $this->getApplicationSearchObjectPHIDColumn($conn);
$orderable = $this->getOrderableColumns();
$vector = $this->getOrderVector();
@@ -2373,7 +2374,7 @@
*/
public function buildEdgeLogicJoinClause(AphrontDatabaseConnection $conn) {
$edge_table = PhabricatorEdgeConfig::TABLE_NAME_EDGE;
- $phid_column = $this->getApplicationSearchObjectPHIDColumn();
+ $phid_column = $this->getApplicationSearchObjectPHIDColumn($conn);
$joins = array();
foreach ($this->edgeLogicConstraints as $type => $constraints) {
@@ -2531,9 +2532,7 @@
}
if ($full && $null) {
- $full = $this->formatWhereSubclause($full);
- $null = $this->formatWhereSubclause($null);
- $where[] = qsprintf($conn, '(%Q OR %Q)', $full, $null);
+ $where[] = qsprintf($conn, '(%LA OR %LA)', $full, $null);
} else if ($full) {
foreach ($full as $condition) {
$where[] = $condition;
diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php
--- a/src/infrastructure/storage/lisk/LiskDAO.php
+++ b/src/infrastructure/storage/lisk/LiskDAO.php
@@ -517,13 +517,14 @@
protected function loadRawDataWhere($pattern /* , $args... */) {
- $connection = $this->establishConnection('r');
+ $conn = $this->establishConnection('r');
- $lock_clause = '';
- if ($connection->isReadLocking()) {
- $lock_clause = 'FOR UPDATE';
- } else if ($connection->isWriteLocking()) {
- $lock_clause = 'LOCK IN SHARE MODE';
+ if ($conn->isReadLocking()) {
+ $lock_clause = qsprintf($conn, 'FOR UPDATE');
+ } else if ($conn->isWriteLocking()) {
+ $lock_clause = qsprintf($conn, 'LOCK IN SHARE MODE');
+ } else {
+ $lock_clause = qsprintf($conn, '');
}
$args = func_get_args();
@@ -534,9 +535,7 @@
array_push($args, $lock_clause);
array_unshift($args, $pattern);
- return call_user_func_array(
- array($connection, 'queryData'),
- $args);
+ return call_user_func_array(array($conn, 'queryData'), $args);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 12, 9:23 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6872291
Default Alt Text
D19789.diff (77 KB)
Attached To
Mode
D19789: Update many Phabricator queries for new %Q query semantics
Attached
Detach File
Event Timeline
Log In to Comment