Skip to content

Commit

Permalink
Merge branch 'release/0.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrw committed Aug 17, 2017
2 parents 940c321 + 821196e commit 3312b9f
Show file tree
Hide file tree
Showing 20 changed files with 8,468 additions and 8,243 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ branches:
language: node_js
node_js:
- "node"
- "7"
- "6"
- "5"
- "4"
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Changelog


_0.4.1 "....." (xx.08.2017)_
_0.4.3 "Hajjah" (xx.08.2017)_

* ...

## 0.4.2 "Baraqish" (xx.08.2017)

* Added: SQL function LTRIM
* Added: SQL function RTRIM
* Better: Remove implicit any in type script definitioni
* Better: Out-of-the-box Webpack and Browserify compatibility without hacks
* Fix: Use created database id on foreign key check as default database


## 0.4.1 "Sayhut" (23.07.2017)

Expand Down
43 changes: 28 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ The results are good. Check out AlaSQL vs. other JavaScript SQL databases:

* **2x speed** [compared to Linq](http://jsperf.com/alasql-vs-linq-on-groupby/3) for `GROUP BY` on 1,048,576 rows

Please remember to set indexes on your tables to speed up your queries. [Have a look here](https://www.tutorialspoint.com/sql/sql-indexes.htm) [SQL Index(http://www.guru99.com/indexes.html) if you are unfamiliar with this concept.
Please remember to set indexes on your tables to speed up your queries. [Have a look here](https://www.tutorialspoint.com/sql/sql-indexes.htm) and [SQL Index](http://www.guru99.com/indexes.html) page if you are unfamiliar with this concept (this is a part of [SQL Tutorial](http://www.guru99.com/sql.html)).


See more [speed related info on the wiki](https://github.com/agershun/alasql/wiki/Speed)
Expand Down Expand Up @@ -346,7 +346,7 @@ Pinpointing data on a map should be easy. AlaSQL is great to prepare source data
### AlaSQL ♥ Google Spreadsheets
AlaSQL can query data directly from a Google spreadsheet. A good "partnership" for easy editing and powerfull data manipulation. See more about [Google Spreadsheets and AlaSQL in the wiki](https://github.com/agershun/alasql/wiki/Google-maps)
AlaSQL can query data directly from a Google spreadsheet. A good "partnership" for easy editing and powerfull data manipulation. See more about [Google Spreadsheets and AlaSQL in the wiki](https://github.com/agershun/alasql/wiki/Google-Spreadsheets)
Expand Down Expand Up @@ -455,21 +455,34 @@ If using AlaSQL as Web Worker, you can import it traditionally as a script:
### Webpack, Browserify and React (Native)
### Use Webpack and Browserify
To use AlaSQL within a `create-react-app` (CRA) setup **without** ejecting it is: Please [have a look at this comment](https://github.com/agershun/alasql/issues/930#issuecomment-322413745).
When targeting the browser, several code bundlers like Webpack and Browserify will pick up modules you might not want.
Here's a list of modules that AlaSQL requires:
* fs
* cptable
* jszip
* xlsx
* cpexcel
* path
* es6-promise
* net
* tls
Here's a list of modules that AlaSQL may require in certain enviroments or for certain features:
* Node.js
* fs
* net
* tls
* request
* path
* React Native
* react-native
* react-native-fs
* react-native-fetch-blob
* Vertx
* vertx
* Agonostic
* XLSX/XLS support
* cptable
* jszip
* xlsx
* cpexcel
* es6-promise
#### Webpack
Expand All @@ -486,8 +499,8 @@ var IgnorePlugin = require("webpack").IgnorePlugin;
module.exports = {
...
//Will ignore the modules fs, path, xlsx
plugins:[new IgnorePlugin(/(^fs$|cptable|jszip|xlsx|^es6-promise$|^net$|^tls$|^forever-agent$|^tough-cookie$|cpexcel|^path$)/)]
//Will ignore the modules fs, path, xlsx, request, vertx, and react-native modules
plugins:[new IgnorePlugin(/(^fs$|cptable|jszip|xlsx|^es6-promise$|^net$|^tls$|^forever-agent$|^tough-cookie$|cpexcel|^path$|^request$|react-native|^vertx$)/)]
};
```
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@
"bin",
"lib"
],
"version": "0.4.1"
"version": "0.4.2"
}
4 changes: 2 additions & 2 deletions dist/alasql-worker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! AlaSQL v0.4.1 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
//! AlaSQL v0.4.2 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version 0.4.1
@version 0.4.2
AlaSQL - JavaScript SQL database
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
Expand Down
2 changes: 1 addition & 1 deletion dist/alasql-worker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions dist/alasql.fs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! AlaSQL v0.4.1 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
//! AlaSQL v0.4.2 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version 0.4.1
@version 0.4.2

AlaSQL - JavaScript SQL database
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
Expand Down Expand Up @@ -137,7 +137,7 @@ var alasql = function(sql, params, cb, scope) {
Current version of alasql
@constant {string}
*/
alasql.version = '0.4.1';
alasql.version = '0.4.2';

/**
Debug flag
Expand Down Expand Up @@ -10625,7 +10625,17 @@ stdlib.LEN = stdlib.LENGTH = function(s) {return und(s,'y.length');}
stdlib.LOWER = stdlib.LCASE = function(s) {return und(s,'String(y).toLowerCase()');}
//stdlib.LCASE = function(s) {return '('+s+').toLowerCase()';}

// LTRIM
// Returns a character expression after it removes leading blanks.
// see https://docs.microsoft.com/en-us/sql/t-sql/functions/ltrim-transact-sql
stdlib.LTRIM = function(s) {
return und(s, 'y.replace(/^[ ]+/,"")');
}

// Returns a character string after truncating all trailing spaces.
// see https://docs.microsoft.com/en-us/sql/t-sql/functions/rtrim-transact-sql
stdlib.RTRIM = function(s) {
return und(s, 'y.replace(/[ ]+$/,"")');
}

stdlib.MAX = stdlib.GREATEST = function(){
return 'Math.max('+Array.prototype.join.call(arguments, ',')+')'
Expand Down Expand Up @@ -11327,7 +11337,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
if(col.foreignkey) {

var fk = col.foreignkey.table;
var fktable = alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];
var fktable = alasql.databases[fk.databaseid||databaseid].tables[fk.tableid];
if(typeof fk.columnid === 'undefined') {
if(fktable.pk.columns && fktable.pk.columns.length >0 ){
fk.columnid = fktable.pk.columns[0];
Expand Down Expand Up @@ -11403,7 +11413,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
if(con.fkcolumns && con.fkcolumns.length>0){
fk.columnid = con.fkcolumns[0];
}
var fktable = alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];
var fktable = alasql.databases[fk.databaseid||databaseid].tables[fk.tableid];
if(typeof fk.columnid === 'undefined') {
fk.columnid = fktable.pk.columns[0];
}
Expand Down
22 changes: 16 additions & 6 deletions dist/alasql.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! AlaSQL v0.4.1 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
//! AlaSQL v0.4.2 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version 0.4.1
@version 0.4.2

AlaSQL - JavaScript SQL database
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
Expand Down Expand Up @@ -137,7 +137,7 @@ var alasql = function(sql, params, cb, scope) {
Current version of alasql
@constant {string}
*/
alasql.version = '0.4.1';
alasql.version = '0.4.2';

/**
Debug flag
Expand Down Expand Up @@ -10625,7 +10625,17 @@ stdlib.LEN = stdlib.LENGTH = function(s) {return und(s,'y.length');}
stdlib.LOWER = stdlib.LCASE = function(s) {return und(s,'String(y).toLowerCase()');}
//stdlib.LCASE = function(s) {return '('+s+').toLowerCase()';}

// LTRIM
// Returns a character expression after it removes leading blanks.
// see https://docs.microsoft.com/en-us/sql/t-sql/functions/ltrim-transact-sql
stdlib.LTRIM = function(s) {
return und(s, 'y.replace(/^[ ]+/,"")');
}

// Returns a character string after truncating all trailing spaces.
// see https://docs.microsoft.com/en-us/sql/t-sql/functions/rtrim-transact-sql
stdlib.RTRIM = function(s) {
return und(s, 'y.replace(/[ ]+$/,"")');
}

stdlib.MAX = stdlib.GREATEST = function(){
return 'Math.max('+Array.prototype.join.call(arguments, ',')+')'
Expand Down Expand Up @@ -11327,7 +11337,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
if(col.foreignkey) {

var fk = col.foreignkey.table;
var fktable = alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];
var fktable = alasql.databases[fk.databaseid||databaseid].tables[fk.tableid];
if(typeof fk.columnid === 'undefined') {
if(fktable.pk.columns && fktable.pk.columns.length >0 ){
fk.columnid = fktable.pk.columns[0];
Expand Down Expand Up @@ -11403,7 +11413,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
if(con.fkcolumns && con.fkcolumns.length>0){
fk.columnid = con.fkcolumns[0];
}
var fktable = alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];
var fktable = alasql.databases[fk.databaseid||databaseid].tables[fk.tableid];
if(typeof fk.columnid === 'undefined') {
fk.columnid = fktable.pk.columns[0];
}
Expand Down
12 changes: 6 additions & 6 deletions dist/alasql.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "alasql",
"description": "Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV",
"version": "0.4.1",
"version": "0.4.2",
"author": "Andrey Gershun <[email protected]>",
"contributors": [
"Mathias Rangel Wulff <[email protected]>"
],
"directories": {
"test": "test"
},
"browser": "./dist/alasql.js",
"scripts": {
"test": "gulp && cd test && mocha . --reporter dot",
"test:this": "gulp && cd test && mocha",
Expand All @@ -20,7 +21,7 @@
"build:watch": "gulp watch",
"bump": "mversion --no-prefix",
"uptodate": "npm-check -u --skip-unused",
"release": "f='/TMP/alasql.tmp' && curl https://raw.githubusercontent.com/wiki/agershun/alasql/How-to-release.md > $f && sh $f ; rm $f",
"release": "f='/tmp/alasql.tmp' && curl https://raw.githubusercontent.com/wiki/agershun/alasql/How-to-release.md > $f && sh $f ; rm $f",
"jison": "jison ./src/alasqlparser.jison -o ./src/alasqlparser.js"
},
"dependencies": {
Expand Down
12 changes: 11 additions & 1 deletion src/55functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,17 @@ stdlib.LOWER = stdlib.LCASE = function(s) {return und(s,'String(y).toLowerCase()
//stdlib.LCASE = function(s) {return '('+s+').toLowerCase()';}


// LTRIM
// Returns a character expression after it removes leading blanks.
// see https://docs.microsoft.com/en-us/sql/t-sql/functions/ltrim-transact-sql
stdlib.LTRIM = function(s) {
return und(s, 'y.replace(/^[ ]+/,"")');
}

// Returns a character string after truncating all trailing spaces.
// see https://docs.microsoft.com/en-us/sql/t-sql/functions/rtrim-transact-sql
stdlib.RTRIM = function(s) {
return und(s, 'y.replace(/[ ]+$/,"")');
}

stdlib.MAX = stdlib.GREATEST = function(){
return 'Math.max('+Array.prototype.join.call(arguments, ',')+')'
Expand Down
4 changes: 2 additions & 2 deletions src/60createtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
if(col.foreignkey) {
// console.log(138,col.foreignkey);
var fk = col.foreignkey.table;
var fktable = alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];
var fktable = alasql.databases[fk.databaseid||databaseid].tables[fk.tableid];
if(typeof fk.columnid === 'undefined') {
if(fktable.pk.columns && fktable.pk.columns.length >0 ){
fk.columnid = fktable.pk.columns[0];
Expand Down Expand Up @@ -253,7 +253,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
if(con.fkcolumns && con.fkcolumns.length>0){
fk.columnid = con.fkcolumns[0];
}
var fktable = alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];
var fktable = alasql.databases[fk.databaseid||databaseid].tables[fk.tableid];
if(typeof fk.columnid === 'undefined') {
fk.columnid = fktable.pk.columns[0];
}
Expand Down
2 changes: 1 addition & 1 deletion test/coverage/coverage.json

Large diffs are not rendered by default.

Loading

0 comments on commit 3312b9f

Please sign in to comment.