From fe1f21d1a55ac15b278d99c3a73a8e3424a38fd5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 2 Jul 2012 23:11:21 +0200 Subject: [ticket/10942] Use ANSI SQL standard || in dbal.php PHPBB3-10942 --- phpBB/includes/db/mysql.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index eb38e3e913..3cda5cc1e0 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -119,6 +119,14 @@ class dbal_mysql extends dbal return ($raw) ? $this->sql_server_version : 'MySQL ' . $this->sql_server_version; } + /** + * {@inheritDoc} + */ + function sql_concatenate($expr1, $expr2) + { + return 'CONCAT(' . $expr1 . ', ' . $expr2 . ')'; + } + /** * SQL Transaction * @access private -- cgit v1.2.1 From 6776feb0de667340d640744462d00436f893c45f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 4 Jul 2012 14:05:03 +0200 Subject: [ticket/10942] Add access modifiers PHPBB3-10942 --- phpBB/includes/db/mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 3cda5cc1e0..8d1f805870 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -122,7 +122,7 @@ class dbal_mysql extends dbal /** * {@inheritDoc} */ - function sql_concatenate($expr1, $expr2) + public function sql_concatenate($expr1, $expr2) { return 'CONCAT(' . $expr1 . ', ' . $expr2 . ')'; } -- cgit v1.2.1 From 828eaecf6ab4f6c013a7955bf6af2a81c049e42f Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Jul 2012 15:24:31 -0500 Subject: [ticket/10875] Changes to Cache Driver caused method_exists checks to fail SQL Cache and other functions using the check method_exists($cache, failed because of the changes to the cache system. method_exists($cache has been changed to method_exists($cache->get_driver() PHPBB3-10875 --- phpBB/includes/db/mysql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 8d1f805870..31bb59711a 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -172,7 +172,7 @@ class dbal_mysql extends dbal $this->sql_report('start', $query); } - $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false; + $this->query_result = ($cache_ttl && method_exists($cache->get_driver(), 'sql_load')) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); if ($this->query_result === false) @@ -187,7 +187,7 @@ class dbal_mysql extends dbal $this->sql_report('stop', $query); } - if ($cache_ttl && method_exists($cache, 'sql_save')) + if ($cache_ttl && method_exists($cache->get_driver(), 'sql_save')) { $this->open_queries[(int) $this->query_result] = $this->query_result; $cache->sql_save($query, $this->query_result, $cache_ttl); -- cgit v1.2.1 From edcac438df164764c84ca9fb7a7f751bf76d5c34 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Jul 2012 15:57:51 -0500 Subject: [ticket/10875] method_exists check is not required, interface declares them The changes to the cache drivers added an interface, which requires many cache functions exist. For these, we can remove the method_exists() check PHPBB3-10875 --- phpBB/includes/db/mysql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 31bb59711a..dbab1ec0b8 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -172,7 +172,7 @@ class dbal_mysql extends dbal $this->sql_report('start', $query); } - $this->query_result = ($cache_ttl && method_exists($cache->get_driver(), 'sql_load')) ? $cache->sql_load($query) : false; + $this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); if ($this->query_result === false) @@ -187,7 +187,7 @@ class dbal_mysql extends dbal $this->sql_report('stop', $query); } - if ($cache_ttl && method_exists($cache->get_driver(), 'sql_save')) + if ($cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $cache->sql_save($query, $this->query_result, $cache_ttl); -- cgit v1.2.1 From 01bc818d465ab168288e260745a045ff2794648d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Jul 2012 18:44:40 -0500 Subject: [ticket/10875] Fix SQL Caching The sql_save function cannot take arguments by reference since it is called by call_user_func_array() Replace use of isset($cache->sql_rowset[$query_id]) with $cache->sql_exists Replace $cache->cache_dir with $cache->get_driver()->cache_dir PHPBB3-10875 --- phpBB/includes/db/mysql.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index dbab1ec0b8..fd567af076 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -249,7 +249,7 @@ class dbal_mysql extends dbal $query_id = $this->query_result; } - if (isset($cache->sql_rowset[$query_id])) + if ($cache->sql_exists($query_id)) { return $cache->sql_fetchrow($query_id); } @@ -270,7 +270,7 @@ class dbal_mysql extends dbal $query_id = $this->query_result; } - if (isset($cache->sql_rowset[$query_id])) + if ($cache->sql_exists($query_id)) { return $cache->sql_rowseek($rownum, $query_id); } @@ -298,7 +298,7 @@ class dbal_mysql extends dbal $query_id = $this->query_result; } - if (isset($cache->sql_rowset[$query_id])) + if ($cache->sql_exists($query_id)) { return $cache->sql_freeresult($query_id); } -- cgit v1.2.1 From dcefa16318f6dc1058595a7ba221b75ed6a2504b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 6 Aug 2012 16:26:55 -0500 Subject: [ticket/10875] Return $query_id from sql_save Have to return the $query_id from sql_save so that the results can be pulled Updated cache test to do some basic sql cache testing. PHPBB3-10875 --- phpBB/includes/db/mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index fd567af076..5b4ff86579 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -190,7 +190,7 @@ class dbal_mysql extends dbal if ($cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; - $cache->sql_save($query, $this->query_result, $cache_ttl); + $this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl); } else if (strpos($query, 'SELECT') === 0 && $this->query_result) { -- cgit v1.2.1 From bd37f7f6c04780819dfa8f81b2d761b91859fd67 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sat, 10 Nov 2012 10:45:02 -0600 Subject: [ticket/11189] Replace DEBUG_EXTRA with DEBUG PHPBB3-11189 --- phpBB/includes/db/mysql.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 5b4ff86579..f685ab055c 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -167,7 +167,7 @@ class dbal_mysql extends dbal global $cache; // EXPLAIN only in extra debug mode - if (defined('DEBUG_EXTRA')) + if (defined('DEBUG')) { $this->sql_report('start', $query); } @@ -182,7 +182,7 @@ class dbal_mysql extends dbal $this->sql_error($query); } - if (defined('DEBUG_EXTRA')) + if (defined('DEBUG')) { $this->sql_report('stop', $query); } @@ -197,7 +197,7 @@ class dbal_mysql extends dbal $this->open_queries[(int) $this->query_result] = $this->query_result; } } - else if (defined('DEBUG_EXTRA')) + else if (defined('DEBUG')) { $this->sql_report('fromcache', $query); } -- cgit v1.2.1