CSNW/sql-bricks — pull request #43 by prust (2014-09-19 18:38:29+00:00)
Title: Dialect Extension mechanism

* Moved `LIMIT ... OFFSET` to a limit-offset extension (used by both sqlite/pg)
* Moved `OR [REPLACE / ABORT / etc]` to sqlite extension
* Moved `RETURNING` & `DELETE ... USING` to postgres extension
* Removed `MINUS` support (Oracle only; if someone wants to create an Oracle extension and maintain it in their own repo, they're welcome to)
* Removed unnecessary layer of method-building functions

**Breaking Change!!**

`window.SqlBricks()` and `require('sql-bricks')` now return a *function* that, when executed, returns a `sql` namespace. So the syntax to use them is now:

```javascript
// browser
var sql = SqlBricks();
// node
var sql = require('sql-bricks')();
```

Instead of:

```javascript
// browser
var sql = SqlBricks; // THIS WILL NO LONGER WORK
// node
var sql = require('sql-bricks'); // THIS WILL NO LONGER WORK
```

The reason for this that it's the simplest way to generate independent sql namespaces. With a single global namespace, it would be impossible to use multiple dialects in the same node app, for instance to pull a subset of data from a postgres DB and use it to generate a small SQLite DB (we have an app that does this, so it's not just a theoretical concern).

Also, this makes it easy for the end user to specify a "chain" of extensions he or she wishes to use, by passing the namespace to build on into the function as an optional argument:

```javascript
var sql = require('sql-bricks')();
var custom_sql = require('./my-custom-extensions.js')(sql);
var pg_bricks = require('sql-bricks/postgres')(custom_sql);
```

This pull request fixes #36.