Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #54 from smithimage/master

Fixed regexp to handle quotations around table and column names sometime used by chrome
  • Loading branch information...
commit 0150bdc28f86c281f0e9b36982fc8b9097642066 2 parents 4a0878e + 53ee495
Zef Hemel authored September 12, 2011

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  lib/persistence.migrations.js
4  lib/persistence.migrations.js
@@ -217,12 +217,12 @@ if(!window.persistence) { // persistence.js not loaded!
217 217
       this.action(function(tx, nextCommand){
218 218
         var sql = 'select sql from sqlite_master where type = "table" and name == "'+tableName+'"';
219 219
         tx.executeSql(sql, null, function(result){
220  
-          var columns = new RegExp("CREATE TABLE \\w+ \\((.+)\\)").exec(result[0].sql)[1].split(', ');
  220
+          var columns = new RegExp("CREATE TABLE `\\w+` |\\w+ \\((.+)\\)").exec(result[0].sql)[1].split(', ');
221 221
           var selectColumns = [];
222 222
           var columnsSql = [];
223 223
           
224 224
           for (var i = 0; i < columns.length; i++) {
225  
-            var colName = new RegExp("(\\w+) .+").exec(columns[i])[1];
  225
+            var colName = new RegExp("((`\\w+`)|(\\w+)) .+").exec(columns[i])[1];
226 226
             if (colName == columnName) continue;
227 227
             
228 228
             columnsSql.push(columns[i]);

0 notes on commit 0150bdc

Please sign in to comment.
Something went wrong with that request. Please try again.