Changeset View
Changeset View
Standalone View
Standalone View
src/applications/feed/query/PhabricatorFeedQuery.php
| Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
| if ($this->filterPHIDs !== null) { | if ($this->filterPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| 'ref.objectPHID IN (%Ls)', | 'ref.objectPHID IN (%Ls)', | ||||
| $this->filterPHIDs); | $this->filterPHIDs); | ||||
| } | } | ||||
| if ($this->chronologicalKeys !== null) { | if ($this->chronologicalKeys !== null) { | ||||
| // NOTE: We want to use integers in the query so we can take advantage | // NOTE: We can't use "%d" to format these large integers on 32-bit | ||||
| // of keys, but can't use %d on 32-bit systems. Make sure all the keys | // systems. Historically, we formatted these into integers in an | ||||
| // are integers and then format them raw. | // awkward way because MySQL could sometimes (?) fail to use the proper | ||||
| // keys if the values were formatted as strings instead of integers. | |||||
| $keys = $this->chronologicalKeys; | |||||
| foreach ($keys as $key) { | // After the "qsprintf()" update to use PhutilQueryString, we can no | ||||
| if (!ctype_digit($key)) { | // longer do this in a sneaky way. However, the MySQL key issue also | ||||
| throw new Exception( | // no longer appears to reproduce across several systems. So: just use | ||||
| pht("Key '%s' is not a valid chronological key!", $key)); | // strings until problems turn up? | ||||
| } | |||||
| } | |||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| 'ref.chronologicalKey IN (%LQ)', | 'ref.chronologicalKey IN (%Ls)', | ||||
| $keys); | $this->chronologicalKeys); | ||||
| } | } | ||||
| // NOTE: We may not have 64-bit PHP, so do the shifts in MySQL instead. | // NOTE: We may not have 64-bit PHP, so do the shifts in MySQL instead. | ||||
| // From EXPLAIN, it appears like MySQL is smart enough to compute the | // From EXPLAIN, it appears like MySQL is smart enough to compute the | ||||
| // result and make use of keys to execute the query. | // result and make use of keys to execute the query. | ||||
| if ($this->rangeMin !== null) { | if ($this->rangeMin !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| ▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines | |||||