//! AlaSQL v0.4.4 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
/*
@module alasql
@version 0.4.4
AlaSQL - JavaScript SQL database
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@license
The MIT License (MIT)
Copyright 2014-2016 Andrey Gershun (agershun@gmail.com) & Mathias Rangel Wulff (m@rawu.dk)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
@fileoverview AlaSQL JavaScript SQL library
@see http://github.com/agershun/alasql
*/
/**
Callback from statement
@callback statement-callback
@param {object} data Result data
*/
/**
UMD envelope for AlaSQL
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
/** alasql main function */
module.exports = factory();
} else {
root.alasql = factory();
}
}(this, function () {
/**
AlaSQL - Main Alasql class
@function
@param {string|function|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 {any} - Result data object
@example
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) {
params = params||[];
if(typeof importScripts !== 'function' && alasql.webworker) {
var id = alasql.lastid++;
alasql.buffer[id] = cb;
alasql.webworker.postMessage({id:id,sql:sql,params:params});
return;
}
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){
// Access promise notation without using `.promise(...)`
if(sql.constructor === Array){
return alasql.promise(sql);
}
}
// Avoid setting params if not needed even with callback
if(typeof params === 'function'){
scope = cb;
cb = params;
params = [];
}
if(typeof params !== 'object'){
params = [params];
}
// 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 HTMLElement) {
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
@constant {string}
*/
alasql.version = '0.4.4';
/**
Debug flag
@type {boolean}
*/
alasql.debug = undefined; // Initial debug variable
//*only-for-browser/*
var require = function(){return null}; // as alasqlparser.js is generated, we can not "remove" referenses to
var __dirname = '';
//*/
/* parser generated by jison 0.4.17 */
/*
Returns a Parser object of the following structure:
Parser: {
yy: {}
}
Parser.prototype: {
yy: {},
trace: function(),
symbols_: {associative list: name ==> number},
terminals_: {associative list: number ==> name},
productions_: [...],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
table: [...],
defaultActions: {...},
parseError: function(str, hash),
parse: function(input),
lexer: {
EOF: 1,
parseError: function(str, hash),
setInput: function(input),
input: function(),
unput: function(str),
more: function(),
less: function(n),
pastInput: function(),
upcomingInput: function(),
showPosition: function(),
test_match: function(regex_match_array, rule_index),
next: function(),
lex: function(),
begin: function(condition),
popState: function(),
_currentRules: function(),
topState: function(),
pushState: function(condition),
options: {
ranges: boolean (optional: true ==> token location info will include a .range[] member)
flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
},
performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
rules: [...],
conditions: {associative list: name ==> set},
}
}
token location info (@$, _$, etc.): {
first_line: n,
last_line: n,
first_column: n,
last_column: n,
range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
}
the parseError function receives a 'hash' object with these members for lexer and parser errors: {
text: (matched text)
token: (the produced terminal token, if any)
line: (yylineno)
}
while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
loc: (yylloc)
expected: (string describing the set of expected tokens)
recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
}
*/
var alasqlparser = (function(){
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,13],$V1=[1,104],$V2=[1,102],$V3=[1,103],$V4=[1,6],$V5=[1,42],$V6=[1,79],$V7=[1,76],$V8=[1,94],$V9=[1,93],$Va=[1,69],$Vb=[1,101],$Vc=[1,85],$Vd=[1,64],$Ve=[1,71],$Vf=[1,84],$Vg=[1,66],$Vh=[1,70],$Vi=[1,68],$Vj=[1,61],$Vk=[1,74],$Vl=[1,62],$Vm=[1,67],$Vn=[1,83],$Vo=[1,77],$Vp=[1,86],$Vq=[1,87],$Vr=[1,81],$Vs=[1,82],$Vt=[1,80],$Vu=[1,88],$Vv=[1,89],$Vw=[1,90],$Vx=[1,91],$Vy=[1,92],$Vz=[1,98],$VA=[1,65],$VB=[1,78],$VC=[1,72],$VD=[1,96],$VE=[1,97],$VF=[1,63],$VG=[1,73],$VH=[1,108],$VI=[1,107],$VJ=[10,306,602,764],$VK=[10,306,310,602,764],$VL=[1,115],$VM=[1,116],$VN=[1,117],$VO=[1,118],$VP=[1,119],$VQ=[130,353,410],$VR=[1,127],$VS=[1,126],$VT=[1,134],$VU=[1,164],$VV=[1,175],$VW=[1,178],$VX=[1,173],$VY=[1,181],$VZ=[1,185],$V_=[1,160],$V$=[1,182],$V01=[1,169],$V11=[1,171],$V21=[1,174],$V31=[1,183],$V41=[1,166],$V51=[1,193],$V61=[1,18
excel下载文件alasql.js
需积分: 3 137 浏览量
2023-04-18
16:34:54
上传
评论
收藏 116KB RAR 举报
EstherNi
- 粉丝: 120
- 资源: 2
最新资源
- Screenshot_2024-05-28-11-40-58-177_com.tencent.mm.jpg
- 基于Dart的Flutter小提琴调音器APP设计源码 - violinhelper
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
- 基于MATLAB的声纹识别系统设计源码 - VoiceprintRecognition
- 基于Java的微服务插件集合设计源码 - wsy-plugins
- 基于Vue和微信小程序的监理日志系统设计源码 - supervisionLog
- 基于Java和LCN分布式事务框架的设计源码 - tx-lcn
- 基于Java和JavaScript的茶叶评级管理系统设计源码 - tea
- IMG_5680.JPG
- IMG_0437.jpg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈