Skip to content

Commit

Permalink
Merge branch 'release/0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
agershun committed May 11, 2015
2 parents 3ace6ae + 067709c commit 6ff5fef
Show file tree
Hide file tree
Showing 74 changed files with 6,423 additions and 2,524 deletions.
4 changes: 2 additions & 2 deletions .bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alasql",
"description":"AlaSQL.js - JavaScript SQL database library for relational and graph data with support of localStorage, IndexedDB, and Excel",
"version": "0.1.3",
"description":"AlaSQL.js - JavaScript SQL database library for relational and graph data manipulation with support of localStorage, IndexedDB, and Excel",
"version": "0.1.4",
"license": "MIT",
"keywords": [
"sql",
Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
# Changelog

### 0.1.4 "Napoli" (09.05.2015 - 11.05.2015)
* Convert Meteor/Mongo collections on the fly
* Added METEOR() from-function
* Fixed $[0] -> $0 for parameters
* utils/2ch.js - utility for minification of AlaSQL (calculate size of economy)
* d3 graph path samples
* alasql.options.autovertex flag - create vertices if not found
* EQ() selector
* LIKE selector
* RETURNS selector - return record with columns like in SELECT
* ALL() and ANY() selectors
* Added CREATE TABLE column UNIQUE constraint on INSERT/DELETE/UPDATE
* Added OBJECT_ID() function (like in T-SQL)
* Added parts and optional for specific database compatibility
* Changed REFERENCES syntax
* dbo always as default database (for some compatibility with T-SQL)
* NOT NULL check on INSERT/UPDATE
* CHECK constraint (for whole table)
* CURRENT_TIMESTAMP function
* UNIQUE constraint (whole table)
* VARCHAR(MAX)
* CHECK constraint for columns
* FOREIGN KEYS for columns and tables

### 0.1.3 "Vaticano" (08.05.2015 - 09.05.2015)
* Check for null values for SEACRH
* Check for null values for SEARCH
* ORDER BY for SEARCH operator
* Brackets for SEARCH selectors (WITH() selector)
* SEARCH DISTINCT, UNION ALL, UNION selectors
Expand Down
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AlaSQL.js - JavaScript SQL database library for relational and graph data manipulation with support of localStorage, IndexedDB, and Excel

Version: 0.1.3 "Vaticano" Date: May 9, 2015 [Change log](CHANGELOG.md), [Release plan](RELEASES.md)
Version: 0.1.4 "Napoli" Date: May 11, 2015 [Change log](CHANGELOG.md), [Release plan](RELEASES.md)

AlaSQL - '[à la SQL](http://en.wiktionary.org/wiki/%C3%A0_la)' - is a lightweight JavaScript SQL database designed to work in browser, Node.js, and Apache Cordova. It supports traditional SQL with some NoSQL functionality. Current version of AlaSQL can work in memory and use file, IndexedDB, and localStorage as a persistent storage.

Expand Down Expand Up @@ -49,6 +49,26 @@ Check AlaSQL vs other JavaScript SQL databases and data processing libraries:

## What is new?

### AlaSQL and Meteor Mongo collections

Now you can use Meteor collections as agruments. To do it simply store alasql.min.js to the client/lib directory and then apply SQL to Meteor Collections:

```js
Template.body.helpers({
tasks: function () {
return alasql('SELECT * FROM ?',[Tasks]);
}
});
```

Or you can use with find() options with special METEOR() from-function:
```
return alasql('SELECT * FROM ?',[Tasks]);
return alasql('SELECT * FROM METEOR(?)',[Tasks]);
return alasql('SELECT * FROM METEOR(?,?)',[Tasks,{text:"Hello world!"}]);
return alasql('SELECT * FROM METEOR(?,{text:"Hello world!"})',[Tasks]);
```

### Search paths in graph

Now you can search graphs with SEARCH operator:
Expand All @@ -59,7 +79,7 @@ Now you can search graphs with SEARCH operator:
#Kate >> #Julia, #Alex >> #Paloma, #Napoleon > "loves" > #Josephine, \
#Josephine >"knows"> #Pablo');

var res = alasql('SEARCH #Napoleon PATH(#Pablo) name');
var res = alasql('SEARCH PATH(#Pablo) name FROM #Napoleon ');
// returns ['loves','Josephine','knows','Pablo']
```
You can play with grpahs in AlaSQL in [this jsFiddle example](http://jsfiddle.net/fgzya692/1/).
Expand All @@ -76,15 +96,15 @@ how to create graph:
and search over it with SEARCH operator:
```js
// Whom loves Olga?
alasql('SEARCH #Olga >> name');
alasql('SEARCH / #Olga >> name');
// ['Pablo']

// Whom loves Olga's love objects?
alasql('SEARCH #Olga >> >> name');
alasql('SEARCH / #Olga >> >> name');
// ['Alice']

// Who loves lovers of Alice?
alasql('SEARCH ANY(>> >> #Alice) name');
alasql('SEARCH / ANY(>> >> #Alice) name');
// ['Olga','Helen']

```
Expand Down Expand Up @@ -782,7 +802,6 @@ You can check next version branches for new experimental features.

1. ORDER BY clause on three or more UNIONS ( [See example in AlaSQL console](http://alasql.org/console?select 10 as a union all select 20 as a union all select 30 as a order by a desc) )
2. Limited functionality for transactions (supports only for localStorage) - Sorry, transactions are limited, because AlaSQL started to use more complex approach for PRIMARY KEYS / FOREIGN KEYS. Transactions will be fully turned on again in one of the future version.
3. Functionality of FOREIGN KEY, UNIQUE INDEX and CHECK conctraints is not realized in fully.


Probably, there are many of others. Please, [give me a chance](https://github.com/agershun/alasql/issues) to fix them. Thank you!
Expand Down
20 changes: 11 additions & 9 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
1. Bugs, Speed, Memory Leaks, Better Code, JsDoc, Errors handling, Library Size, Compatibility (Browsers, Mobiles, SQLs)
2. Documentation, alasql.org website, Social Media, Alasql promotion, Article, Coockbook, Tutorial
3. IF problem, UNION bug, merge algorithms, utilities, Prettify, Console, Alacon
4. Primary Key/Foreign Key/Unique Index/Autoincrement/Default
5. Transactions
6. PIVOT, UNPIVOT, GROUP BY TOTAL, DETAIL, GROUP BY HIERARCHY
7. WebSQL and pass-thru databases, better support of with IndexedDB and NeDB, WebWorkers
8. SYNC, optimiztic blocking
9. Linq, NoSQL, and MongoDB functions
10. Streams, cursors,while, Console
4. Transactions
5. PIVOT, UNPIVOT, GROUP BY TOTAL, DETAIL, GROUP BY HIERARCHY
6. WebSQL and pass-thru databases, better support of with IndexedDB and NeDB, WebWorkers
7. SYNC, optimiztic blocking
8. Linq, NoSQL, and MongoDB functions
9. Streams, cursors,while, Console

## Next Releases:

### Version "Firenze" 0.1.2 (9.05.2015)
* CREATE GRAPH
1. Meteor package
2. Documentation, Bugs, Size
3. SQLLOGIC Tests
4. Like-OrientDB functionality
5. ADD COLUMN Problem
66 changes: 66 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,72 @@ This file contanis unstructured ideas for future development of AlaSQL.

## Ideas

Meteor Package
GEFX






Constraints:
IS NULL / IS NOT NULL
CHECK

----------

Realize OBJECT_ID

IF OBJECT_ID('dbo.Employees') IS NOT NULL
DROP TABLE dbo.Employees;

IF OBJECT_ID('dbo.VSortedOrders', 'V') IS NOT NULL
DROP VIEW dbo.VSortedOrders;
GO




2-chars

Q: How UNION works? - disstinct or only new? - solved
Check UnionDeep and arrayDistinct


SEARCH @p name;
SEARCH UNION(/a,/b) FROM @p;
SEARCH / "Name";
SEARCH name;
SEARCH / name;
SEARCH ;
SEARCH DISTINCT(name);


AlaLISP
AlaPROLOG / RDF

age 35.
name X :- age X.
:- age X.

EDGE
VERTEX
CLUSTER
FACT
RULE

PROLOGUE
=========
:- papa loves apples;
RULE :- ;
SEARCH papa loves @p, WHERE(@p IN ['Apples'])

FACT [John] buys [Apples],[John] buys [Nuts];
SEARCH [John] buys @x
[{x:'Apples'},x:'Nuts'];






Expand Down
2,058 changes: 1,297 additions & 761 deletions alasql.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions console/alasql.min.js

Large diffs are not rendered by default.

2,058 changes: 1,297 additions & 761 deletions dist/alasql.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion dist/alasql.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/alasql.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ gulp.task('js-merge', function () {
'./src/79set.js',
'./src/80console.js',
'./src/81commit.js',
'./src/821tsql.js',
'./src/822mysql.js',
'./src/823postgres.js',
'./src/824oracle.js',
'./src/825sqlite.js',
'./src/830into.js',
'./src/831xls.js',
'./src/832xlsxml.js',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alasql",
"description": "AlaSQL.js - JavaScript SQL database library for relational and graph data with support of localStorage, IndexedDB, and Excel",
"version": "0.1.3",
"description": "AlaSQL.js - JavaScript SQL database library for relational and graph data manipulation with support of localStorage, IndexedDB, and Excel",
"version": "0.1.4",
"author": "Andrey Gershun <[email protected]>",
"directories": {
"example": "examples",
Expand Down
4 changes: 2 additions & 2 deletions src/05copyright.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//
// alasql.js
// AlaSQL - JavaScript SQL database
// Date: 9.05.2015
// Version: 0.1.3
// Date: 11.05.2015
// Version: 0.1.4
// (ñ) 2014-2015, Andrey Gershun
//

Expand Down
2 changes: 1 addition & 1 deletion src/10start.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ var alasql = function(sql, params, cb, scope) {
};

/** Current version of alasql */
alasql.version = "0.1.3";
alasql.version = "0.1.4";

17 changes: 17 additions & 0 deletions src/15utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,3 +741,20 @@ var domEmptyChildren = utils.domEmptyChildren = function (container){
};
};

var distinctArray = utils.distinctArray = function(data) {
var uniq = {};
// TODO: Speedup, because Object.keys is slow
for(var i=0,ilen=data.length;i<ilen;i++) {
if(typeof data[i] == 'object') {
var uix = Object.keys(data[i]).sort().map(function(k){return k+'`'+data[i][k]}).join('`');
} else {
var uix = data[i];
}
uniq[uix] = data[i];
};
var res = [];
for(var key in uniq) res.push(uniq[key]);
return res;
}


27 changes: 23 additions & 4 deletions src/17alasql.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,32 @@ alasql.options.logprompt = true; // Print SQL at log
alasql.options.modifier = undefined;
// How many rows to lookup to define columns
alasql.options.columnlookup = 10;
// Create vertex if not found
alasql.options.autovertex = true;

//alasql.options.worker = false;
// Variables
alasql.vars = {};
alasql.declares = {};
// Use dbo as current database (for partial T-SQL comaptibility)
alasql.options.usedbo = true;

// AUTOCOMMIT ON | OFF
alasql.options.autocommit = true;

// Use cache
alasql.options.cache = true;

// Compatibility flags
alasql.options.tsql = true;
alasql.options.mysql = true;
alasql.options.postgres = true;
alasql.options.oracle = true;
alasql.options.sqlite = true;
alasql.options.orientdb = true;

//alasql.options.worker = false;
// Variables
alasql.vars = {};
alasql.declares = {};


alasql.prompthistory = [];

alasql.from = {}; // FROM functions
Expand Down Expand Up @@ -97,6 +112,10 @@ alasql.use = function (databaseid) {
alasql.tables = db.tables;
// alasql.fn = db.fn;
db.resetSqlCache();
if(alasql.options.usedbo) {
alasql.databases.dbo = db; // Operator???
}

};

// Run one statement
Expand Down
Loading

0 comments on commit 6ff5fef

Please sign in to comment.