SQL statements generation copleted and fixes.

Now we can run the tests without problems. It only miss the support for
the generation of valid insertion when some constraints (foreign keys)
are presents.
Other fixes..