[
https://issues.apache.org/jira/browse/DERBY-3242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-3242:
--------------------------------------
Attachment: comment2.sql
Thanks for the patch, James! Your approach looks fine, and it seems to work
correctly in most cases. The one thing that didn't seem to work, was when a
script ended with a comment. Apparently, ij then thinks we have started a new
statement and emits a syntax error on EOF. I have attached a repro as
comment2.sql.
By the way, the indentation in readBracketedComment() is a bit funny. Each line
starts with a single tab character which is followed by a number of space
characters. I think it would be better not to mix different indentation
characters on the same line.
StatementFinder defines constants for some "special state-changing characters".
Would the code be more consistent if readBracketedComment() used those? At
least, it defines a slash constant, but it seems like we need to add a constant
for asterisk ourselves.
I was also wondering if readBracketedComment() would be simpler if we used
peekChar()/readChar() instead of maintaining the flags lookingForSlash and
lookingForAsterisk. Something like:
char peek = peekChar();
if (nextChar == ASTERISK && peek == SLASH) {
readChar();
...
} else if (nextChar == SLASH && peek == ASTERISK) {
readChar();
....
} else {
....
}
What do you think?
> ij doesn't understand bracketed comments
> ----------------------------------------
>
> Key: DERBY-3242
> URL: https://issues.apache.org/jira/browse/DERBY-3242
> Project: Derby
> Issue Type: Bug
> Components: SQL, Tools
> Affects Versions: 10.4.0.0
> Reporter: Knut Anders Hatlen
> Assignee: James F. Adams
> Attachments: comment.sql, comment2.sql, Derby-3242.txt
>
>
> When I execute this sql script in ij
> ------
> create table t (x int);
> /*
> insert into t values 1, 2, 3;
> insert into t values 4, 5, 6;
> */
> ------
> the first INSERT statement in the comment is correctly ignored, but the
> second one is executed. So after running the script, table T contains these
> rows:
> ij> select * from t;
> X
> -----------
> 4
> 5
> 6
> 3 rows selected
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.