Skip to content

Commit

Permalink
Wiki love add *
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrw committed Jun 12, 2015
1 parent fdef7f9 commit 68ead7c
Show file tree
Hide file tree
Showing 233 changed files with 614 additions and 480 deletions.
2 changes: 1 addition & 1 deletion ADD.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ADD
# Keyword `ADD`

Syntax:
```sql
Expand Down
6 changes: 5 additions & 1 deletion AGGR.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# AGGR - post-aggregation function
# Keyword `AGGR`

post-aggregation function.

Syntax:

```sql
AGGR(expression-on-aggregators)
Expand Down
4 changes: 2 additions & 2 deletions ALL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ALL
# Keyword `ALLKeyword `

Keyword using with SELECT operator and aggregators.
Keyword using with [`SELECT`](select) operator and aggregators.

Syntax:
```sql
Expand Down
6 changes: 4 additions & 2 deletions ALTER.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# ALTER - altering operator
# Keyword `ALTER`

Table altering operator

Syntax:
```sql
ALTER TABLE tableid ADD COLUMN column type
ALTER TABLE oldname RENAME TO newname
```

See also: [ALTER TABLE](Alter Table), [ADD COLUMN](Add Column), [RENAME TABLE](Rename Table)
Please see: [ALTER TABLE](Alter Table), [ADD COLUMN](Add Column), [RENAME TABLE](Rename Table)
4 changes: 3 additions & 1 deletion AND.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# AND - logical operator
# Keyword `AND`

Logical operator

Syntax:
```sql
Expand Down
2 changes: 1 addition & 1 deletion ANTI.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ANTI - anti join
# Keyword `ANTI`

Syntax:
```
Expand Down
2 changes: 1 addition & 1 deletion ANY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ANY
# Keyword `ANY`

See also: [SOME](Some), [EXISTS](Exists)
3 changes: 2 additions & 1 deletion AS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AS - naming keyword
# Keyword `AS`


Syntax:
```sql
Expand Down
7 changes: 4 additions & 3 deletions ASC.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# ASC - ascending order
# Keyword `ASC`

ASC is using for sorting order.
ASC is using for sorting in ascending order.

Syntax:
```sql
SELECT ... ORDER BY expression [ASC|DESC],...
```
See also: [ORDER BY](Order By), [DESC](Desc)

See also: [ORDER BY](Order By) and [DESC](Desc)
4 changes: 3 additions & 1 deletion AUTOINCREMENT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AUTOINCREMENT
# Keyword `AUTOINCREMENT`

Define default value for the column with auto incremeting.

Expand All @@ -9,4 +9,6 @@ Syntax:
)
```

Has the alias `AUTO_INCREMENT` for support of varius native databases.

See also: [IDENTITY](Identity)
12 changes: 2 additions & 10 deletions AUTO_INCREMENT.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
# AUTO_INCREMENT
# Keyword `AUTO_INCREMENT`

Define default value for the column with auto incremeting.
Alias for [`AUTOINCREMENT`](AUTO_INCREMENT)

Syntax:
```sql
CREATE TABLE tableid (
columnid typeid AUTO_INCREMENT,...
)
```

See also: [IDENTITY](Identity)
2 changes: 1 addition & 1 deletion About.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## About Alasql
# About Alasql

Alasql is a JavaScript SQL database library designed for:

Expand Down
2 changes: 1 addition & 1 deletion Add-Column.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ADD COLUMN
# Keyword `ADD COLUMN`

Syntax:
```sql
Expand Down
3 changes: 2 additions & 1 deletion Aggregators.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Aggregators
# Aggregators supported by AlaSQL

## SQL Standard

* SUM()
* AVG()
* COUNT()
Expand Down
13 changes: 11 additions & 2 deletions Alacon.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
## Alacon Samples
# Alacon

Alacon is AlaSQL in a console

Examples:

1. Number of lines in text file with length more than 20 characters

```
alacon 'select value count(*) from txt("README.md") where length([0]) > 20'
```

2. Simple calculator

```
alacon '2*2'
```

3. Convert XLSX file to JSON

```
alacon "select * into json('my.json') from xlsx('cities.xlsx',{headers:true})"
```
```

Please see [install notes](install) on how to install.
4 changes: 3 additions & 1 deletion Alaserver.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Alaserver

See also: [Alacon](Alacon)
A HTTP server wrapping [Alacon](Alacon)

This is a stub waiting to get some descent content...
58 changes: 42 additions & 16 deletions Alasql-Object.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,45 @@
# Alasql Object
## Properties and functions

* alasql(sql,params,callback) – execute SQL
* alasql(data) - starting poit for [fluent interface](Fluent Interface)
* alasql.exec(sql,params,callback) – execute SQL
* alasql.parse(sql) – parse to [AST (abstract syntax tree)](AST)
* ast.compile(databaseid) – compile statement and cache it in database cache
* alasql.exec(sql) – execute statement
* alasql.use(databaseid) – [use database](Use Database)
* alasql.pretty(sql) – pretty SQL output in HTML and TXT
* alasql.options - [options](Alasql Options)
* alasql.databases - list of AlaSQL databases
* alasql.tables - list of tables in ```alasql``` database

## alasql() - main function
# The AlaSQL Object

## Properties and functions - overview

In the following the term `sql` is ment as a string contaning SQL statements.


* `alasql(sql)` - short for `alasql.exec(sql)`

* `alasql.exec(sql)`- executes SQL and returns responses. If several SQL statements are given (seperated by `;`) the return value will be an array with the response of each statement. Statments that does not `SELECT` data will return an int indicating rows affected or if the execution of the statement succeeded.

* `alasql(sql,params)` – short for `alasql.exec(sql,params)`

* `alasql.exec(sql,params)` executes SQL after having replaces the n'th `?` in sql with the n'th index in the array `params`

* `alasql(sql,params,callback)` – short for `alasql.exec(sql,params,callback)`

* `alasql.exec(sql,params,callback)` - adding a 3rd parameter will run the SQL async calling the callback with one parameter (the response) when finished.

* `alasql(data)` - starting poit for [fluent interface](Fluent Interface)


* `alasql.parse(sql)` – parse SQL to an [abstract syntax tree (ATS)](AST)


* `alasql.compile(sql)` – returns compiled statement (and adds it to database cache)


* `alasql.use(databaseid)` – Equivalent to `alasql('USE '+databaseid)`. See also [the keyword USE](Use Database)

* `alasql.pretty(sql)` – "prettyfys" SQL statements

* `alasql.options.*` - See [options](Alasql Options) for more inforamtion

* `alasql.databases` - array of databases in the AlaSQL object

* `alasql.tables` - Array of the tables in the default database (called `alasql`)


## In more details

### alasql() - main function
```js
alasql(sql,[params],[callback])
```
Expand Down
11 changes: 8 additions & 3 deletions Alasql-Options.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# Alasql Options
# AlaSQL Options

You can find all AlaSQL options in ```alasql.options``` variable.
You can find all AlaSQL options in `alasql.options` variable.

You can change these options directly from JavaScript:

```js
alasql.options.autocommit = true;
```
or from SQL with [SET](Set) statement:
or from SQL with the [`SET`](Set) statement:

```sql
SET AUTOCOMMIT OFF;
SET MODIFIER = "RECORDSET";
```

Setting them via the `SET` statement is the only option when running from the console or if you run as a webworker and want to change options during executions.

### List of AlaSQL options

* alasql.options.valueof (true/false) – convert all values with .valueOf() function before comparing
Expand Down
17 changes: 15 additions & 2 deletions Angular.js.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Angular.js
# Angular.js + AlaSQL

AlaSQL can work together with Angular.js library.

You can use AlaSQL together with Angular.js framework:

```js
$scope.exportData = function () {
alasql('SELECT * INTO XLSX("john.xlsx",{headers:true}) FROM ?',[$scope.items]);
};
```
See [simple example in jsFiddle](http://jsfiddle.net/agershun/00nfeq12/).

Another example: [Calculating average of array](http://jsfiddle.net/agershun/she06Lq3/2/)


## In more detail

If AlaSQL recognize Angular.js it removes ```$$hashKey``` artefacts from the exporting arrays.

Expand Down
2 changes: 1 addition & 1 deletion Anti-Join.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ANTI JOIN
# Keyword `ANTI JOIN`

See also: [JOIN](Join)
29 changes: 15 additions & 14 deletions Api.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Alasql JavaScript API

## Standard functions:
## Normal ussage:

* alasql()
* alasql.compile(sql) - [Compile statements](Compile)
* alasql(stringWithSQL)
* alasql.compile(stringWithSQL) - [Pre compile statements](Compile)

Please see more info about the [`alasql` object here](alasql-object)

## SQL way

## SQL driven data insert
```js
alasql(‘CREATE DATABASE test01’);
alasql(‘USE test01’);
alasql(‘CREATE TABLE one (a INT)’);
alasql(‘INSERT INTO one VALUES (10)’):
var res = alasql(‘SELECT * FROM one’);
```
## JavaScript way

## JavaScript driven data insert
```js
var data = [{a:1}, {a:2}, {a:3}];
alasql(‘SELECT * FROM ? WHERE a >= ?’, [data, 2]);
Expand All @@ -25,8 +28,8 @@
console.log(data.length);
});
```
### Promises
AlaSQL supports promises with ```alasql.promise(sql,params)``` function. It returns standard A/+ promise:
## Promises
AlaSQL supports promises with `alasql.promise(sql,params)` function. It returns a standard A/+ promise:
```js
alasql.promise('SELECT * FROM test')
Expand All @@ -37,11 +40,9 @@ AlaSQL supports promises with ```alasql.promise(sql,params)``` function. It retu
});
```
## Alasql object
See [alasql object](Alasql Object)
## exec() function
WebSQL
## new database
```js
var db = new alasql.Database(‘mydb’);
db.exec(‘SELECT * FROM City”);
Expand All @@ -50,7 +51,7 @@ WebSQL
## JavaScript classes as SQL data types
```js
alasql.fn.Date = Date;
alasql(CREATE order ( orderno INT, orderdate Date));
alasql('CREATE order (orderno INT, orderdate Date)');
```
***NB.*** Classes are case-sensitive
Expand All @@ -66,6 +67,6 @@ Use NEW
alasql(‘SELECT NEW Date(yr,mn-1,dy) FROM orderdates’)
```
## JSON Objects
See [JSON Objects](Json Objects)
## JSON Objects usage
Please See [JSON Objects](Json Objects)
10 changes: 8 additions & 2 deletions Apply.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# CROSS APPLY and OUTER APPLY
# Keyword `APPLY`

Is used as part of both `CROSS APPLY` and `OUTER APPLY`


```sql
SELECT ... CROSS APPLY ...
SELECT ... OUTER APPLY ...
```

See also: [CROSS APPLY](Cross Apply), [OUTER APPLY](Outer Apply)
Pleae see

- [CROSS APPLY](Cross Apply)
- [OUTER APPLY](Outer Apply)
4 changes: 3 additions & 1 deletion Array.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## ARRAY() Aggregator
# Keyword `ARRAY()`

`ARRAY()` Aggregator

This aggregator is used to aggregate all values into the array.

Expand Down
Loading

0 comments on commit 68ead7c

Please sign in to comment.