Skip to content

Commit

Permalink
Always trim commas when fetching table information for SQLite. #455
Browse files Browse the repository at this point in the history
  • Loading branch information
reines committed Jun 6, 2011
1 parent e255e3a commit 6cc8cd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/dblayer/sqlite.php
Expand Up @@ -405,15 +405,15 @@ function get_table_info($table_name, $no_prefix = false)
$table['columns'] = array();
foreach ($table_lines as $table_line)
{
$table_line = pun_trim($table_line);
$table_line = trim($table_line, " \t\n\r,"); // trim spaces, tabs, newlines, and commas
if (substr($table_line, 0, 12) == 'CREATE TABLE')
continue;
else if (substr($table_line, 0, 11) == 'PRIMARY KEY')
$table['primary_key'] = $table_line;
else if (substr($table_line, 0, 6) == 'UNIQUE')
$table['unique'] = $table_line;
else if (substr($table_line, 0, strpos($table_line, ' ')) != '')
$table['columns'][substr($table_line, 0, strpos($table_line, ' '))] = pun_trim(substr($table_line, strpos($table_line, ' ')));
$table['columns'][substr($table_line, 0, strpos($table_line, ' '))] = trim(substr($table_line, strpos($table_line, ' ')));
}

return $table;
Expand Down

0 comments on commit 6cc8cd9

Please sign in to comment.