You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Will Gomes (JIRA)" <ji...@apache.org> on 2009/08/05 16:11:15 UTC
[jira] Created: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
-------------------------------------------------------------------------------------------------------------------
Key: DERBY-4338
URL: https://issues.apache.org/jira/browse/DERBY-4338
Project: Derby
Issue Type: Bug
Affects Versions: 10.4.2.0
Reporter: Will Gomes
Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Attachment: (was: derby-151-b.diff)
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Attachment: derby-4338-a.diff
derby-4338-a.stat
Uploading a patch for this issue, and added test cases to CommentTest, please review. Running regressions.
While rewriting the handling of this in the client driver, I noticed that the client driver seems to filter away the "newline" characters: '\n', 'r' and '\f',
at least they are gone by the time the query string i see by the compiler.
The latter ('\f') is rejected by the Derby compiler, which makes the client driver slightly more lenient than the embedded driver in this regard. Probably not important, but I thought I'd mention it.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Attachments: derby-4338-a.diff, derby-4338-a.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748400#action_12748400 ]
Knut Anders Hatlen commented on DERBY-4338:
-------------------------------------------
Sorry, I missed your comment that you had already considered a regex, so just disregard that.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Comment: was deleted
(was: Uploading version "b" of this patch.
- Changed severity to database; updated ErrorCodeTest to reflect this.
Rationale: It seems right - I don't know that it's safe to continue
after this kind of error, and I compared to other IO level errors in
raw store and mostly seem to have database severity.
- Made the new Derby151Test not fail even if expected error is not
seen. I did this to allow for possible different behavior on other
VMs, JUnit verbose mode would instead print "Not able to test fix
for DERBY-151: No interrupt seen".
- I added the same handling to read (even if not seen yet) as for
write. Regressions passed modulo ErrorCodeTest, which i missed
first time around.
- Fixed some broken Javadocs.
Ready for review.
)
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748052#action_12748052 ]
Dag H. Wanvik commented on DERBY-4338:
--------------------------------------
> /* asdfads */ { call syscs_util.syscs_checkpoint_database() };
Yes, I realize that I could have chosen to remove the left brace here easily, but the old code didn't handle that case after an end-of-line comment so I was hesitant to change behavior. But thinking again
I agree it's better to be consistent. I don't think it should cause much a problem: the only change would be to correctly classify an escaped call as such after a end-of-line comment.
As for the comment stubs, I moved the comments up to the delim variable. I'll remove the stubs
and provide a method comment as well.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (DERBY-4338) Network client raises
error "executeQuery method can not be used for update" when sql is preceded
by /* */ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747198#action_12747198 ]
Dag H. Wanvik edited comment on DERBY-4338 at 8/24/09 8:01 PM:
---------------------------------------------------------------
Uploading a patch for this issue, and added test cases to CommentTest,
please review. Running regressions.
While rewriting the handling of this in the client driver, I noticed
that the client driver seems to filter away the "newline" characters:
'\n', 'r' and '\f', at least they are gone by the time the query
string is seen by the compiler. The latter ('\f') is rejected by the
Derby compiler, which makes the client driver slightly more lenient
than the embedded driver in this regard. Probably not important, but I
thought I'd mention it.
was (Author: dagw):
Uploading a patch for this issue, and added test cases to CommentTest, please review. Running regressions.
While rewriting the handling of this in the client driver, I noticed that the client driver seems to filter away the "newline" characters: '\n', 'r' and '\f',
at least they are gone by the time the query string i see by the compiler.
The latter ('\f') is rejected by the Derby compiler, which makes the client driver slightly more lenient than the embedded driver in this regard. Probably not important, but I thought I'd mention it.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Attachments: derby-4338-a.diff, derby-4338-a.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Urgency: Normal
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0
> Reporter: Will Gomes
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747816#action_12747816 ]
Knut Anders Hatlen commented on DERBY-4338:
-------------------------------------------
I only tested it from ij, but when I made getNonCommentToken() print the returned token, this is what I saw:
ij(CONNECTION1)> { call syscs_util.syscs_checkpoint_database() };
tokenFound: call
Statement executed.
ij(CONNECTION1)> /* asdfads */ { call syscs_util.syscs_checkpoint_database() };
tokenFound: {
0 rows inserted/updated/deleted
Note that if the escaped call is prefixed with a comment, the braces are not stripped away, and getNonCommentToken() returns the opening brace. Not sure if this is a problem, and I don't think your patch is making the situation worse in any way (the difference in the return status - "Statement executed" vs "0 rows inserted/..." - is also seen without your patch), so don't let this issue hold the patch.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748073#action_12748073 ]
Dag H. Wanvik commented on DERBY-4338:
--------------------------------------
Digging more, here is a more serious classification error done in the client, due to its reliance on StringTokenizer:
ij> select* from sys.systables;
firstToken=select*
:
ERROR X0Y79: Statement.executeUpdate() cannot be called with a statement that returns a ResultSet.
Similarly:
select'a' from sys.systables;
select"TABLEID" from sys.systables;
All the above are legal queries missed in the client statement classification logic..
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Attachment: derby-151-b.stat
derby-151-b.diff
Uploading version "b" of this patch.
- Changed severity to database; updated ErrorCodeTest to reflect this.
Rationale: It seems right - I don't know that it's safe to continue
after this kind of error, and I compared to other IO level errors in
raw store and mostly seem to have database severity.
- Made the new Derby151Test not fail even if expected error is not
seen. I did this to allow for possible different behavior on other
VMs, JUnit verbose mode would instead print "Not able to test fix
for DERBY-151: No interrupt seen".
- I added the same handling to read (even if not seen yet) as for
write. Regressions passed modulo ErrorCodeTest, which i missed
first time around.
- Fixed some broken Javadocs.
Ready for review.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-151-b.diff, derby-151-b.stat, derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748316#action_12748316 ]
Knut Anders Hatlen commented on DERBY-4338:
-------------------------------------------
Thanks for catching those additional cases and incorporating them into the test. The patch looks good to me.
Some small nits:
You may be able to simplify isolateAnyInitialIdentifier() by using the JDK's regex library. I think the code below is equivalent to the code in the patch.
private final static Pattern INITIAL_IDENTIFIER = Pattern.compile("(\\p{Alpha}+).*");
private String isolateAnyInitialIdentifier (String sql) {
Matcher m = INITIAL_IDENTIFIER.matcher(sql);
if (m.matches()) {
return m.group(1);
}
return sql;
}
In the tests there are some calls to check the return value from getUpdateCount() on this form:
assertTrue(ps.getUpdateCount() == 0);
It's probably better to use assertEquals(0, ps.getUpdateCount()) to get more information in case of a failure.
There are a couple of occurrences of getConnection().createStatement() and getConnection().prepareStatement(). The getConnection() part should be dropped so that we use the methods in BaseJDBCTestCase that automatically close the statements.
Perhaps the calls to executeQuery() in testInitialComment_derby4338() and testWrongKeywordLexing_derby4338() should be wrapped in JDBC.assertDrainResults() so that we don't leave any results sets open?
A comment in testInitialComment_derby4338() stops in the middle of a sentence: // Change to 0 when DERBY-4362 is fixed. Before both
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748409#action_12748409 ]
Dag H. Wanvik commented on DERBY-4338:
--------------------------------------
Thanks for looking at my revised patch, Knut. I will fix up the test as you suggested.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Attachment: derby-4338-c.stat
derby-4338-c.diff
Uploading version "c", which adds a new testcase,
testWrongKeywordLexing_derby4338, and a fix for that problem, cf. the
new method isolateAnyInitialIdentifier in Statement.java used instead
of the Java tokenizer which wasn't really suitable in this case. A
regexp could have been used though, but in this simple case, that
seemed overkill.
I also added a testcase to show how the client before this fix fails to
scan past the escape starting after an end-of-line comment. See the
"call" examples in CommentTest.testInitialComment_derby4338.
Investigating this lead to my filing DERBY-4362, btw.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Fix Version/s: 10.5.3.1
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.4.3.0, 10.5.3.1, 10.5.4.0, 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747635#action_12747635 ]
Dag H. Wanvik commented on DERBY-4338:
--------------------------------------
Thanks for looking at this Knut!
Actually the escapes have been removed at this point in processing, cf. calls to
escape(sql) just before the call to parseSqlAndSetSqlModes in Statement.flowExecute(); ca line 3.
(although not for batches, not sure if batches can contain escapes?)
I'll insert a comment to that fact, and simplify the test.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Attachments: derby-4338-a.diff, derby-4338-a.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Attachment: derby-4338-d.stat
derby-4338-d.diff
Attaching version "d", which incorporates Knut's suggestions regarding the test.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747818#action_12747818 ]
Knut Anders Hatlen commented on DERBY-4338:
-------------------------------------------
One more data point. If I add a case for '{' in getNonCommentToken(), the statements above consistently return "Statement executed". This is different from the return status with the embedded driver (because of DERBY-211), but I guess it would be good to be internally consistent within the client driver, even if it's not consistent with the embedded driver.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Component/s: Network Client
Issue & fix info: [Newcomer]
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0
> Reporter: Will Gomes
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Attachment: (was: derby-151-b.stat)
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik closed DERBY-4338.
--------------------------------
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.4.3.0, 10.5.3.1, 10.5.4.0, 10.6.1.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Issue & fix info: [Newcomer] (was: [Patch Available, Newcomer])
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Affects Version/s: 10.5.1.1
10.5.2.0
10.5.3.0
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Attachments: derby-4338-a.diff, derby-4338-a.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Affects Version/s: 10.4.1.3
Fix Version/s: 10.6.0.0
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747404#action_12747404 ]
Knut Anders Hatlen commented on DERBY-4338:
-------------------------------------------
This looks like an improvement to me. Two small comments:
1) Should getNonCommentToken() also skip '{' when in the OUTSIDE state? I was thinking of JDBC escaped call statements, like "{ call TOURS.BOOK_TOUR(?, ?) }", where the first token should be "CALL" and not "{".
2) CommentTest.suite() could be simplified to "return TestConfiguration.defaultSuite(CommentTest.class);"
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Attachments: derby-4338-a.diff, derby-4338-a.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik resolved DERBY-4338.
----------------------------------
Resolution: Fixed
Fix Version/s: 10.5.4.0
10.4.3.0
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.4.3.0, 10.5.4.0, 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Attachment: derby-4338-b.diff
derby-4338-b.stat
Uploading version "b" of this patch, which, in addition to test simplification and the added comment, wrapped some SanityManager methods in
tests for SanityManager.DEBUG, missing in version "a".
If no further comments I intend to commit this version. Re-running regressions.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik updated DERBY-4338:
---------------------------------
Issue & fix info: [Newcomer, Patch Available] (was: [Newcomer])
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Attachments: derby-4338-a.diff, derby-4338-a.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dag H. Wanvik reassigned DERBY-4338:
------------------------------------
Assignee: Dag H. Wanvik
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747827#action_12747827 ]
Knut Anders Hatlen commented on DERBY-4338:
-------------------------------------------
>From getNonCommentToken():
+ case '=': //
+ case '?': //
It looks like you intended, but forgot, to write comments for those two cases.
For extra credit, you could also add a javadoc comment describing getNonCommentToken(). Though, sadly, describing an internal method in a comment will break the established pattern in that class... :(
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Art Allisany (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743199#action_12743199 ]
Art Allisany commented on DERBY-4338:
-------------------------------------
This error prevents hibernate comments from being prepended to the sql query which is a very useful feature to correlate jpa queries with sql queries.
in jpa persistence.xml
<property name="hibernate.use_sql_comments" value="true"/>
Hibernate: /* SELECT e FROM CommonEntity e JOIN e.addresses a WHERE a.countryCode = 'us' */ select commonenti0_.id as id0_, commonenti0_.billingAddress as billingA3_0_, commonenti0_.shippingAddress as shipping4_0_, commonenti0_.purchaser_id as purchaser6_0_, commonenti0_.businessId as businessId0_, commonenti0_.DTYPE as DTYPE0_ from CommonEntity commonenti0_ inner join CommonEntity_Address addresses1_ on commonenti0_.id=addresses1_.CommonEntity_id inner join Address address2_ on addresses1_.addresses_id=address2_.id where address2_.countryCode='us'
WARNING: SQL Error: 20000, SQLState: XJ207
SEVERE: executeQuery method can not be used for update.
If I remove the hibernate.use_sql_comments the select query succeeds, so I have confirmed Will's bug on Apache Derby Network Server - 10.5.1.1.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.2.0
> Reporter: Will Gomes
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12749533#action_12749533 ]
Dag H. Wanvik commented on DERBY-4338:
--------------------------------------
Committed derby-4338-d on trunk as svn 809643.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4338) Network client raises error
"executeQuery method can not be used for update" when sql is preceded by /*
*/ comments
Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12749654#action_12749654 ]
Dag H. Wanvik commented on DERBY-4338:
--------------------------------------
Back-ported to 10.4 as svn 809764.
Back-ported to 10.5 as svn 809763.
Resolving.
> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4338
> URL: https://issues.apache.org/jira/browse/DERBY-4338
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0
> Reporter: Will Gomes
> Assignee: Dag H. Wanvik
> Fix For: 10.6.0.0
>
> Attachments: derby-4338-a.diff, derby-4338-a.stat, derby-4338-b.diff, derby-4338-b.stat, derby-4338-c.diff, derby-4338-c.stat, derby-4338-d.diff, derby-4338-d.stat
>
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments. As a result the sql appears to be detected as an update statement, and results in the following error:
> org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.