Fix end-of-line comments breaking the query

A query such as
```sql
SELECT *  -- some clarifying comment
FROM people
```
would break, because the previous implementation filters out every line that contains a comment, so that the query sent to the DB would only be
```sql
FROM people
```
This pull requests amends this by extracting the query fragment in front of an inline comment.