Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14076636
D19785.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19785.diff
View Options
diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -491,10 +491,10 @@
protected function buildSelectClauseParts(AphrontDatabaseConnection $conn) {
$parts = parent::buildSelectClauseParts($conn);
- $parts[] = 'r.*';
+ $parts[] = qsprintf($conn, 'r.*');
if ($this->shouldJoinSummaryTable()) {
- $parts[] = 's.*';
+ $parts[] = qsprintf($conn, 's.*');
}
return $parts;
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
@@ -41,25 +41,16 @@
/**
* @task format
*/
- protected function formatSelectClause(array $parts) {
- $parts = $this->flattenSubclause($parts);
- if (!$parts) {
- throw new Exception(pht('Can not build empty select clause!'));
- }
-
- return 'SELECT '.$this->formatSelectSubclause($parts);
- }
-
+ protected function formatSelectClause(
+ AphrontDatabaseConnection $conn,
+ array $parts) {
- /**
- * @task format
- */
- protected function formatSelectSubclause(array $parts) {
$parts = $this->flattenSubclause($parts);
if (!$parts) {
- return null;
+ throw new Exception(pht('Can not build empty SELECT clause!'));
}
- return implode(', ', $parts);
+
+ return qsprintf($conn, 'SELECT %LQ', $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
@@ -277,7 +277,7 @@
*/
protected function buildSelectClause(AphrontDatabaseConnection $conn) {
$parts = $this->buildSelectClauseParts($conn);
- return $this->formatSelectClause($parts);
+ return $this->formatSelectClause($conn, $parts);
}
@@ -291,7 +291,7 @@
if ($alias) {
$select[] = qsprintf($conn, '%T.*', $alias);
} else {
- $select[] = '*';
+ $select[] = qsprintf($conn, '*');
}
$select[] = $this->buildEdgeLogicSelectClause($conn);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 6:59 PM (8 h, 18 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6775612
Default Alt Text
D19785.diff (2 KB)
Attached To
Mode
D19785: Make SELECT construction in PolicyAwareQuery safer
Attached
Detach File
Event Timeline
Log In to Comment