Menu

#9 comments at end of line don't work

open
nobody
None
5
2005-08-23
2005-08-23
No

SQL allows comments like:

select name -- department name
from sales.depts;

However, sqlline doesn't handle this correctly because
it doesn't strip the comment and it converts the
newline into a space, so what gets sent to the JDBC
driver is:

"select name -- department name from sales.depts"

which a typical JDBC driver will see as just "select
name" after stripping off the comment.

There are other cases where converting newlines into
spaces causes well-formed SQL to turn into bad SQL.
For example, the SQL standard allows multi-line string
literals like:

select "My Big Fat "
"Greek Wedding"
from sales.depts;

But the standard requires the newline in between the
literal fragments.

So the best fix for both problems (and possibly others
not encountered yet) would be to preserve the newlines.

Discussion


Log in to post a comment.