MINOR: catch wider range of create strings

This commit is contained in:
Andreas Piening 2010-06-24 06:12:53 +00:00
parent 30215cea6d
commit d989c15a2a

View File

@ -467,7 +467,7 @@ class SQLite3Database extends SS_Database {
$fieldList = array(); $fieldList = array();
if($sqlCreate && $sqlCreate['sql']) { 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(); $fields = isset($matches[1]) ? preg_split('/,(?=(?:[^\'"]*$)|(?:[^\'"]*[\'"][^\'"]*[\'"][^\'"]*)*$)/x', $matches[1]) : array();
foreach($fields as $field) { foreach($fields as $field) {
$details = preg_split('/\s/', trim($field)); $details = preg_split('/\s/', trim($field));