mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[feature/sqlite3] Remove trailing comma from column list
PHPBB3-9728
This commit is contained in:
parent
8c2b80e3d2
commit
07042e484e
1 changed files with 6 additions and 1 deletions
|
@ -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 . ');';
|
||||||
|
|
Loading…
Add table
Reference in a new issue