Correctly trim the SQL statements in the `Database` class (see #6623)