brianc/node-sql — pull request #45 by HughePaul (2013-03-11 13:57:57+00:00)
Title: Add sqlite support, make subqueries be real subqueries

SQLite support added and all tests.

Subqueries now run as a new instance of the dialect, so the quoting flags all work correctly for them.
columns and aliases get added to subquery objects so they can be used in the parent select. I have tested this in mysql and sqlite, but haven't been able to test against a postgres db.

```
var subposts = post
.subQuery('subposts')
.select(
post.content.as('subpostContent'),
post.userId.as('subpostUserId'))
.from(post);

Harness.test({
query : user
.select(user.name, subposts.subpostContent)
.from(user.join(subposts)
.on(user.id.equals(subposts.subpostUserId))),
pg : 'SELECT "user"."name", "subposts"."subpostContent" FROM "user" INNER JOIN (SELECT "post"."content" AS "subpostContent", "post"."userId" AS "subpostUserId" FROM "post") subposts ON ("user"."id" = "subposts"."subpostUserId")',
sqlite: 'SELECT "user"."name", "subposts"."subpostContent" FROM "user" INNER JOIN (SELECT "post"."content" AS "subpostContent", "post"."userId" AS "subpostUserId" FROM "post") subposts ON ("user"."id" = "subposts"."subpostUserId")',
mysql : 'SELECT `user`.`name`, `subposts`.`subpostContent` FROM `user` INNER JOIN (SELECT `post`.`content` AS `subpostContent`, `post`.`userId` AS `subpostUserId` FROM `post`) subposts ON (`user`.`id` = `subposts`.`subpostUserId`)'
});
```