1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14: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(
$conn_r,
'(repositoryID = %d AND commitIdentifier = %d)',
'(repositoryID = %d AND commitIdentifier = %s)',
$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 {
if (strlen($ref['identifier']) < $min_qualified) {
continue;

View file

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

View file

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