Skip to content

Commit 00cf108

Browse files
committed
version 0.0.45
1 parent 11efcc6 commit 00cf108

File tree

4 files changed

+85
-85
lines changed

4 files changed

+85
-85
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
### 0.0.45 "Rio de Janeiro" (14.04.2015 - ...04.2015)
4-
* Added Bower package
4+
* Changed CRLF for alacon.js and alaserver.js to LF
55

66
### 0.0.44 "Roma" (02.04.2015 - 13.04.2015)
77
* Added params to SQLite attached database: alasql('ATTACH SQLITE DATABASE a(?)',[event],cb);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "alasql",
33
"description": "Alasql - JavaScript SQL database and data manipulation library",
4-
"version": "0.0.44",
4+
"version": "0.0.45",
55
"author": "Andrey Gershun <[email protected]>",
66
"directories": {
77
"example": "examples",

src/05copyright.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// alasql.js
33
// AlaSQL - JavaScript SQL database
44
// Date: 13.04.2015
5-
// Version: 0.0.44
5+
// Version: 0.0.45
66
// (ñ) 2014-2015, Andrey Gershun
77
//
88

src/10start.js

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,82 @@
1-
2-
/**
3-
UMD envelope
4-
*/
5-
6-
(function (root, factory) {
7-
if (typeof define === 'function' && define.amd) {
8-
define([], factory);
9-
} else if (typeof exports === 'object') {
10-
module.exports = factory();
11-
} else {
12-
root.alasql = factory();
13-
}
14-
}(this, function () {
15-
16-
/**
17-
alasql - Main Alasql class
18-
@param {string | Object} sql SQL-statement or data object for fuent interface
19-
@param {Object} params SQL parameters
20-
@param {Function} cb callback function
21-
@param {Object} scope Scope for nested queries
22-
@return {array} Result data object
23-
24-
Standard sync call:
25-
alasql('CREATE TABLE one');
26-
Query:
27-
var res = alasql('SELECT * FROM one');
28-
Call with parameters:
29-
var res = alasql('SELECT * FROM ?',[data]);
30-
Standard async call with callback function:
31-
alasql('SELECT * FROM ?',[data],function(res){
32-
console.log(data);
33-
});
34-
Call with scope for subquery (to pass common values):
35-
var scope = {one:{a:2,b;20}}
36-
alasql('SELECT * FROM ? two WHERE two.a = one.a',[data],null,scope);
37-
Call for fluent interface with data object:
38-
alasql(data).Where(function(x){return x.a == 10}).exec();
39-
Call for fluent interface without data object:
40-
alasql().From(data).Where(function(x){return x.a == 10}).exec();
41-
*/
42-
43-
var alasql = function(sql, params, cb, scope) {
44-
if(typeof importScripts != 'function' && alasql.webworker) {
45-
var id = alasql.lastid++;
46-
alasql.buffer[id] = cb;
47-
alasql.webworker.postMessage({id:id,sql:sql,params:params});
48-
} else {
49-
if(arguments.length == 0) {
50-
// Without arguments - Fluent interface
51-
return new yy.Select({
52-
columns:[new yy.Column({columnid:'*'})],
53-
from: [new yy.ParamValue({param:0})]
54-
});
55-
} else if (arguments.length == 1 && typeof sql == "object" && sql instanceof Array) {
56-
// One argument data object - fluent interface
57-
var select = new yy.Select({
58-
columns:[new yy.Column({columnid:'*'})],
59-
from: [new yy.ParamValue({param:0})]
60-
});
61-
select.preparams = [sql];
62-
return select;
63-
} else {
64-
// Standard interface
65-
// alasql('#sql');
66-
if(typeof sql == 'string' && sql[0]=='#' && typeof document == "object") {
67-
sql = document.querySelector(sql).textContent;
68-
} else if(typeof sql == 'object' && sql instanceof HTMElement) {
69-
sql = sql.textContent;
70-
} else if(typeof sql == 'function') {
71-
// to run multiline functions
72-
sql = sql.toString().slice(14,-3);
73-
}
74-
// Run SQL
75-
return alasql.exec(sql, params, cb, scope);
76-
}
77-
};
78-
};
79-
80-
/** Current version of alasql */
81-
alasql.version = "0.0.44";
82-
1+
2+
/**
3+
UMD envelope
4+
*/
5+
6+
(function (root, factory) {
7+
if (typeof define === 'function' && define.amd) {
8+
define([], factory);
9+
} else if (typeof exports === 'object') {
10+
module.exports = factory();
11+
} else {
12+
root.alasql = factory();
13+
}
14+
}(this, function () {
15+
16+
/**
17+
alasql - Main Alasql class
18+
@param {string | Object} sql SQL-statement or data object for fuent interface
19+
@param {Object} params SQL parameters
20+
@param {Function} cb callback function
21+
@param {Object} scope Scope for nested queries
22+
@return {array} Result data object
23+
24+
Standard sync call:
25+
alasql('CREATE TABLE one');
26+
Query:
27+
var res = alasql('SELECT * FROM one');
28+
Call with parameters:
29+
var res = alasql('SELECT * FROM ?',[data]);
30+
Standard async call with callback function:
31+
alasql('SELECT * FROM ?',[data],function(res){
32+
console.log(data);
33+
});
34+
Call with scope for subquery (to pass common values):
35+
var scope = {one:{a:2,b;20}}
36+
alasql('SELECT * FROM ? two WHERE two.a = one.a',[data],null,scope);
37+
Call for fluent interface with data object:
38+
alasql(data).Where(function(x){return x.a == 10}).exec();
39+
Call for fluent interface without data object:
40+
alasql().From(data).Where(function(x){return x.a == 10}).exec();
41+
*/
42+
43+
var alasql = function(sql, params, cb, scope) {
44+
if(typeof importScripts != 'function' && alasql.webworker) {
45+
var id = alasql.lastid++;
46+
alasql.buffer[id] = cb;
47+
alasql.webworker.postMessage({id:id,sql:sql,params:params});
48+
} else {
49+
if(arguments.length == 0) {
50+
// Without arguments - Fluent interface
51+
return new yy.Select({
52+
columns:[new yy.Column({columnid:'*'})],
53+
from: [new yy.ParamValue({param:0})]
54+
});
55+
} else if (arguments.length == 1 && typeof sql == "object" && sql instanceof Array) {
56+
// One argument data object - fluent interface
57+
var select = new yy.Select({
58+
columns:[new yy.Column({columnid:'*'})],
59+
from: [new yy.ParamValue({param:0})]
60+
});
61+
select.preparams = [sql];
62+
return select;
63+
} else {
64+
// Standard interface
65+
// alasql('#sql');
66+
if(typeof sql == 'string' && sql[0]=='#' && typeof document == "object") {
67+
sql = document.querySelector(sql).textContent;
68+
} else if(typeof sql == 'object' && sql instanceof HTMElement) {
69+
sql = sql.textContent;
70+
} else if(typeof sql == 'function') {
71+
// to run multiline functions
72+
sql = sql.toString().slice(14,-3);
73+
}
74+
// Run SQL
75+
return alasql.exec(sql, params, cb, scope);
76+
}
77+
};
78+
};
79+
80+
/** Current version of alasql */
81+
alasql.version = "0.0.45";
82+

0 commit comments

Comments
 (0)