alasql 0.2.6 → 0.2.8
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.
- package/.npm/package/README +7 -0
- package/.npm/package/npm-shrinkwrap.json +626 -0
- package/.versions +4 -0
- package/CHANGELOG.md +18 -5
- package/README.md +2 -2
- package/bin/alasql-cli.js +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql-worker.min.js +1 -1
- package/dist/alasql.d.ts +33 -34
- package/dist/alasql.js +97 -51
- package/dist/alasql.min.js +2 -14
- package/package.js +42 -0
- package/package.json +11 -8
- package/tslint.json +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
* Check https://trello.com/b/qxz65pVi/alasql-roadmap for roadmap
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
_0.2.8 "..." (xx.06.2016)_
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
_0.2.7 "Corinth" (30.05.2016)_
|
|
8
|
+
* Added: Now supports Node 6.0
|
|
9
|
+
* Added: Let .promise return all responses (not just last)
|
|
10
|
+
* Change: Headers set as default true for INTO and FROM statements
|
|
11
|
+
* Fix: Back on track (for good) with supporting Meteor
|
|
12
|
+
* Fix: Default tentative string to numbers conversion when reading data from google spreadsheets
|
|
13
|
+
* Update: No need for empty params when async
|
|
14
|
+
* Update: Better hashing for cashing
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### 0.2.6 "Frikes" (22.04.2016)
|
|
5
18
|
|
|
6
19
|
* Added: Progress callback
|
|
7
20
|
* Change: CLI defaults to pretty print (with option for compressed output as original)
|
|
8
|
-
* Update: CLI output is guaranteed to be valid JSON
|
|
9
|
-
* Update: Better error message for missing table or column
|
|
10
|
-
* Update: Typescript defenition for .promise
|
|
11
|
-
* Update: Empty params not needed for async calls
|
|
12
21
|
* Fix: Declaring all variables
|
|
13
22
|
* Fix: Read XLSX files
|
|
14
23
|
* Fix: Selecting a view from localstorage
|
|
15
24
|
* Fix: CREATE VIEW for localStorage engine
|
|
16
25
|
* Fix: Better use for RequireJS
|
|
26
|
+
* Update: CLI output is guaranteed to be valid JSON
|
|
27
|
+
* Update: Better error message for missing table or column
|
|
28
|
+
* Update: Typescript defenition for .promise
|
|
29
|
+
* Update: Empty params not needed for async calls
|
|
17
30
|
|
|
18
31
|
|
|
19
32
|
### 0.2.5 "Polychrono" (23.03.2016)
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ _Got a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask?
|
|
|
13
13
|
|
|
14
14
|
# AlaSQL
|
|
15
15
|
|
|
16
|
-
<a href="http://alasql.org"><img src="https://cloud.githubusercontent.com/assets/1063454/14003945/d6e56888-f156-11e5-95b9-3035a2538ae8.png" align="left" alt="AlaSQL logo"
|
|
16
|
+
<a href="http://alasql.org"><img src="https://cloud.githubusercontent.com/assets/1063454/14003945/d6e56888-f156-11e5-95b9-3035a2538ae8.png" align="left" alt="AlaSQL logo" /></a>
|
|
17
17
|
|
|
18
18
|
_( [à la](http://en.wiktionary.org/wiki/%C3%A0_la) [SQL](http://en.wikipedia.org/wiki/SQL) ) [ælæ ɛskju:ɛl]_ - AlaSQL is an open source SQL database for Javascript with a strong focus on query speed and datasource flexibility for relational data, schemaless data, and graph data. It works in your browser, Node.js, IO.js and Cordova.
|
|
19
19
|
|
|
@@ -645,6 +645,6 @@ and other people for useful tools, which make our work much easier.
|
|
|
645
645
|
----
|
|
646
646
|
|
|
647
647
|
|
|
648
|
-
<a href="http://alasql.org"><img src="https://cloud.githubusercontent.com/assets/1063454/14003946/d6e5c076-f156-11e5-8238-e62d2a8d20dc.png" align="right" alt="AlaSQL logo"
|
|
648
|
+
<a href="http://alasql.org"><img src="https://cloud.githubusercontent.com/assets/1063454/14003946/d6e5c076-f156-11e5-8238-e62d2a8d20dc.png" align="right" alt="AlaSQL logo"/></a>
|
|
649
649
|
© 2014-2016, Andrey Gershun (agershun@gmail.com) & M. Rangel Wulff (m@rawu.dk)
|
|
650
650
|
|
package/bin/alasql-cli.js
CHANGED
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v0.2.
|
|
1
|
+
//! AlaSQL v0.2.8 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 0.2.
|
|
4
|
+
@version 0.2.8
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
//! AlaSQL v0.2.
|
|
1
|
+
//! AlaSQL v0.2.8 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
!function(e,r){"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?module.exports=r():e.alasql=r()}(this,function(){function e(r,t,s){var a=e.lastid++;e.buffer[a]=s,e.webworker.postMessage({id:a,sql:r,params:t})}return"undefined"==typeof location||!location.reload||"undefined"!=typeof process&&process.browser||"function"==typeof require&&"function"==typeof require.specified||(e.worker=function(r,t,s){if(r===!0&&(r=void 0),"undefined"==typeof r)for(var a=document.getElementsByTagName("script"),o=0;o<a.length;o++){if("alasql-worker.js"===a[o].src.substr(-16).toLowerCase()){r=a[o].src.substr(0,a[o].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===a[o].src.substr(-20).toLowerCase()){r=a[o].src.substr(0,a[o].src.length-20)+"alasql.min.js";break}if("alasql.js"===a[o].src.substr(-9).toLowerCase()){r=a[o].src;break}if("alasql.min.js"===a[o].src.substr(-13).toLowerCase()){r=a[o].src.substr(0,a[o].src.length-13)+"alasql.min.js";break}}if("undefined"==typeof r)throw new Error("Path to alasql.js is not specified");if(r!==!1){var n="importScripts('";n+=r,n+="');self.onmessage = function(event) {alasql(event.data.sql,event.data.params, function(data){postMessage({id:event.data.id, data:data});});}";var i=new Blob([n],{type:"text/plain"});if(e.webworker=new Worker(URL.createObjectURL(i)),e.webworker.onmessage=function(r){var t=r.data.id;e.buffer[t](r.data.data),delete e.buffer[t]},e.webworker.onerror=function(e){throw e},arguments.length>1){var f="REQUIRE "+t.map(function(e){return'"'+e+'"'}).join(",");e(f,[],s)}}else if(r===!1)return void delete e.webworker}),e.lastid=0,e.buffer={},e.worker(),e});
|
package/dist/alasql.d.ts
CHANGED
|
@@ -4,44 +4,43 @@
|
|
|
4
4
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
interface AlaSQLCallback {
|
|
9
|
-
|
|
8
|
+
(data?: any, err?: Error): void;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
interface AlaSQLOptions {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
errorlog: boolean;
|
|
13
|
+
valueof: boolean;
|
|
14
|
+
dropifnotexists: boolean; // drop database in any case
|
|
15
|
+
datetimeformat: string; // how to handle DATE and DATETIME types
|
|
16
|
+
casesensitive: boolean; // table and column names are case sensitive and converted to lower-case
|
|
17
|
+
logtarget: string; // target for log. Values: 'console', 'output', 'id' of html tag
|
|
18
|
+
logprompt: boolean; // print SQL at log
|
|
19
|
+
modifier: any; // values: RECORDSET, VALUE, ROW, COLUMN, MATRIX, TEXTSTRING, INDEX
|
|
20
|
+
columnlookup: number; // how many rows to lookup to define columns
|
|
21
|
+
autovertex: boolean; // create vertex if not found
|
|
22
|
+
usedbo: boolean; // use dbo as current database (for partial T-SQL comaptibility)
|
|
23
|
+
autocommit: boolean; // the AUTOCOMMIT ON | OFF
|
|
24
|
+
cache: boolean; // use cache
|
|
25
|
+
nocount: boolean; // for SET NOCOUNT OFF
|
|
26
|
+
nan: boolean; // check for NaN and convert it to undefined
|
|
27
|
+
angularjs: boolean;
|
|
28
|
+
tsql: boolean;
|
|
29
|
+
mysql: boolean;
|
|
30
|
+
postgres: boolean;
|
|
31
|
+
oracle: boolean;
|
|
32
|
+
sqlite: boolean;
|
|
33
|
+
orientdb: boolean;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
//
|
|
36
|
+
// compiled Statement
|
|
38
37
|
interface AlaSQLStatement {
|
|
39
|
-
|
|
38
|
+
(params?: any, cb?: AlaSQLCallback, scope?: any): any;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
//
|
|
41
|
+
// abstract Syntax Tree
|
|
43
42
|
interface AlaSQLAST {
|
|
44
|
-
|
|
43
|
+
compile(databaseid: string): AlaSQLStatement;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/es6-promise/es6-promise.d.ts
|
|
@@ -52,12 +51,12 @@ interface Thenable<T> {
|
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
interface AlaSQL {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
options: AlaSQLOptions;
|
|
55
|
+
error: Error;
|
|
56
|
+
(sql: any, params?: any, cb?: AlaSQLCallback, scope?: any): any;
|
|
57
|
+
parse(sql): AlaSQLAST;
|
|
58
|
+
promise(sql: any, params?: any): Thenable<any>;
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
declare var alasql
|
|
61
|
+
declare var alasql: AlaSQL;
|
|
63
62
|
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v0.2.
|
|
1
|
+
//! AlaSQL v0.2.8 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 0.2.
|
|
4
|
+
@version 0.2.8
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -85,13 +85,19 @@ SOFTWARE.
|
|
|
85
85
|
alasql().From(data).Where(function(x){return x.a == 10}).exec();
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
|
-
var alasql = function
|
|
88
|
+
var alasql = function(sql, params, cb, scope) {
|
|
89
|
+
|
|
90
|
+
params = params||[];
|
|
89
91
|
|
|
90
92
|
// Avoid setting params if not needed even with callback
|
|
91
93
|
if(typeof params === 'function'){
|
|
92
94
|
scope = cb;
|
|
93
95
|
cb = params;
|
|
94
|
-
params =
|
|
96
|
+
params = [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if(typeof params !== 'object'){
|
|
100
|
+
params = [params];
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
if(typeof importScripts !== 'function' && alasql.webworker) {
|
|
@@ -134,7 +140,7 @@ var alasql = function alasql(sql, params, cb, scope) {
|
|
|
134
140
|
Current version of alasql
|
|
135
141
|
@constant {string}
|
|
136
142
|
*/
|
|
137
|
-
alasql.version = '0.2.
|
|
143
|
+
alasql.version = '0.2.8';
|
|
138
144
|
|
|
139
145
|
/**
|
|
140
146
|
Debug flag
|
|
@@ -3587,28 +3593,22 @@ function isIE () {
|
|
|
3587
3593
|
return (myNav.indexOf('msie') !== -1) ? parseInt(myNav.split('msie')[1]) : false;
|
|
3588
3594
|
}
|
|
3589
3595
|
|
|
3590
|
-
// Fast hash function
|
|
3591
|
-
|
|
3592
3596
|
/**
|
|
3593
|
-
@function Hash string to integer
|
|
3594
|
-
@param {string}
|
|
3597
|
+
@function Hash a string to signed integer
|
|
3598
|
+
@param {string} source string
|
|
3595
3599
|
@return {integer} hash number
|
|
3596
3600
|
*/
|
|
3597
3601
|
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
return h;
|
|
3603
|
-
}
|
|
3602
|
+
// sdbm hash function
|
|
3603
|
+
var hash = utils.hash = function(str){
|
|
3604
|
+
var hash = 5381,
|
|
3605
|
+
i = str.length
|
|
3604
3606
|
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
h = h & h;
|
|
3608
|
-
}
|
|
3607
|
+
while(i)
|
|
3608
|
+
hash = (hash * 33) ^ str.charCodeAt(--i)
|
|
3609
3609
|
|
|
3610
|
-
|
|
3611
|
-
}
|
|
3610
|
+
return hash;
|
|
3611
|
+
}
|
|
3612
3612
|
|
|
3613
3613
|
/**
|
|
3614
3614
|
Union arrays
|
|
@@ -3725,11 +3725,11 @@ var cloneDeep = utils.cloneDeep = function cloneDeep(obj) {
|
|
|
3725
3725
|
return new Date(obj);
|
|
3726
3726
|
}
|
|
3727
3727
|
|
|
3728
|
-
var temp = obj.constructor(); // changed
|
|
3728
|
+
var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
3729
3729
|
|
|
3730
3730
|
for(var key in obj) {
|
|
3731
3731
|
if(obj.hasOwnProperty(key)) {
|
|
3732
|
-
temp[key] = cloneDeep(obj[key]);
|
|
3732
|
+
/* 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]); }
|
|
3733
3733
|
}
|
|
3734
3734
|
}
|
|
3735
3735
|
return temp;
|
|
@@ -3800,7 +3800,7 @@ var extend = utils.extend = function extend (a,b){
|
|
|
3800
3800
|
a = a || {};
|
|
3801
3801
|
for(var key in b) {
|
|
3802
3802
|
if(b.hasOwnProperty(key)) {
|
|
3803
|
-
a[key] = b[key];
|
|
3803
|
+
/* 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]; }
|
|
3804
3804
|
}
|
|
3805
3805
|
}
|
|
3806
3806
|
return a;
|
|
@@ -4441,32 +4441,68 @@ alasql.compile = function(sql, databaseid) {
|
|
|
4441
4441
|
// Promises for AlaSQL
|
|
4442
4442
|
//
|
|
4443
4443
|
|
|
4444
|
-
if(utils.
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4444
|
+
if(!utils.global.Promise){
|
|
4445
|
+
|
|
4446
|
+
if(utils.isNode){
|
|
4447
|
+
utils.global.Promise = require('es6-promise').Promise;
|
|
4448
|
+
} else {
|
|
4449
|
+
/*!
|
|
4450
|
+
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
4451
|
+
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
4452
|
+
* @license Licensed under MIT license
|
|
4453
|
+
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
|
|
4454
|
+
* @version 3.2.1
|
|
4455
|
+
*/
|
|
4456
|
+
(function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function e(t){return"function"==typeof t}function n(t){G=t}function r(t){Q=t}function o(){return function(){process.nextTick(a)}}function i(){return function(){B(a)}}function s(){var t=0,e=new X(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){t.port2.postMessage(0)}}function c(){return function(){setTimeout(a,1)}}function a(){for(var t=0;J>t;t+=2){var e=tt[t],n=tt[t+1];e(n),tt[t]=void 0,tt[t+1]=void 0}J=0}function f(){try{var t=require,e=t("vertx");return B=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[rt]&&k(r);var o=n._state;if(o){var i=arguments[o-1];Q(function(){x(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function v(t){try{return t.then}catch(e){return ut.error=e,ut}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){Q(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===it?S(t,e._result):e._state===st?j(t,e._result):E(e,void 0,function(e){g(t,e)},function(e){j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===et&&constructor.resolve===nt?b(t,n):r===ut?j(t,ut.error):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,_()):t(n)?w(e,n,v(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=it,0!==t._subscribers.length&&Q(T,t))}function j(t,e){t._state===ot&&(t._state=st,t._result=e,Q(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+it]=n,o[i+st]=r,0===i&&t._state&&Q(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function M(){this.error=null}function P(t,e){try{return t(e)}catch(n){return ct.error=n,ct}}function x(t,n,r,o){var i,s,u,c,a=e(r);if(a){if(i=P(r,o),i===ct?(c=!0,s=i.error,i=null):u=!0,n===i)return void j(n,d())}else i=o,u=!0;n._state!==ot||(a&&u?g(n,i):c?j(n,s):t===it?S(n,i):t===st&&j(n,i))}function C(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return at++}function k(t){t[rt]=at++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(t){return new _t(this,t).promise}function q(t){var e=this;return new e(I(t)?function(n,r){for(var o=t.length,i=0;o>i;i++)e.resolve(t[i]).then(n,r)}:function(t,e){e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return j(n,t),n}function D(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function K(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function L(t){this[rt]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&D(),this instanceof L?C(this,t):K())}function N(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[rt]||k(this.promise),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,U())}function U(){return new Error("Array Methods must be provided an Array")}function W(){var t;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=pt)}var z;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B,G,H,I=z,J=0,Q=function(t,e){tt[J]=t,tt[J+1]=e,J+=2,2===J&&(G?G(a):H())},R="undefined"!=typeof window?window:void 0,V=R||{},X=V.MutationObserver||V.WebKitMutationObserver,Z="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),$="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,tt=new Array(1e3);H=Z?o():X?s():$?u():void 0===R&&"function"==typeof require?f():c();var et=l,nt=h,rt=Math.random().toString(36).substring(16),ot=void 0,it=1,st=2,ut=new M,ct=new M,at=0,ft=Y,lt=q,ht=F,pt=L;L.all=ft,L.race=lt,L.resolve=nt,L.reject=ht,L._setScheduler=n,L._setAsap=r,L._asap=Q,L.prototype={constructor:L,then:et,"catch":function(t){return this.then(null,t)}};var _t=N;N.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},N.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===nt){var o=v(t);if(o===et&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===pt){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},N.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===st?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},N.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){n._settledAt(it,e,t)},function(t){n._settledAt(st,e,t)})};var dt=W,vt={Promise:pt,polyfill:dt};"function"==typeof define&&define.amd?define(function(){return vt}):"undefined"!=typeof module&&module.exports?module.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),dt()}).call(this);
|
|
4455
4457
|
|
|
4458
|
+
}
|
|
4456
4459
|
}
|
|
4457
4460
|
|
|
4458
|
-
var promiseExec = function(sql, params){
|
|
4461
|
+
var promiseExec = function(sql, params, counterStep, counterTotal){
|
|
4459
4462
|
return new utils.global.Promise(function(resolve, reject){
|
|
4460
4463
|
alasql(sql, params, function(data,err) {
|
|
4461
4464
|
if(err) {
|
|
4462
4465
|
reject(err);
|
|
4463
4466
|
} else {
|
|
4464
|
-
|
|
4467
|
+
if (counterStep && counterTotal && alasql.options.progress !== false) {
|
|
4468
|
+
alasql.options.progress(counterStep, counterTotal);
|
|
4469
|
+
}
|
|
4470
|
+
resolve(data);
|
|
4465
4471
|
}
|
|
4466
4472
|
});
|
|
4467
4473
|
});
|
|
4468
4474
|
}
|
|
4469
4475
|
|
|
4476
|
+
var promiseAll = function(sqlParamsArray){
|
|
4477
|
+
if(sqlParamsArray.length<1){
|
|
4478
|
+
return ;
|
|
4479
|
+
}
|
|
4480
|
+
|
|
4481
|
+
var active, sql, params;
|
|
4482
|
+
|
|
4483
|
+
var execArray = [];
|
|
4484
|
+
|
|
4485
|
+
for (var i = 0; i < sqlParamsArray.length; i++) {
|
|
4486
|
+
active = sqlParamsArray[i];
|
|
4487
|
+
|
|
4488
|
+
if(typeof active === 'string'){
|
|
4489
|
+
active = [active];
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
if(!utils.isArray(active) || active.length<1 || 2<active.length){
|
|
4493
|
+
throw new Error('Error in .promise parameter');
|
|
4494
|
+
}
|
|
4495
|
+
|
|
4496
|
+
sql = active[0];
|
|
4497
|
+
params = active[1]||undefined;
|
|
4498
|
+
|
|
4499
|
+
execArray.push(promiseExec(sql, params, i, sqlParamsArray.length));
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4502
|
+
return utils.global.Promise.all(execArray);
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
/**
|
|
4470
4506
|
var promiseChain = function(progress, sqlParamsArray, lastPromise){
|
|
4471
4507
|
var active, sql, params;
|
|
4472
4508
|
if(sqlParamsArray.length<1){
|
|
@@ -4496,7 +4532,7 @@ var promiseChain = function(progress, sqlParamsArray, lastPromise){
|
|
|
4496
4532
|
|
|
4497
4533
|
return promiseChain(progress, sqlParamsArray, lastPromise.then(function(){return promiseExec(sql, params)}));
|
|
4498
4534
|
|
|
4499
|
-
}
|
|
4535
|
+
}*/
|
|
4500
4536
|
|
|
4501
4537
|
alasql.promise = function(sql, params) {
|
|
4502
4538
|
if(typeof Promise === "undefined"){
|
|
@@ -4510,13 +4546,15 @@ alasql.promise = function(sql, params) {
|
|
|
4510
4546
|
if(!utils.isArray(sql) || sql.length<1 || typeof params !== "undefined"){
|
|
4511
4547
|
throw new Error('Error in .promise parameters');
|
|
4512
4548
|
}
|
|
4513
|
-
|
|
4549
|
+
/*
|
|
4514
4550
|
var progress = {idx: 0, total: sql.length};
|
|
4515
4551
|
if (alasql.options.progress !== false) {
|
|
4516
4552
|
alasql.options.progress(progress.total, progress.idx++);
|
|
4517
4553
|
}
|
|
4554
|
+
*/
|
|
4555
|
+
return promiseAll(sql);
|
|
4518
4556
|
|
|
4519
|
-
return promiseChain(progress, sql);
|
|
4557
|
+
//return promiseChain(progress, sql);
|
|
4520
4558
|
};
|
|
4521
4559
|
|
|
4522
4560
|
/*
|
|
@@ -5639,7 +5677,8 @@ alasql.srch.SHARP = function(val,args) {
|
|
|
5639
5677
|
|
|
5640
5678
|
alasql.srch.PARENT = function(/*val,args,stope*/) {
|
|
5641
5679
|
// TODO: implement
|
|
5642
|
-
console.log('PARENT not implemented');
|
|
5680
|
+
console.log('PARENT not implemented', arguments);
|
|
5681
|
+
|
|
5643
5682
|
return {status: -1, values: []};
|
|
5644
5683
|
};
|
|
5645
5684
|
|
|
@@ -7988,7 +8027,7 @@ yy.Select.prototype.compileGroup = function(query) {
|
|
|
7988
8027
|
var aft = '', aft2='';
|
|
7989
8028
|
|
|
7990
8029
|
if(typeof query.groupStar !== 'undefined') {
|
|
7991
|
-
aft2 += 'for(var f in p[\''+query.groupStar+'\']) {g[f]=p[\''+query.groupStar+'\'][f];};';
|
|
8030
|
+
aft2 += 'for(var f in p[\''+query.groupStar+'\']) {if(/^__proto__$/.test(f))Object.defineProperty(g,f,{writable:true,enumerable:true,configurable:true});g[f]=p[\''+query.groupStar+'\'][f];};';
|
|
7992
8031
|
};
|
|
7993
8032
|
|
|
7994
8033
|
/*
|
|
@@ -8201,7 +8240,7 @@ function compileSelectStar (query, alias, joinstar) {
|
|
|
8201
8240
|
} else {
|
|
8202
8241
|
|
|
8203
8242
|
// if column not exists, then copy all
|
|
8204
|
-
sp += 'var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';
|
|
8243
|
+
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]};';
|
|
8205
8244
|
|
|
8206
8245
|
query.dirtyColumns = true;
|
|
8207
8246
|
}
|
|
@@ -8446,7 +8485,7 @@ yy.Select.prototype.compileSelectGroup1 = function(query) {
|
|
|
8446
8485
|
|
|
8447
8486
|
if(col instanceof yy.Column && col.columnid === '*') {
|
|
8448
8487
|
|
|
8449
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
8488
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
8450
8489
|
return '';
|
|
8451
8490
|
|
|
8452
8491
|
} else {
|
|
@@ -9803,7 +9842,7 @@ yy.UniOp.prototype.toJS = function(context, tableid, defcols) {
|
|
|
9803
9842
|
yy.Column = function(params) { return yy.extend(this, params); }
|
|
9804
9843
|
yy.Column.prototype.toString = function(dontas) {
|
|
9805
9844
|
var s;
|
|
9806
|
-
if(this.columnid
|
|
9845
|
+
if(this.columnid == +this.columnid) { // jshint ignore:line
|
|
9807
9846
|
s = '['+this.columnid+']';
|
|
9808
9847
|
} else {
|
|
9809
9848
|
s = this.columnid;
|
|
@@ -11133,7 +11172,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
11133
11172
|
// Do UPDATE!!!
|
|
11134
11173
|
|
|
11135
11174
|
table.update(function(t){
|
|
11136
|
-
for(var f in r) t[f] = r[f];
|
|
11175
|
+
for(var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
11137
11176
|
},table.data.indexOf(toreplace),params);
|
|
11138
11177
|
} else {
|
|
11139
11178
|
table.data.push(r);
|
|
@@ -13694,7 +13733,7 @@ function loghtml(res) {
|
|
|
13694
13733
|
s += '<tr><th>'+(i+1);
|
|
13695
13734
|
cols.forEach(function(colid){
|
|
13696
13735
|
s += '<td> ';
|
|
13697
|
-
if(
|
|
13736
|
+
if(res[i][colid] == +res[i][colid]) { // jshint ignore:line
|
|
13698
13737
|
s += '<div style="text-align:right">';
|
|
13699
13738
|
if(typeof res[i][colid] === 'undefined'){
|
|
13700
13739
|
s += 'NULL';
|
|
@@ -14004,7 +14043,7 @@ alasql.into.SQL = function(filename, opts, data, columns, cb) {
|
|
|
14004
14043
|
alasql.into.HTML = function(selector, opts, data, columns, cb) {
|
|
14005
14044
|
var res = 1;
|
|
14006
14045
|
if(typeof exports != 'object') {
|
|
14007
|
-
var opt = {};
|
|
14046
|
+
var opt = {headers:true};
|
|
14008
14047
|
alasql.utils.extend(opt, opts);
|
|
14009
14048
|
|
|
14010
14049
|
var sel = document.querySelector(selector);
|
|
@@ -14108,7 +14147,7 @@ alasql.into.CSV = function(filename, opts, data, columns, cb) {
|
|
|
14108
14147
|
filename = undefined;
|
|
14109
14148
|
}
|
|
14110
14149
|
|
|
14111
|
-
var opt = {};
|
|
14150
|
+
var opt = {headers:true};
|
|
14112
14151
|
//opt.separator = ',';
|
|
14113
14152
|
opt.separator = ';';
|
|
14114
14153
|
opt.quote = '"';
|
|
@@ -14160,7 +14199,7 @@ alasql.into.XLS = function(filename, opts, data, columns, cb) {
|
|
|
14160
14199
|
};
|
|
14161
14200
|
|
|
14162
14201
|
// Default sheet
|
|
14163
|
-
var sheet = {};
|
|
14202
|
+
var sheet = {headers:true};
|
|
14164
14203
|
if(typeof sheets['Sheet1'] != 'undefined') {
|
|
14165
14204
|
sheet = sheets[0];
|
|
14166
14205
|
} else {
|
|
@@ -15024,6 +15063,13 @@ alasql.from.TABLETOP = function(key, opts, cb, idx, query) {
|
|
|
15024
15063
|
var opt = {headers:true, simpleSheet:true, key:key};
|
|
15025
15064
|
alasql.utils.extend(opt, opts);
|
|
15026
15065
|
opt.callback = function(data){
|
|
15066
|
+
for(var i=0; i<data.length; i++) {
|
|
15067
|
+
for (var prop in data[i]) {
|
|
15068
|
+
if(data[i][prop] == +data[i][prop] && data[i].hasOwnProperty(prop)){ // jshint ignore:line
|
|
15069
|
+
data[i][prop] = +data[i][prop];
|
|
15070
|
+
}
|
|
15071
|
+
}
|
|
15072
|
+
}
|
|
15027
15073
|
res = data;
|
|
15028
15074
|
if(cb){
|
|
15029
15075
|
res = cb(res, idx, query);
|
|
@@ -15031,7 +15077,7 @@ alasql.from.TABLETOP = function(key, opts, cb, idx, query) {
|
|
|
15031
15077
|
};
|
|
15032
15078
|
|
|
15033
15079
|
Tabletop.init(opt);
|
|
15034
|
-
return
|
|
15080
|
+
return null;
|
|
15035
15081
|
};
|
|
15036
15082
|
|
|
15037
15083
|
alasql.from.HTML = function(selector, opts, cb, idx, query) {
|