Add codeGen phase to generate SQL code within the AST.

This allows us to build more complex trees that contain client-side
mappings on top of SQL. Later on we should be able to use this as a basis
for nested collections and distributed queries, both of which require
similar mechanisms.

Concrete instances of codeGen are created by the drivers and appended
to the driver's common QueryCompiler configuration to obtain different
compilers for the different kinds of statements (select, update, delete)
that can be built this way.

This initial commit does not generate client-side mappings yet because
not all uses of the query AST and the old code generator model have been
adapted to use the codeGen phase.
Remove OldTest.

Some queries there that are actually useful are moved over to
NewQuerySemanticsTest and executed against all databases (instead of
merely checking that they compile without throwing an Exception).
Pass fully compiled ASTs to invokers and executors.

We also enable the generation of ResultSetMapping nodes in the
hoistClientOps phase. The invokers and executors just throw them away for
now and use the old ValueLinearizer which gets passed in as a
separate argument.
Replace ExtendedProfile and ExtendedDriver with deprecated type aliases.

We keep these around for one more release for improved source
compatibility with 1.0.
Add "Self" type to Node for better return types.

Now the methods that return copies of a node with some changes can have
a more appropriate return type than just Node.
Preserve column type information in some compiler phases.

We have to make sure that column types survive until (and in)
replaceFieldSymbols so that we have the required type information when
adding new columns to existing tables in that phase.
Hoist client ops up into ResultSetMapping and make that fully typed.

Client ops were not hoisted out of the outer Comprehension before because
that only works when returning a StructNode (so we can just work with
unique symbols instead of having to track paths and scopes). Now we
temporarily change the outer Comprehension to return a StructNode,
wrap it in a ResultSetMapping, perform the hoisting, then rewrite back
to ProductNode form.

Node.nodeWithComputedType gets a new flag for incremental instead of
full retyping (i.e. only nodes with UnassignedType are changed). This
makes it very easy to compute the types at the ResultSetMapping level
(where everything except the ResultSetMapping itself and its client-side
projection is already typed) in an efficient way.
Proper translation of Option conversions into SQL.

Any Option conversion that cannot be hoisted up to the client side gets
translated to SQL by dropping OptionApply nodes (but rewriting the type
of the underlying operation to an Option type) and converting GetOrElse
nodes to properly typed applications of Library.IfNull. Note that this
forces eager evaluation (and conversion to a SQL literal) of the otherwise
lazy default value for getOrElse. There is no way to support methods like
getOrFail inside of DB-side computations without resolving to much more
complex translation schemes.

We also improve IfNull support on Derby (making use of the fully typed
AST) and perform some optimizations in hoistClientOps to prevent
unnecessary computations when nothing gets hoisted.

Test in MiscTest.testOptionConversions. Fixes issue #29.
Remove mutability from QueryCompiler state (except for the SymbolNamer)

Logging of the source tree is also improved to use the SymbolNamer.
Make fixRowNumberOrdering work on typed trees

- Type information is correctly propagated through fixRowNumberOrdering
- Move assignTypes phase up before fixRowNumberOrdering
- Make the zip join tests a method on JoinTest (where they belong)
Bug fix: Reuse SymbolNamer when copying the CompilerState
Make fuseComprehensions work on typed trees

- Type information is correctly propagated through fuseComprehensions

- Move assignTypes phase up before fuseComprehensions

- Don't routinely copy types when rebuilding ProductNodes and
  StructNodes. We still do it for Select which is dubious but keeps
  things simple for now. When more phases are typed and the earlier ones
  propagate type information selectively where needed, this should not be
  necessary anymore.
Remove an unnecessary createSelect() call in comprehension fusion.

The only time that the select clause of this comprehension matters is in
narrowStructure() which should be able to find the right target either way.
Bug fix: Memoize on the target node instead of the ref in localizeRefs.

Using a Transformer did the memoization on the RefNode but there can be
different kinds of RefNodes for the same target and these should result in
the same AnonSymbol, so we now memoize the mapping from an IntrinsicSymbol
to an AnonSymbol.

Also beefing up and simplifying the memoizer.
Make convertToComprehensions work on typed trees.

- Type information is correctly propagated through convertToComprehensions

- Move assignTypes phase up before convertToComprehensions
Make the test run on Access via JdbcOdbcDriver again.

Yes, seriously. This makes the difference between 99% success (as good
as it gets with JdbcOdbcDriver) and 100% failure. No kidding. Another
hour wasted on bisecting and debugging.
Merge pull request #89 from slick/topic/codegen-phase2

Introduce codeGen compiler phase