mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-02 23:07:39 +02:00
[feature/sqlite3] Remove trailing comma from column list
PHPBB3-9728
This commit is contained in:
@@ -2006,7 +2006,12 @@ class tools
|
|||||||
|
|
||||||
$columns = implode(',', $column_list);
|
$columns = implode(',', $column_list);
|
||||||
|
|
||||||
$new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols);
|
$new_table_cols = trim(preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols));
|
||||||
|
if (substr($new_table_cols, -1) === ',')
|
||||||
|
{
|
||||||
|
// Remove the comma from the last entry again
|
||||||
|
$new_table_cols = substr($new_table_cols, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
// create a new table and fill it up. destroy the temp one
|
// create a new table and fill it up. destroy the temp one
|
||||||
$statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');';
|
$statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');';
|
||||||
|
Reference in New Issue
Block a user