alasql 0.0.50 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/.bower.json +44 -3
  2. package/CHANGELOG.md +9 -0
  3. package/README.md +13 -4
  4. package/RELEASES.md +4 -2
  5. package/alasql.js +772 -598
  6. package/console/alasql.js +8 -8
  7. package/console/alasql.min.js +9 -9
  8. package/dist/alasql-worker.js +1 -1
  9. package/dist/alasql.js +772 -598
  10. package/dist/alasql.js.map +1 -1
  11. package/dist/alasql.min.js +9 -9
  12. package/examples/country/city.js +16 -0
  13. package/examples/nodesample.js +16 -0
  14. package/examples/other/test.js +20 -0
  15. package/examples/param.js +4 -0
  16. package/examples/promise.js +10 -0
  17. package/examples/simple/ex102.js +10 -0
  18. package/examples/simple/jquery.js +6 -0
  19. package/examples/sqlite/test.js +5 -0
  20. package/gulpfile.js +386 -0
  21. package/package.json +1 -1
  22. package/src/05copyright.js +1 -1
  23. package/src/10start.js +1 -1
  24. package/src/15utility.js +3 -3
  25. package/src/17alasql.js +6 -0
  26. package/src/38query.js +56 -9
  27. package/src/39dojoin.js +4 -1
  28. package/src/40select.js +55 -17
  29. package/src/420from.js +17 -4
  30. package/src/421join.js +14 -4
  31. package/src/423groupby.js +5 -3
  32. package/src/424select.js +36 -5
  33. package/src/55functions.js +12 -0
  34. package/src/70insert.js +1 -1
  35. package/src/72delete.js +206 -0
  36. package/src/84from.js +1 -0
  37. package/src/alasqlparser.jison +27 -7
  38. package/src/alasqlparser.js +560 -549
  39. package/test/callback/cb1.js +59 -0
  40. package/test/callback/cb2.js +45 -0
  41. package/test/future/test119.js +77 -0
  42. package/test/future/test123.js +91 -0
  43. package/test/future/test131.js +30 -0
  44. package/test/future/test132.js +69 -0
  45. package/test/future/test134.js +51 -0
  46. package/test/future/test135.js +28 -0
  47. package/test/future/test136.js +23 -0
  48. package/test/future/test147.js +27 -0
  49. package/test/graph/CREATE CLASS G1 +39 -0
  50. package/test/graph/README.md +3 -0
  51. package/test/graph/SEARCH.md +110 -0
  52. package/test/graph/idea.txt +22 -0
  53. package/test/graph/ides 150428.txt +24 -0
  54. package/test/graph/index.html +68 -0
  55. package/test/graph/miserables.json +337 -0
  56. package/test/index.html +10 -1
  57. package/test/minisql/minisql.js +377 -0
  58. package/test/test018.js +0 -3
  59. package/test/test132.js +18 -1
  60. package/test/test193.js +1 -1
  61. package/test/test240.js +132 -0
  62. package/test/test245.js +100 -0
  63. package/test/test247.js +84 -0
  64. package/test/test266.js +117 -0
  65. package/test/test267.js +79 -0
  66. package/test/test268.js +92 -0
  67. package/test/test269.js +123 -0
  68. package/test/test270.js +299 -0
  69. package/test/test271.js +22 -0
  70. package/test/test272.js +66 -0
  71. package/test/test273.js +69 -0
  72. package/test/test274.js +31 -0
package/src/420from.js CHANGED
@@ -48,10 +48,13 @@ yy.Select.prototype.compileFrom = function(query) {
48
48
  joinmode: 'INNER',
49
49
  onmiddlefn: returnTrue,
50
50
  srcwherefns: '', // for optimization
51
- srcwherefn: returnTrue
51
+ srcwherefn: returnTrue,
52
+ // columns: []
52
53
  };
53
54
 
54
55
  if(tq instanceof yy.Table) {
56
+ // Get columns from table
57
+ source.columns = alasql.databases[source.databaseid].tables[source.tableid].columns;
55
58
  // console.log('test',alasql.options.autocommit);
56
59
  // console.log(997,alasql.databases[source.databaseid].engineid);
57
60
  // console.log(0,source.databaseid);
@@ -89,14 +92,23 @@ yy.Select.prototype.compileFrom = function(query) {
89
92
  };
90
93
  }
91
94
  } else if(tq instanceof yy.Select) {
95
+ if(typeof tq.modifier == 'undefined') {
96
+ tq.modifier = 'RECORDSET'; // Subqueries always return recordsets
97
+ }
98
+
92
99
  source.subquery = tq.compile(query.database.databaseid);
100
+ source.columns = source.subquery.query.columns;
101
+ // console.log(101,source.columns);
102
+ // tq.columns;
103
+
93
104
  source.datafn = function(query, params, cb, idx, alasql) {
94
105
  // return source.subquery(query.params, cb, idx, query);
95
106
  var res;
96
107
  source.subquery(query.params, function(data){
97
- // console.log(512,data);
98
- if(cb) res = cb(data,idx,query);
99
- return data;
108
+ res = data.data;
109
+ if(cb) res = cb(res,idx,query);
110
+ return res;
111
+ // return data.data;
100
112
  });
101
113
  // console.log(515,res);
102
114
  return res;
@@ -163,6 +175,7 @@ yy.Select.prototype.compileFrom = function(query) {
163
175
  };
164
176
 
165
177
  alasql.prepareFromData = function(data,array) {
178
+ //console.log(177,data,array);
166
179
  var res = data;
167
180
  if(typeof data == "string") {
168
181
  res = data.split(/\r?\n/);
package/src/421join.js CHANGED
@@ -39,9 +39,12 @@ yy.Select.prototype.compileJoins = function(query) {
39
39
  applymode: jn.applymode,
40
40
  onmiddlefn: returnTrue,
41
41
  srcwherefns: '', // for optimization
42
- srcwherefn: returnTrue
42
+ srcwherefn: returnTrue,
43
+ columns: [] // TODO check this
43
44
  };
44
45
  source.applyselect = jn.select.compile(query.database.databaseid);
46
+ source.columns = source.applyselect.query.columns;
47
+
45
48
  source.datafn = function(query,params,cb,idx, alasql) {
46
49
  var res;
47
50
  if(cb) res = cb(res,idx,query);
@@ -60,7 +63,8 @@ yy.Select.prototype.compileJoins = function(query) {
60
63
  joinmode: jn.joinmode,
61
64
  onmiddlefn: returnTrue,
62
65
  srcwherefns: '', // for optimization
63
- srcwherefn: returnTrue
66
+ srcwherefn: returnTrue,
67
+ columns: []
64
68
  };
65
69
  //
66
70
 
@@ -69,6 +73,9 @@ yy.Select.prototype.compileJoins = function(query) {
69
73
  throw new Error('Table \''+source.tableid+
70
74
  '\' is not exists in database \''+source.databaseid)+'\'';
71
75
  };
76
+
77
+ source.columns = alasql.databases[source.databaseid].tables[source.tableid].columns;
78
+
72
79
  // source.data = query.database.tables[source.tableid].data;
73
80
  if(alasql.options.autocommit && alasql.databases[source.databaseid].engineid) {
74
81
  // console.log(997,alasql.databases[source.databaseid].engineid);
@@ -106,13 +113,16 @@ yy.Select.prototype.compileJoins = function(query) {
106
113
  joinmode: jn.joinmode,
107
114
  onmiddlefn: returnTrue,
108
115
  srcwherefns: '', // for optimization
109
- srcwherefn: returnTrue
116
+ srcwherefn: returnTrue,
117
+ columns: []
110
118
  };
111
119
  source.subquery = tq.compile(query.database.databaseid);
120
+ source.columns = source.subquery.query.columns;
121
+
112
122
  // if(jn instanceof yy.Apply) {
113
123
  source.datafn = function(query, params, cb, idx, alasql) {
114
124
  // return cb(null,idx,alasql);
115
- return source.subquery(query.params, null, cb, idx);
125
+ return source.subquery(query.params, null, cb, idx).data;
116
126
  }
117
127
  // } else {
118
128
  // source.datafn = function(query, params, cb, idx, alasql) {
package/src/423groupby.js CHANGED
@@ -72,7 +72,7 @@ if(false) {
72
72
  //console.log(agroup);
73
73
 
74
74
  // Start of group function
75
- s += 'var g=this.xgroups[';
75
+ s += 'var acc,g=this.xgroups[';
76
76
 
77
77
  // var gcols = this.group.map(function(col){return col.columnid}); // Group fields with r
78
78
  // Array with group columns from record
@@ -155,7 +155,9 @@ if(false) {
155
155
  aft += ',g[\''+colas+'\']='+col.expression.toJavaScript('g',-1);
156
156
  return '';
157
157
  } else if(col.aggregatorid == 'REDUCE') {
158
- return '\''+colas+'\':alasql.aggr[\''+col.funcid+'\']('+colexp+'),';
158
+ query.removeKeys.push('_REDUCE_'+colas);
159
+ return '\''+colas+'\':alasql.aggr[\''+col.funcid+'\']('+colexp+',undefined,(acc={})),'
160
+ +'\'__REDUCE__'+colas+'\':acc,';
159
161
  }
160
162
  return '';
161
163
  } else return '';
@@ -261,7 +263,7 @@ if(false) {
261
263
  } else if(col.aggregatorid == 'AGGR') {
262
264
  return pre+'g[\''+colas+'\']='+col.expression.toJavaScript('g',-1)+';'+post;
263
265
  } else if(col.aggregatorid == 'REDUCE') {
264
- return pre+'g[\''+colas+'\']=alasql.aggr.'+col.funcid+'('+colexp+',g[\''+colas+'\']);'+post;
266
+ return pre+'g[\''+colas+'\']=alasql.aggr.'+col.funcid+'('+colexp+',g[\''+colas+'\'],g[\'__REDUCE__'+colas+'\']);'+post;
265
267
  }
266
268
  return '';
267
269
  } else return '';
package/src/424select.js CHANGED
@@ -20,9 +20,21 @@ function compileSelectStar (query,alias) {
20
20
  // if(!alias) {
21
21
  // sp += 'for(var k1 in p) var w=p[k1];for(var k2 in w){r[k2]=w[k2]};';
22
22
  // } else {
23
- if(query.aliases[alias].tableid) {
24
- var columns = alasql.databases[query.aliases[alias].databaseid].tables[query.aliases[alias].tableid].columns;
25
- };
23
+
24
+ // TODO move this out of this function
25
+ query.ixsources = {};
26
+ query.sources.forEach(function(source){
27
+ query.ixsources[source.alias] = source;
28
+ });
29
+
30
+ var columns = query.ixsources[alias].columns;
31
+
32
+ // if(columns.length == 0 && query.aliases[alias].tableid) {
33
+ // var columns = alasql.databases[query.aliases[alias].databaseid].tables[query.aliases[alias].tableid].columns;
34
+ // };
35
+
36
+
37
+
26
38
  // Check if this is a Table or other
27
39
 
28
40
  if(columns && columns.length > 0) {
@@ -45,8 +57,10 @@ function compileSelectStar (query,alias) {
45
57
  });
46
58
  //console.log(999,columns);
47
59
  } else {
60
+ // console.log(60,alias,columns);
61
+
48
62
  // if column not exists, then copy all
49
- sp += 'var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';
63
+ sp += 'var w=p["'+alias+'"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
50
64
  //console.log(777, sp);
51
65
  query.dirtyColumns = true;
52
66
  }
@@ -219,7 +233,7 @@ yy.Select.prototype.compileSelectGroup1 = function(query) {
219
233
  self.columns.forEach(function(col,idx){
220
234
  // console.log(col);
221
235
  if(col instanceof yy.Column && col.columnid == '*') {
222
- // s += 'for(var k in g){r[k]=g[k]};';
236
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
223
237
  s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
224
238
  // console.log(query);
225
239
  } else {
@@ -297,3 +311,20 @@ yy.Select.prototype.compileSelectGroup2 = function(query) {
297
311
  // console.log('selectg:',s);
298
312
  return new Function('g,params,alasql',s+'return r');
299
313
  }
314
+
315
+ // SELECY * REMOVE [COLUMNS] col-list, LIKE ''
316
+ yy.Select.prototype.compileRemoveColumns = function(query) {
317
+ if(typeof this.removecolumns != 'undefined') {
318
+ query.removeKeys = query.removeKeys.concat(
319
+ this.removecolumns.filter(function (column) {
320
+ return (typeof column.like == 'undefined');
321
+ }).map(function(column){return column.columnid}));
322
+
323
+ //console.log(query.removeKeys,this.removecolumns);
324
+ query.removeLikeKeys = this.removecolumns.filter(function (column) {
325
+ return (typeof column.like != 'undefined');
326
+ }).map(function(column){
327
+ return new RegExp(column.like.value.replace(/\%/g,'.*'),'g');
328
+ });
329
+ }
330
+ }
@@ -172,4 +172,16 @@ alasql.aggr.GROUP_CONCAT = function(v,s){
172
172
  if(typeof s == "undefined") return v; else return s+','+v;
173
173
  };
174
174
 
175
+ alasql.aggr.MEDIAN = function(v,s,acc){
176
+ // Init
177
+ if(typeof acc.arr == 'undefined') {
178
+ acc.arr = [v];
179
+ return v;
180
+ // Pass
181
+ } else {
182
+ acc.arr.push(v);
183
+ var p = acc.arr.sort();
184
+ return p[(p.length/2|0)];
185
+ };
186
+ };
175
187
 
package/src/70insert.js CHANGED
@@ -132,7 +132,7 @@ yy.Insert.prototype.compile = function (databaseid) {
132
132
  });
133
133
  } else {
134
134
  // console.log(222,values);
135
- // sw = 'var w='+JSONtoJavaScript(values)+';for(var k in w){r[k]=w[k]};';
135
+ // sw = 'var w='+JSONtoJavaScript(values)+';for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
136
136
  sw = JSONtoJavaScript(values);
137
137
  }
138
138
  }
package/src/72delete.js CHANGED
@@ -1,3 +1,208 @@
1
+ <<<<<<< HEAD
2
+ /*
3
+ //
4
+ // DELETE for Alasql.js
5
+ // Date: 03.11.2014
6
+ // (c) 2014, Andrey Gershun
7
+ //
8
+ */
9
+
10
+ yy.Delete = function (params) { return yy.extend(this, params); }
11
+ yy.Delete.prototype.toString = function() {
12
+ var s = 'DELETE FROM '+this.table.toString();
13
+ if(this.where) s += ' WHERE '+this.where.toString();
14
+ return s;
15
+ }
16
+
17
+ yy.Delete.prototype.compile = function (databaseid) {
18
+ // console.log(11,this);
19
+ databaseid = this.table.databaseid || databaseid;
20
+ var tableid = this.table.tableid;
21
+ var statement;
22
+ var db = alasql.databases[databaseid];
23
+
24
+
25
+
26
+ if(this.where) {
27
+ // try {
28
+ // console.log(this, 22, this.where.toJavaScript('r',''));
29
+ // } catch(err){console.log(444,err)};
30
+ // var query = {};
31
+ wherefn = new Function('r,params','return ('+this.where.toJavaScript('r','')+')');
32
+ // console.log(wherefn);
33
+ statement = (function (params, cb) {
34
+ if(db.engineid && alasql.engines[db.engineid].deleteFromTable) {
35
+ return alasql.engines[db.engineid].deleteFromTable(databaseid, tableid, wherefn, params, cb);
36
+ }
37
+
38
+ if(alasql.options.autocommit && db.engineid && db.engineid == 'LOCALSTORAGE') {
39
+ alasql.engines[db.engineid].loadTableData(databaseid,tableid);
40
+ }
41
+
42
+ var table = db.tables[tableid];
43
+ // table.dirty = true;
44
+ var orignum = table.data.length;
45
+
46
+ var newtable = [];
47
+ for(var i=0, ilen=table.data.length;i<ilen;i++) {
48
+ if(wherefn(table.data[i],params)) {
49
+ // Check for transaction - if it is not possible then return all back
50
+ if(table.delete) {
51
+ table.delete(i);
52
+ } else {
53
+ // SImply do not push
54
+ }
55
+ } else newtable.push(table.data[i]);
56
+ }
57
+ // table.data = table.data.filter(function(r){return !;});
58
+ table.data = newtable;
59
+ var res = orignum - table.data.length;
60
+ if(alasql.options.autocommit && db.engineid && db.engineid == 'LOCALSTORAGE') {
61
+ alasql.engines[db.engineid].saveTableData(databaseid,tableid);
62
+ }
63
+
64
+ // console.log('deletefn',table.data.length);
65
+ if(cb) cb(res);
66
+ return res;
67
+ });
68
+ // .bind(query);
69
+
70
+ // if(!this.queries) return;
71
+ // query.queriesfn = this.queries.map(function(q) {
72
+ // return q.compile(alasql.useid);
73
+ // });
74
+
75
+ } else {
76
+ statement = function (params, cb) {
77
+ if(alasql.options.autocommit && db.engineid) {
78
+ alasql.engines[db.engineid].loadTableData(databaseid,tableid);
79
+ }
80
+
81
+ var table = db.tables[tableid];
82
+ table.dirty = true;
83
+ var orignum = db.tables[tableid].data.length;
84
+
85
+ table.deleteall();
86
+
87
+ if(alasql.options.autocommit && db.engineid) {
88
+ alasql.engines[db.engineid].saveTableData(databaseid,tableid);
89
+ }
90
+
91
+ if(cb) cb(orignum);
92
+ return orignum;
93
+ };
94
+ };
95
+
96
+ return statement;
97
+
98
+ };
99
+
100
+ yy.Delete.prototype.execute = function (databaseid, params, cb) {
101
+ return this.compile(databaseid)(params,cb);
102
+ }
103
+ ||||||| merged common ancestors
104
+ /*
105
+ //
106
+ // DELETE for Alasql.js
107
+ // Date: 03.11.2014
108
+ // (c) 2014, Andrey Gershun
109
+ //
110
+ */
111
+
112
+ yy.Delete = function (params) { return yy.extend(this, params); }
113
+ yy.Delete.prototype.toString = function() {
114
+ var s = 'DELETE FROM '+this.table.toString();
115
+ if(this.where) s += ' WHERE '+this.where.toString();
116
+ return s;
117
+ }
118
+
119
+ yy.Delete.prototype.compile = function (databaseid) {
120
+ // console.log(11,this);
121
+ databaseid = this.table.databaseid || databaseid;
122
+ var tableid = this.table.tableid;
123
+ var statement;
124
+ var db = alasql.databases[databaseid];
125
+
126
+
127
+
128
+ if(this.where) {
129
+ // try {
130
+ // console.log(this, 22, this.where.toJavaScript('r',''));
131
+ // } catch(err){console.log(444,err)};
132
+ // var query = {};
133
+ wherefn = new Function('r,params','return ('+this.where.toJavaScript('r','')+')');
134
+ // console.log(wherefn);
135
+ statement = (function (params, cb) {
136
+ if(db.engineid && alasql.engines[db.engineid].deleteFromTable) {
137
+ return alasql.engines[db.engineid].deleteFromTable(databaseid, tableid, wherefn, params, cb);
138
+ }
139
+
140
+ if(alasql.options.autocommit && db.engineid && db.engineid == 'LOCALSTORAGE') {
141
+ alasql.engines[db.engineid].loadTableData(databaseid,tableid);
142
+ }
143
+
144
+ var table = db.tables[tableid];
145
+ // table.dirty = true;
146
+ var orignum = table.data.length;
147
+
148
+ var newtable = [];
149
+ for(var i=0, ilen=table.data.length;i<ilen;i++) {
150
+ if(wherefn(table.data[i],params)) {
151
+ // Check for transaction - if it is not possible then return all back
152
+ if(table.delete) {
153
+ table.delete(i);
154
+ } else {
155
+ // SImply do not push
156
+ }
157
+ } else newtable.push(table.data[i]);
158
+ }
159
+ // table.data = table.data.filter(function(r){return !;});
160
+ table.data = newtable;
161
+ var res = orignum - table.data.length;
162
+ if(alasql.options.autocommit && db.engineid && db.engineid == 'LOCALSTORAGE') {
163
+ alasql.engines[db.engineid].saveTableData(databaseid,tableid);
164
+ }
165
+
166
+ // console.log('deletefn',table.data.length);
167
+ if(cb) cb(res);
168
+ return res;
169
+ });
170
+ // .bind(query);
171
+
172
+ // if(!this.queries) return;
173
+ // query.queriesfn = this.queries.map(function(q) {
174
+ // return q.compile(alasql.useid);
175
+ // });
176
+
177
+ } else {
178
+ statement = function (params, cb) {
179
+ if(alasql.options.autocommit && db.engineid) {
180
+ alasql.engines[db.engineid].loadTableData(databaseid,tableid);
181
+ }
182
+
183
+ var table = db.tables[tableid];
184
+ table.dirty = true;
185
+ var orignum = db.tables[tableid].data.length;
186
+
187
+ table.deleteall();
188
+
189
+ if(alasql.options.autocommit && db.engineid) {
190
+ alasql.engines[db.engineid].saveTableData(databaseid,tableid);
191
+ }
192
+
193
+ if(cb) cb(orignum);
194
+ return orignum;
195
+ };
196
+ };
197
+
198
+ return statement;
199
+
200
+ };
201
+
202
+ yy.Delete.prototype.execute = function (databaseid, params, cb) {
203
+ return this.compile(databaseid)(params,cb);
204
+ }
205
+ =======
1
206
  /*
2
207
  //
3
208
  // DELETE for Alasql.js
@@ -100,3 +305,4 @@ yy.Delete.prototype.compile = function (databaseid) {
100
305
  yy.Delete.prototype.execute = function (databaseid, params, cb) {
101
306
  return this.compile(databaseid)(params,cb);
102
307
  }
308
+ >>>>>>> release/0.0.46
package/src/84from.js CHANGED
@@ -75,6 +75,7 @@ alasql.from.HTML = function(selector, opts, cb, idx, query) {
75
75
  alasql.from.RANGE = function(start, finish, cb, idx, query) {
76
76
  var res = [];
77
77
  for(i=start;i<=finish;i++) res.push(i);
78
+ // res = new alasql.Recordset({data:res,columns:{columnid:'_'}});
78
79
  if(cb) res = cb(res, idx, query);
79
80
  return res;
80
81
  }
@@ -88,7 +88,7 @@ NOT\s+LIKE return 'NOT_LIKE'
88
88
  'CLOSE' return 'CLOSE'
89
89
  'COLLATE' return 'COLLATE'
90
90
  "COLUMN" return "COLUMN"
91
- "COLUMNS" return "COLUMNS"
91
+ "COLUMNS" return "COLUMN"
92
92
  "COMMIT" return "COMMIT"
93
93
  "CONSTRAINT" return "CONSTRAINT"
94
94
  "CONTENT" return "CONTENT"
@@ -150,8 +150,6 @@ NOT\s+LIKE return 'NOT_LIKE'
150
150
  'LEFT' return 'LEFT'
151
151
  'LIKE' return 'LIKE'
152
152
  'LIMIT' return 'LIMIT'
153
- 'SOURCE' return 'SOURCE'
154
- 'STRATEGY' return 'STRATEGY'
155
153
  "MATCHED" return "MATCHED"
156
154
  'MATRIX' return 'MATRIX'
157
155
  "MAX" return "MAX"
@@ -185,6 +183,7 @@ NOT\s+LIKE return 'NOT_LIKE'
185
183
  'REDUCE' return 'REDUCE'
186
184
  'REFERENCES' return 'REFERENCES'
187
185
  'RELATIVE' return 'RELATIVE'
186
+ 'REMOVE' return 'REMOVE'
188
187
  'RENAME' return 'RENAME'
189
188
  'REQUIRE' return 'REQUIRE'
190
189
  'RESTORE' return 'RESTORE'
@@ -201,6 +200,8 @@ NOT\s+LIKE return 'NOT_LIKE'
201
200
  'SETS' return 'SETS'
202
201
  'SHOW' return 'SHOW'
203
202
  'SOME' return 'SOME'
203
+ 'SOURCE' return 'SOURCE'
204
+ 'STRATEGY' return 'STRATEGY'
204
205
  'STORE' return 'STORE'
205
206
  "SUM" return "SUM"
206
207
  'TABLE' return 'TABLE'
@@ -460,11 +461,11 @@ WithTable
460
461
  /* SELECT */
461
462
 
462
463
  Select
463
- : SelectClause IntoClause FromClause WhereClause GroupClause OrderClause LimitClause UnionClause
464
+ : SelectClause RemoveClause? IntoClause FromClause WhereClause GroupClause OrderClause LimitClause UnionClause
464
465
  {
465
466
  yy.extend($$,$1); yy.extend($$,$2); yy.extend($$,$3); yy.extend($$,$4);
466
467
  yy.extend($$,$5); yy.extend($$,$6);yy.extend($$,$7);
467
- yy.extend($$,$8);
468
+ yy.extend($$,$8); yy.extend($$,$9);
468
469
  $$ = $1;
469
470
  /* if(yy.exists) $$.exists = yy.exists;
470
471
  delete yy.exists;
@@ -474,6 +475,25 @@ Select
474
475
  | SearchClause SearchFrom? SearchLet? SearchWhile? SearchLimit? SearchStrategy? SearchTimeout?
475
476
  ;
476
477
 
478
+ RemoveClause
479
+ : REMOVE COLUMN? RemoveColumnsList
480
+ { $$ = {removecolumns:$3}; }
481
+ ;
482
+
483
+ RemoveColumnsList
484
+ : RemoveColumnsList COMMA RemoveColumn
485
+ { $$ = $1; $$.push($3); }
486
+ | RemoveColumn
487
+ { $$ = [$1]; }
488
+ ;
489
+
490
+ RemoveColumn
491
+ : Column
492
+ { $$ = $1; }
493
+ | LIKE StringValue
494
+ { $$ = {like:$2}; }
495
+ ;
496
+
477
497
  SearchClause
478
498
  : SearchSelector
479
499
  ;
@@ -1804,9 +1824,9 @@ ShowTables
1804
1824
  ;
1805
1825
 
1806
1826
  ShowColumns
1807
- : SHOW COLUMNS FROM Table
1827
+ : SHOW COLUMN FROM Table
1808
1828
  { $$ = new yy.ShowColumns({table: $4});}
1809
- | SHOW COLUMNS FROM Table FROM Literal
1829
+ | SHOW COLUMN FROM Table FROM Literal
1810
1830
  { $$ = new yy.ShowColumns({table: $4, databaseid:$6});}
1811
1831
  ;
1812
1832