Removed dependence on string manipulation for the sql queries.
The tests now work in HSQLDB.