ENHANCEMENT: take into account that older Sqlite can modify the CREATE string and inject single quotes around table names that breaks the db reflection mechanism (happens when the table is renamed)

This commit is contained in:
Mateusz Uzdowski 2010-03-08 23:39:22 +00:00
parent 0094e39a9e
commit 47a91fe6c5
1 changed files with 1 additions and 1 deletions

View File

@ -460,7 +460,7 @@ class SQLite3Database extends SS_Database {
$fieldList = array();
if($sqlCreate && $sqlCreate['sql']) {
preg_match('/^[\s]*CREATE[\s]+TABLE[\s]+"[a-zA-Z0-9_]+"[\s]*\((.+)\)[\s]*$/ims', $sqlCreate['sql'], $matches);
preg_match('/^[\s]*CREATE[\s]+TABLE[\s]+[\'"][a-zA-Z0-9_]+[\'"][\s]*\((.+)\)[\s]*$/ims', $sqlCreate['sql'], $matches);
$fields = isset($matches[1]) ? preg_split('/,(?=(?:[^\'"]*$)|(?:[^\'"]*[\'"][^\'"]*[\'"][^\'"]*)*$)/x', $matches[1]) : array();
foreach($fields as $field) {
$details = preg_split('/\s/', trim($field));