1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Fix the type of some values passed to MySQL

Summary: Ref T3377. MySQL ignores indexes if we hand it mismatched datatypes. This seems colossally dumb, but give it what it expects.

Test Plan: wat

Reviewers: wez, btrahan

Reviewed By: wez

CC: aran

Maniphest Tasks: T3377

Differential Revision: https://secure.phabricator.com/D6201
This commit is contained in:
epriestley 2013-06-13 18:01:40 -07:00
parent 02b59e685f
commit efbd3ecc48
3 changed files with 9 additions and 6 deletions

View file

@ -144,9 +144,12 @@ final class DiffusionCommitQuery
} }
$sql[] = qsprintf( $sql[] = qsprintf(
$conn_r, $conn_r,
'(repositoryID = %d AND commitIdentifier = %d)', '(repositoryID = %d AND commitIdentifier = %s)',
$repo->getID(), $repo->getID(),
$ref['identifier']); // NOTE: Because the 'commitIdentifier' column is a string, MySQL
// ignores the index if we hand it an integer. Hand it a string.
// See T3377.
(int)$ref['identifier']);
} else { } else {
if (strlen($ref['identifier']) < $min_qualified) { if (strlen($ref['identifier']) < $min_qualified) {
continue; continue;

View file

@ -233,7 +233,7 @@ final class PhabricatorRepositoryPullLocalDaemon
} }
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere( $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %s AND commitIdentifier = %s', 'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(), $repository->getID(),
$target); $target);
@ -254,7 +254,7 @@ final class PhabricatorRepositoryPullLocalDaemon
$target) { $target) {
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere( $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %s AND commitIdentifier = %s', 'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(), $repository->getID(),
$target); $target);
@ -362,7 +362,7 @@ final class PhabricatorRepositoryPullLocalDaemon
$branch) { $branch) {
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere( $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %s AND commitIdentifier = %s', 'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(), $repository->getID(),
$commit_identifier); $commit_identifier);

View file

@ -498,7 +498,7 @@ final class PhabricatorRepositorySvnCommitChangeParserWorker
$commit_data = queryfx_all( $commit_data = queryfx_all(
$commit_table->establishConnection('w'), $commit_table->establishConnection('w'),
'SELECT id, commitIdentifier FROM %T 'SELECT id, commitIdentifier FROM %T
WHERE repositoryID = %d AND commitIdentifier in (%Ld)', WHERE repositoryID = %d AND commitIdentifier in (%Ls)',
$commit_table->getTableName(), $commit_table->getTableName(),
$repository->getID(), $repository->getID(),
$commits); $commits);