From 0b0b33cd527557dc91da8319c7dbda6a4a122066 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 10 Jul 2008 21:08:37 +0000 Subject: [PATCH] Partial revert of r37502, 37503: double-quoting of SQL strings --- includes/api/ApiQueryCategories.php | 8 +++----- includes/api/ApiQueryImages.php | 8 +++----- includes/api/ApiQueryLangLinks.php | 2 +- includes/api/ApiQueryLinks.php | 8 +++----- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index 51d4a5ffc8..5e1f983f5d 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -86,7 +86,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { $this->dieUsage("Invalid continue param. You should pass the " . "original value returned by the previous query", "_badcontinue"); $clfrom = intval($cont[0]); - $clto = $this->getDb()->addQuotes($this->titleToKey($cont[1])); + $clto = $this->getDb()->strencode($cont[1]); $this->addWhere("cl_from > $clfrom OR ". "(cl_from = $clfrom AND ". "cl_to >= '$clto')"); @@ -109,8 +109,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { if (++$count > $params['limit']) { // We've reached the one extra which shows that // there are additional pages to be had. Stop here... - $this->setContinueEnumParameter('continue', $row->cl_from . - '|' . $this->keyToTitle($row->cl_to)); + $this->setContinueEnumParameter('continue', "{$row->cl_from}|{$row->cl_to}"); break; } if ($lastId != $row->cl_from) { @@ -144,8 +143,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { if (++$count > $params['limit']) { // We've reached the one extra which shows that // there are additional pages to be had. Stop here... - $this->setContinueEnumParameter('continue', $row->cl_from . - '|' . $this->keyToTitle($row->cl_to)); + $this->setContinueEnumParameter('continue', "{$row->il_from}|{$row->il_to}"); break; } diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index edc5e204ed..7aed6eb5ca 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -66,7 +66,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase { $this->dieUsage("Invalid continue param. You should pass the " . "original value returned by the previous query", "_badcontinue"); $ilfrom = intval($cont[0]); - $ilto = $this->getDb()->addQuotes($this->titleToKey($cont[1])); + $ilto = $this->getDb()->strencode($cont[1]); $this->addWhere("il_from > $ilfrom OR ". "(il_from = $ilfrom AND ". "il_to >= '$ilto')"); @@ -90,8 +90,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase { if (++$count > $params['limit']) { // We've reached the one extra which shows that // there are additional pages to be had. Stop here... - $this->setContinueEnumParameter('continue', $row->il_from . - '|' . $this->keyToTitle($row->il_to)); + $this->setContinueEnumParameter('continue', "{$row->il_from}|{$row->il_to}"); break; } if ($lastId != $row->il_from) { @@ -119,8 +118,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase { if (++$count > $params['limit']) { // We've reached the one extra which shows that // there are additional pages to be had. Stop here... - $this->setContinueEnumParameter('continue', $row->il_from . - '|' . $this->keyToTitle($row->il_to)); + $this->setContinueEnumParameter('continue', "{$row->il_from}|{$row->il_to}"); break; } $titles[] = Title :: makeTitle(NS_IMAGE, $row->il_to); diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index ee2c17ffb4..735f67c0c6 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -58,7 +58,7 @@ class ApiQueryLangLinks extends ApiQueryBase { $this->dieUsage("Invalid continue param. You should pass the " . "original value returned by the previous query", "_badcontinue"); $llfrom = intval($cont[0]); - $lllang = $this->getDb()->addQuotes($cont[1]); + $lllang = $this->getDb()->strencode($cont[1]); $this->addWhere("ll_from > $llfrom OR ". "(ll_from = $llfrom AND ". "ll_lang >= '$lllang')"); diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 01671b3fcb..0761d913b6 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -92,7 +92,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { "original value returned by the previous query", "_badcontinue"); $plfrom = intval($cont[0]); $plns = intval($cont[1]); - $pltitle = $this->getDb()->addQuotes($this->titleToKey($cont[2])); + $pltitle = $this->getDb()->strencode($cont[2]); $this->addWhere("{$this->prefix}_from > $plfrom OR ". "({$this->prefix}_from = $plfrom AND ". "({$this->prefix}_namespace > $plns OR ". @@ -128,8 +128,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { // We've reached the one extra which shows that // there are additional pages to be had. Stop here... $this->setContinueEnumParameter('continue', - "{$row->pl_from}|{$row->pl_namespace}|" . - $this->keyToTitle($row->pl_title)); + "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}"); break; } if ($lastId != $row->pl_from) { @@ -158,8 +157,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { // We've reached the one extra which shows that // there are additional pages to be had. Stop here... $this->setContinueEnumParameter('continue', - "{$row->pl_from}|{$row->pl_namespace}|" . - $this->keyToTitle($row->pl_title)); + "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}"); break; } $titles[] = Title :: makeTitle($row->pl_namespace, $row->pl_title); -- 2.20.1