Page MenuHomePhabricator

D12353.diff
No OneTemporary

D12353.diff

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
@@ -896,14 +896,16 @@
return $default;
case self::ORDER_MODIFIED:
$columns[] = array(
- 'name' => 'r.dateModified',
+ 'table' => 'r',
+ 'column' => 'dateModified',
'value' => $cursor->getDateModified(),
'type' => 'int',
);
break;
case self::ORDER_PATH_MODIFIED:
$columns[] = array(
- 'name' => 'p.epoch',
+ 'table' => 'p',
+ 'column' => 'epoch',
'value' => $cursor->getDateCreated(),
'type' => 'int',
);
@@ -911,7 +913,8 @@
}
$columns[] = array(
- 'name' => 'r.id',
+ 'table' => 'r',
+ 'column' => 'id',
'value' => $cursor->getID(),
'type' => 'int',
);
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -1005,16 +1005,18 @@
break;
case self::GROUP_PRIORITY:
$columns[] = array(
- 'name' => 'task.priority',
+ 'table' => 'task',
+ 'column' => 'priority',
'value' => (int)$group_id,
'type' => 'int',
);
break;
case self::GROUP_OWNER:
$columns[] = array(
- 'name' => '(task.ownerOrdering IS NULL)',
- 'value' => (int)(strlen($group_id) ? 0 : 1),
- 'type' => 'int',
+ 'table' => 'task',
+ 'column' => 'ownerOrdering',
+ 'value' => strlen($group_id),
+ 'type' => 'null',
);
if ($group_id) {
$paging_users = id(new PhabricatorPeopleQuery())
@@ -1025,7 +1027,8 @@
return null;
}
$columns[] = array(
- 'name' => 'task.ownerOrdering',
+ 'table' => 'task',
+ 'column' => 'ownerOrdering',
'value' => head($paging_users)->getUsername(),
'type' => 'string',
'reverse' => true,
@@ -1034,16 +1037,18 @@
break;
case self::GROUP_STATUS:
$columns[] = array(
- 'name' => 'task.status',
+ 'table' => 'task',
+ 'column' => 'status',
'value' => $group_id,
'type' => 'string',
);
break;
case self::GROUP_PROJECT:
$columns[] = array(
- 'name' => '(projectGroupName.indexedObjectName IS NULL)',
- 'value' => (int)(strlen($group_id) ? 0 : 1),
- 'type' => 'int',
+ 'table' => 'projectGroupName',
+ 'column' => 'indexedObjectName',
+ 'value' => strlen($group_id),
+ 'type' => 'null',
);
if ($group_id) {
$paging_projects = id(new PhabricatorProjectQuery())
@@ -1054,7 +1059,8 @@
return null;
}
$columns[] = array(
- 'name' => 'projectGroupName.indexedObjectName',
+ 'table' => 'projectGroupName',
+ 'column' => 'indexedObjectName',
'value' => head($paging_projects)->getName(),
'type' => 'string',
'reverse' => true,
@@ -1073,18 +1079,21 @@
case self::ORDER_PRIORITY:
if ($this->groupBy != self::GROUP_PRIORITY) {
$columns[] = array(
- 'name' => 'task.priority',
+ 'table' => 'task',
+ 'column' => 'priority',
'value' => (int)$cursor->getPriority(),
'type' => 'int',
);
}
$columns[] = array(
- 'name' => 'task.subpriority',
+ 'table' => 'task',
+ 'column' => 'subpriority',
'value' => $cursor->getSubpriority(),
'type' => 'float',
);
$columns[] = array(
- 'name' => 'task.dateModified',
+ 'table' => 'task',
+ 'column' => 'dateModified',
'value' => (int)$cursor->getDateModified(),
'type' => 'int',
);
@@ -1094,14 +1103,16 @@
break;
case self::ORDER_MODIFIED:
$columns[] = array(
- 'name' => 'task.dateModified',
+ 'table' => 'task',
+ 'column' => 'dateModified',
'value' => (int)$cursor->getDateModified(),
'type' => 'int',
);
break;
case self::ORDER_TITLE:
$columns[] = array(
- 'name' => 'task.title',
+ 'table' => 'task',
+ 'column' => 'title',
'value' => $cursor->getTitle(),
'type' => 'string',
);
@@ -1112,7 +1123,8 @@
}
$columns[] = array(
- 'name' => 'task.id',
+ 'table' => 'task',
+ 'column' => 'id',
'value' => $cursor->getID(),
'type' => 'int',
);
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
@@ -383,7 +383,8 @@
}
$id_column = array(
- 'name' => 'r.id',
+ 'table' => 'r',
+ 'column' => 'id',
'type' => 'int',
'value' => $cursor->getID(),
);
@@ -396,7 +397,8 @@
return null;
}
$columns[] = array(
- 'name' => 's.epoch',
+ 'table' => 's',
+ 'column' => 'epoch',
'type' => 'int',
'value' => $commit->getEpoch(),
);
@@ -404,7 +406,8 @@
break;
case self::ORDER_CALLSIGN:
$columns[] = array(
- 'name' => 'r.callsign',
+ 'table' => 'r',
+ 'column' => 'callsign',
'type' => 'string',
'value' => $cursor->getCallsign(),
'reverse' => true,
@@ -412,7 +415,8 @@
break;
case self::ORDER_NAME:
$columns[] = array(
- 'name' => 'r.name',
+ 'table' => 'r',
+ 'column' => 'name',
'type' => 'string',
'value' => $cursor->getName(),
'reverse' => true,
@@ -421,7 +425,8 @@
break;
case self::ORDER_SIZE:
$columns[] = array(
- 'name' => 's.size',
+ 'table' => 's',
+ 'column' => 'size',
'type' => 'int',
'value' => $cursor->getCommitCount(),
);
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
@@ -181,13 +181,15 @@
* $conn_r,
* array(
* array(
- * 'name' => 'title',
+ * 'table' => 't',
+ * 'column' => 'title',
* 'type' => 'string',
* 'value' => $cursor->getTitle(),
* 'reverse' => true,
* ),
* array(
- * 'name' => 'id',
+ * 'table' => 't',
+ * 'column' => 'id',
* 'type' => 'int',
* 'value' => $cursor->getID(),
* ),
@@ -212,7 +214,8 @@
PhutilTypeSpec::checkMap(
$column,
array(
- 'name' => 'string',
+ 'table' => 'optional string',
+ 'column' => 'string',
'value' => 'wild',
'type' => 'string',
'reverse' => 'optional bool',
@@ -231,10 +234,11 @@
$accumulated = array();
$last_key = last_key($columns);
foreach ($columns as $key => $column) {
- $name = $column['name'];
-
$type = $column['type'];
switch ($type) {
+ case 'null':
+ $value = qsprintf($conn, '%d', ($column['value'] ? 0 : 1));
+ break;
case 'int':
$value = qsprintf($conn, '%d', $column['value']);
break;
@@ -252,10 +256,23 @@
$reverse = ($is_query_reversed xor $is_column_reversed);
$clause = $accumulated;
+
+ $table_name = idx($column, 'table');
+ $column_name = $column['column'];
+ if ($table_name !== null) {
+ $field = qsprintf($conn, '%T.%T', $table_name, $column_name);
+ } else {
+ $field = qsprintf($conn, '%T', $column_name);
+ }
+
+ if ($type == 'null') {
+ $field = qsprintf($conn, '(%Q IS NULL)', $field);
+ }
+
$clause[] = qsprintf(
$conn,
'%Q %Q %Q',
- $name,
+ $field,
$reverse ? '>' : '<',
$value);
$clauses[] = '('.implode(') AND (', $clause).')';
@@ -263,7 +280,7 @@
$accumulated[] = qsprintf(
$conn,
'%Q = %Q',
- $name,
+ $field,
$value);
}

File Metadata

Mime Type
text/plain
Expires
Wed, May 8, 9:30 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6273083
Default Alt Text
D12353.diff (8 KB)

Event Timeline