diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-24 08:43:38 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-24 08:43:38 +0400 |
commit | 438d64e01e9f385b29acd89da4debc705f1125a2 (patch) | |
tree | b1c1b1d6a3ffffc966405c44e6906bca1c5184d7 | |
parent | f27e248230999ef888f7b828d47a7854941b7e53 (diff) |
Fixes #3453 Compatibility with ANSI_QUOTES
If the ANSI_QUOTES SQL mode is enabled, string literals can be quoted only within single quotes because a string quoted within double quotes is interpreted as an identifier.
git-svn-id: http://dev.piwik.org/svn/trunk@7293 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r-- | core/RankingQuery.php | 5 | ||||
-rw-r--r-- | plugins/Transitions/Transitions.php | 2 | ||||
-rw-r--r-- | tests/PHPUnit/Core/RankingQueryTest.php | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/core/RankingQuery.php b/core/RankingQuery.php index a743f898d3..df4ca44cf9 100644 --- a/core/RankingQuery.php +++ b/core/RankingQuery.php @@ -288,7 +288,7 @@ class Piwik_RankingQuery { $labelColumnsOthersSwitch[] = " CASE - WHEN counter = $limit THEN \"{$this->othersLabelValue}\" + WHEN counter = $limit THEN '".$this->othersLabelValue."' ELSE `$column` END AS `$column` "; @@ -351,7 +351,8 @@ class Piwik_RankingQuery FROM ( $withCounter ) AS withCounter GROUP BY $groupBy "; - + + var_dump($groupOthers); return $groupOthers; } diff --git a/plugins/Transitions/Transitions.php b/plugins/Transitions/Transitions.php index 3b6db46876..2487522e82 100644 --- a/plugins/Transitions/Transitions.php +++ b/plugins/Transitions/Transitions.php @@ -84,7 +84,7 @@ class Piwik_Transitions extends Piwik_Plugin $rankingQuery->addLabelColumn('referrer_data'); $select = ' CASE referer_type - WHEN '.Piwik_Common::REFERER_TYPE_DIRECT_ENTRY.' THEN "" + WHEN '.Piwik_Common::REFERER_TYPE_DIRECT_ENTRY.' THEN \'\' WHEN '.Piwik_Common::REFERER_TYPE_SEARCH_ENGINE.' THEN referer_keyword WHEN '.Piwik_Common::REFERER_TYPE_WEBSITE.' THEN referer_url WHEN '.Piwik_Common::REFERER_TYPE_CAMPAIGN.' THEN CONCAT(referer_name, " ", referer_keyword) diff --git a/tests/PHPUnit/Core/RankingQueryTest.php b/tests/PHPUnit/Core/RankingQueryTest.php index 678f539320..60853bc5c9 100644 --- a/tests/PHPUnit/Core/RankingQueryTest.php +++ b/tests/PHPUnit/Core/RankingQueryTest.php @@ -27,7 +27,7 @@ class RankingQueryTest extends PHPUnit_Framework_TestCase $expected = " SELECT CASE - WHEN counter = 11 THEN \"Others\" + WHEN counter = 11 THEN 'Others' ELSE `label` END AS `label`, `column`, @@ -66,7 +66,7 @@ class RankingQueryTest extends PHPUnit_Framework_TestCase $expected = " SELECT CASE - WHEN counter = 21 THEN \"Others\" + WHEN counter = 21 THEN 'Others' ELSE `label` END AS `label`, `exclude_marker` @@ -104,7 +104,7 @@ class RankingQueryTest extends PHPUnit_Framework_TestCase $expected = " SELECT CASE - WHEN counter = 1001 THEN \"Others\" + WHEN counter = 1001 THEN 'Others' ELSE `label` END AS `label`, `partition` |