From 2f92bc38e6ca81e64f0846b97df2b13310721453 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 30 Nov 2014 16:52:36 +0700 Subject: [ticket/13406] Add a space between the index name and columns list Currently there's no space between the index name and columns list when generating ADD INDEX sql query for MySQL DBMSes. This may cause errors on earlier MySQL versions like 3.23. PHPBB3-13406 --- phpBB/phpbb/db/tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/db/tools.php') diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index c8d25f23a2..f523b39fb3 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -2175,7 +2175,7 @@ class tools } // no break case 'mysql_41': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . ' (' . implode(', ', $column) . ')'; break; case 'mssql': -- cgit v1.2.1 From 1367fc234fce4f2e79c02e3780b5727faa5992e4 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 22 Jan 2015 00:06:25 +0100 Subject: [ticket/13282] Use 0 as default for integer type columns in postgresql PHPBB3-13282 --- phpBB/phpbb/db/tools.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/db/tools.php') diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index f523b39fb3..ee0d247071 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -1574,7 +1574,15 @@ class tools } else { - $default_val = "'" . $column_data[1] . "'"; + // Integers need to have 0 instead of empty string as default + if (preg_match('/int/i', $column_type)) + { + $default_val = '0'; + } + else + { + $default_val = "'" . $column_data[1] . "'"; + } $return_array['null'] = 'NULL'; $sql .= 'NULL '; } -- cgit v1.2.1 From 816465bfe90c955a9fc7b748b0ff22b5e775c7a9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 22 Jan 2015 10:11:08 +0100 Subject: [ticket/13282] Use strpos() instead of preg_match() PHPBB3-13282 --- phpBB/phpbb/db/tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/db/tools.php') diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index ee0d247071..775deccc30 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -1575,7 +1575,7 @@ class tools else { // Integers need to have 0 instead of empty string as default - if (preg_match('/int/i', $column_type)) + if (strpos($column_type, 'INT') === 0) { $default_val = '0'; } -- cgit v1.2.1