[This topic is migrated from our old forums. The original author name has been removed]
I have a SQL buffer that has statements that have been commented out, but end with semi-colons:
/*
DELETE FROM ...;
DELETE FROM ...;
*/
And when I execute the buffer, these statements are executed. Previously, commented-out statements were ignored. If I remove the semi-colons, they're not executed. Seems like a bug, no?
Hi Zachariah,
Please enable *SQL Commander/Strip Comments when Executing*. If it is not enabled, the comments are sent to the database, and it sounds like your database does not recognize that they are within a comment.
Best Regards,
Hans
a
anonymous
said
over 10 years ago
[This reply is migrated from our old forums. The original author name has been removed]
Re: Commented Out Statements Still Execute
I love DbVisualizer and am a customer, but unfortunately, I hit this as well and it's really frustrating for my needs.
If comments are stripped completely, then you cannot use database hints in any database that supports them (such as in Oracle, which uses C style comment blocks for hints) easily. This is something that a lot of tools get totally wrong and I'd love to see handled well in DbVisualizer.
It does not seem like a valid thing to ever try to execute any commands/syntax that appears commented. Can you guys look into why this might happen? Commented lines should not be executed - to me this seems like a bug, and I don't think it's the driver I am using (I can use the same driver in SQuirrel and send queries with single line comments and they get sent properly as comments on the database).
I need to be able to do things like this in a single SQL Commander tab (where all syntax is run together) without the stripping comments setting enabled, and it shouldn't be limited to just Oracle either:
/* select * from something; */
--select * from something;
select * from something_else;
select /*+ INDEX (another_thing some_idx)*/ * from another_thing;
Result:
- the queries in comments should be ignored as comments and passed to the database the same way.
- the first query from "something_else" should be executed and land in a new result tab.
- the second query from "another_thing" should have the the INDEX hint should be sent to the server and land in another result tab.
Is there some character you send after a comment block that throws off the drivers, possibly?
Any other thoughts?
Hans Bergsten
said
over 10 years ago
[This reply is migrated from our old forums.]
Re: Commented Out Statements Still Execute
Hi Jon,
Assuming that you use a recent version of DbVisualizer, what you want to happen is pretty much what happens if you have Strip Comments enabled. DbVisualizer recognizes the Oracle hint syntax and does not strip it off even when Strip Comments is enabled.
Best Regards,
Hans
anonymous