Add: New nodes and better support for new dialects

This commit represents one in a series of major changes planned for
the project. This particular change affects the nodes module. While
much of the original structure and nodes were retained, the
functionality of many nodes was altered substantially. Some nodes,
such as ParameterNode, no longer exist. Other nodes, such as
BinaryNode, were merged with other nodes. Other nodes still,
such as CaseNode, are new additions to the module.

Another major change in this commit is to the QueryNode. The
QueryNode has been broken out into individual statements. The
purpose for this change is to allow for a more controlled query
compilation. As it was, all query elements were child nodes of
the QueryNode. The compiler would simply call visit on the list
of child nodes and the result was the query. For other dialects,
I need the ability more closely manage the arrangement of elements
after compilation to text. To support this I have created multiple
lists of child elements that can be compiled independantly and then
combined in a controlled way after compilation.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Change: Schema module to use new node API

This change is primarily to update the schema module to account for
the recent changes to the nodes module.

Included in the changes are the removal of the use of unaryMethod,
the .value() and .getValue() methods for Columns, and changing of
update/select/insert/delete to use their respective statements
rather than the QueryNode.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: WhereNode logic and usage

The WhereNode now returns a WhereNode with left/right also being
WhereNodes whenever and/or is called.

The statements were also fixed to store the changes made when a
call to and/or is made.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Remove: Dialect tests until refactor is complete

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Error caused by passing null to WhereNode

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Attribute name clobbering in JoinNode

The .on() function was overwriting its own value. Now it uses an
alternative name of onClause for storage of the on clause nodes.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Add: Tests for schema and nodes modules

This round of tests is a bit more complete than the original set.
At the time of writing, all tests in this commit pass in Chrome,
FF12, IE9, IE8, IE7, and Node.js.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Add: Base dialect compiler object

This base dialect should be fairly reusable in terms of compiling
the individual query elements. This allows additional dialects to
extend the base and only overwrite the elements that don't match.

Overall, this should be a useful addition to the project.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Change: Postgres dialect module to extend Base

As far as I can tell, everything generated by the Base dialect is
compatible with the Postgres dialect. I did notice that the original
author had used '$' for placeholders and put all parameters into a
list rather than dictionary. The current format of dictionary and
keyword placeholders should allow for conversion to the original
format as well as other formats ('?' for MySQL as example).

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Add: Compile support for new features

I seemed to have neglected to actually include the new nodes in
the SelectStatement object. The Base dialect has also been modified
to to account for the new nodes.

One other change included in this commit is the removal of the
and/or methods for Statement objects. This was to prevent confusion
of which element (Where/Having) was being edited with the functions.
Now each call to .where() and .having() procude and'ed statements to
anything previously added. And/Or will be exposed later on in some
other context.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Insertion of LIMIT/OFFSET 0 into SELECT

I had set the conditional statement to !== '' to match the others
but it should have been > 0. Incidentally, this should also allow
someone to remove a LIMIT/OFFSET from a query by setting it to zero.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Error causing mising WHERE clauses

I used the wrong property to refer to WHERE clauses in the final
portion of SELECT generation.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Error causing missing LIMIT/OFFSET clauses

This was an issue I thought I had already covered, but I made a
mistake in the comparison that checks for a defined LIMIT/OFFSET.
Rather than detecting if the initial value of zero was changed, I
was looking for a number greater than zero. LIMIT/OFFSET clauses
are returned the same as any other. I don't know why I made that
mistake.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Error causing missing WHERE clauses

This fix resolved the issue for all statements. The error that
existed in SELECT was replicated to the others via copy/paste.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Add: Value function to Column objects

An implementation of the value function existed in the original
version of this project. I originally removed the function because
it cause side effects to the column object itself. Now the .value()
function will return a ValueNode.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Issue causing shorthand notation to error

The problem was an incorrect use of the !! expression. The intended
use was to invert the truthiness of the given object.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Exceptions in INSERT generation

There were a few properties referenced incorrectly that were causing
exceptions.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Fix: Reference and comparison errors in DELETE

There was a missing accessor to the .text property of a .visit()
call and an incorrect comparison for WHERE clauses that caused
WHERE clause insertion when unwanted.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Add: Base dialect tests

This commit includes a suite of tests against the Base dialect
compiler. This suite should test most of the compiler's
functionality.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>
Change: CASE generation to use spaces as delimeter

Previous to this commit the generation used new lines as the
delimeter between elements. This change was made to maintain
consistency throughout all nodes.

Signed-off-by: Kevin Conway <kevinjacobconway@gmail.com>