From 00cf108edf4a9e2ef11cab4f7e8bc9bd58b6df62 Mon Sep 17 00:00:00 2001 From: Andrey Gershun Date: Mon, 13 Apr 2015 23:23:25 +0300 Subject: [PATCH] version 0.0.45 --- CHANGELOG.md | 2 +- package.json | 2 +- src/05copyright.js | 2 +- src/10start.js | 164 ++++++++++++++++++++++----------------------- 4 files changed, 85 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e7025923d..a977a84fdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog ### 0.0.45 "Rio de Janeiro" (14.04.2015 - ...04.2015) -* Added Bower package +* Changed CRLF for alacon.js and alaserver.js to LF ### 0.0.44 "Roma" (02.04.2015 - 13.04.2015) * Added params to SQLite attached database: alasql('ATTACH SQLITE DATABASE a(?)',[event],cb); diff --git a/package.json b/package.json index 8b1a6aaf5f..a2af45dff5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alasql", "description": "Alasql - JavaScript SQL database and data manipulation library", - "version": "0.0.44", + "version": "0.0.45", "author": "Andrey Gershun ", "directories": { "example": "examples", diff --git a/src/05copyright.js b/src/05copyright.js index 7ff5ea996a..75dda8177d 100644 --- a/src/05copyright.js +++ b/src/05copyright.js @@ -2,7 +2,7 @@ // alasql.js // AlaSQL - JavaScript SQL database // Date: 13.04.2015 -// Version: 0.0.44 +// Version: 0.0.45 // (ñ) 2014-2015, Andrey Gershun // diff --git a/src/10start.js b/src/10start.js index 2ca493f5e6..6be3ab0595 100644 --- a/src/10start.js +++ b/src/10start.js @@ -1,82 +1,82 @@ - -/** - UMD envelope - */ - -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - define([], factory); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - root.alasql = factory(); - } -}(this, function () { - -/** - alasql - Main Alasql class - @param {string | Object} sql SQL-statement or data object for fuent interface - @param {Object} params SQL parameters - @param {Function} cb callback function - @param {Object} scope Scope for nested queries - @return {array} Result data object - - Standard sync call: - alasql('CREATE TABLE one'); - Query: - var res = alasql('SELECT * FROM one'); - Call with parameters: - var res = alasql('SELECT * FROM ?',[data]); - Standard async call with callback function: - alasql('SELECT * FROM ?',[data],function(res){ - console.log(data); - }); - Call with scope for subquery (to pass common values): - var scope = {one:{a:2,b;20}} - alasql('SELECT * FROM ? two WHERE two.a = one.a',[data],null,scope); - Call for fluent interface with data object: - alasql(data).Where(function(x){return x.a == 10}).exec(); - Call for fluent interface without data object: - alasql().From(data).Where(function(x){return x.a == 10}).exec(); - */ - -var alasql = function(sql, params, cb, scope) { - if(typeof importScripts != 'function' && alasql.webworker) { - var id = alasql.lastid++; - alasql.buffer[id] = cb; - alasql.webworker.postMessage({id:id,sql:sql,params:params}); - } else { - if(arguments.length == 0) { - // Without arguments - Fluent interface - return new yy.Select({ - columns:[new yy.Column({columnid:'*'})], - from: [new yy.ParamValue({param:0})] - }); - } else if (arguments.length == 1 && typeof sql == "object" && sql instanceof Array) { - // One argument data object - fluent interface - var select = new yy.Select({ - columns:[new yy.Column({columnid:'*'})], - from: [new yy.ParamValue({param:0})] - }); - select.preparams = [sql]; - return select; - } else { - // Standard interface - // alasql('#sql'); - if(typeof sql == 'string' && sql[0]=='#' && typeof document == "object") { - sql = document.querySelector(sql).textContent; - } else if(typeof sql == 'object' && sql instanceof HTMElement) { - sql = sql.textContent; - } else if(typeof sql == 'function') { - // to run multiline functions - sql = sql.toString().slice(14,-3); - } - // Run SQL - return alasql.exec(sql, params, cb, scope); - } - }; -}; - -/** Current version of alasql */ -alasql.version = "0.0.44"; - + +/** + UMD envelope + */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define([], factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + root.alasql = factory(); + } +}(this, function () { + +/** + alasql - Main Alasql class + @param {string | Object} sql SQL-statement or data object for fuent interface + @param {Object} params SQL parameters + @param {Function} cb callback function + @param {Object} scope Scope for nested queries + @return {array} Result data object + + Standard sync call: + alasql('CREATE TABLE one'); + Query: + var res = alasql('SELECT * FROM one'); + Call with parameters: + var res = alasql('SELECT * FROM ?',[data]); + Standard async call with callback function: + alasql('SELECT * FROM ?',[data],function(res){ + console.log(data); + }); + Call with scope for subquery (to pass common values): + var scope = {one:{a:2,b;20}} + alasql('SELECT * FROM ? two WHERE two.a = one.a',[data],null,scope); + Call for fluent interface with data object: + alasql(data).Where(function(x){return x.a == 10}).exec(); + Call for fluent interface without data object: + alasql().From(data).Where(function(x){return x.a == 10}).exec(); + */ + +var alasql = function(sql, params, cb, scope) { + if(typeof importScripts != 'function' && alasql.webworker) { + var id = alasql.lastid++; + alasql.buffer[id] = cb; + alasql.webworker.postMessage({id:id,sql:sql,params:params}); + } else { + if(arguments.length == 0) { + // Without arguments - Fluent interface + return new yy.Select({ + columns:[new yy.Column({columnid:'*'})], + from: [new yy.ParamValue({param:0})] + }); + } else if (arguments.length == 1 && typeof sql == "object" && sql instanceof Array) { + // One argument data object - fluent interface + var select = new yy.Select({ + columns:[new yy.Column({columnid:'*'})], + from: [new yy.ParamValue({param:0})] + }); + select.preparams = [sql]; + return select; + } else { + // Standard interface + // alasql('#sql'); + if(typeof sql == 'string' && sql[0]=='#' && typeof document == "object") { + sql = document.querySelector(sql).textContent; + } else if(typeof sql == 'object' && sql instanceof HTMElement) { + sql = sql.textContent; + } else if(typeof sql == 'function') { + // to run multiline functions + sql = sql.toString().slice(14,-3); + } + // Run SQL + return alasql.exec(sql, params, cb, scope); + } + }; +}; + +/** Current version of alasql */ +alasql.version = "0.0.45"; +