Correct issue #176: Ensure database setup before building select

It appears that when not explicitly setting the database connection via `ORM::set_db()`, calling `ORM::for_table()` would not set up the database explicitly. This caused a situation where the database was  getting set after the select statement was built, causing the limit clause to be built incorrectly. I also modified the existing test to accurately reflect the situation where this bug appeared.