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/console/alasql.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // alasql.js
3
3
  // AlaSQL - JavaScript SQL database
4
4
  // Date: 16.04.2015
5
- // Version: 0.0.47
5
+ // Version: 0.0.52
6
6
  // (ñ) 2014-2015, Andrey Gershun
7
7
  //
8
8
 
@@ -111,7 +111,7 @@ var alasql = function(sql, params, cb, scope) {
111
111
  };
112
112
 
113
113
  /** Current version of alasql */
114
- alasql.version = "0.0.47";
114
+ alasql.version = "0.0.52";
115
115
 
116
116
 
117
117
 
@@ -2964,11 +2964,11 @@ var cloneDeep = utils.cloneDeep = function cloneDeep(obj) {
2964
2964
  if(obj == null || typeof(obj) != 'object')
2965
2965
  return obj;
2966
2966
 
2967
- var temp = obj.constructor(); // changed
2967
+ var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
2968
2968
 
2969
2969
  for(var key in obj) {
2970
2970
  if(obj.hasOwnProperty(key)) {
2971
- temp[key] = cloneDeep(obj[key]);
2971
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(temp, key, {value: cloneDeep(obj[key]), writable: true, enumerable: true, configurable: true}); } else { temp[key] = cloneDeep(obj[key]); }
2972
2972
  }
2973
2973
  }
2974
2974
  return temp;
@@ -3048,7 +3048,7 @@ var extend = utils.extend = function extend (a,b){
3048
3048
  if(typeof a == 'undefined') a = {};
3049
3049
  for(key in b) {
3050
3050
  if(b.hasOwnProperty(key)) {
3051
- a[key] = b[key]
3051
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(a, key, {value: b[key], writable: true, enumerable: true, configurable: true}); } else { a[key] = b[key]; }
3052
3052
  }
3053
3053
  }
3054
3054
  return a;
@@ -6230,7 +6230,7 @@ function compileSelectStar (query,alias) {
6230
6230
  //console.log(999,columns);
6231
6231
  } else {
6232
6232
  // if column not exists, then copy all
6233
- sp += 'var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';
6233
+ 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]};';
6234
6234
  //console.log(777, sp);
6235
6235
  query.dirtyColumns = true;
6236
6236
  }
@@ -6403,7 +6403,7 @@ yy.Select.prototype.compileSelectGroup1 = function(query) {
6403
6403
  self.columns.forEach(function(col,idx){
6404
6404
  // console.log(col);
6405
6405
  if(col instanceof yy.Column && col.columnid == '*') {
6406
- // s += 'for(var k in g){r[k]=g[k]};';
6406
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
6407
6407
  s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
6408
6408
  // console.log(query);
6409
6409
  } else {
@@ -9169,7 +9169,7 @@ yy.Insert.prototype.compile = function (databaseid) {
9169
9169
  });
9170
9170
  } else {
9171
9171
  // console.log(222,values);
9172
- // sw = 'var w='+JSONtoJavaScript(values)+';for(var k in w){r[k]=w[k]};';
9172
+ // 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]};';
9173
9173
  sw = JSONtoJavaScript(values);
9174
9174
  }
9175
9175
  }