From 47a91fe6c5c4c1a78b3747e50649f3b0d8b5db89 Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Mon, 8 Mar 2010 23:39:22 +0000 Subject: [PATCH] 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) --- code/SQLite3Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index c53d99f..e1e37ba 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -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));