Why it ignore the semicolon

94 views
Skip to first unread message

gary.ch...@gmail.com

unread,
Mar 26, 2012, 6:25:22 AM3/26/12
to Execute Query
I am using it to access HSQLDB, but I find it won't transfer the
semicolon to the database engine.
How to configure it?

Many thanks.

Takis Diakoumis

unread,
Mar 27, 2012, 12:17:38 AM3/27/12
to execut...@googlegroups.com
hello

by default, it removes semi-colons where they appear at the end of a statement.

you could execute the statement 'as-is' from the popup menu in the
editor and selecting 'Execute as single statement'.

this might be a little annoying to do all the time, can you send me a
sample statement of what you are executing so i can better understand
why it is a problem that they are being removed and then we can see
how to cater for them.

thanks
Takis

--
http://executequery.org

Gary Chen

unread,
Mar 27, 2012, 2:02:20 AM3/27/12
to execut...@googlegroups.com
Hi Takis,

Thanks for your reply.

I am defining a function for HSQLDB.
The script is as the following. Isn't the semicolon the standard
statement delimiter?


DROP FUNCTION IsEmailExist IF EXISTS;
CREATE FUNCTION IsEmailExist(IN strEmailAddr VARCHAR(256))
RETURNS INT
READS SQL DATA
BEGIN ATOMIC
DECLARE rec_count INT;

--Check if it exists already.
SELECT COUNT(*) INTO rec_count FROM EMAIL_ACCOUNTS WHERE
EMAIL_ADDRESS = strEmailAddr;
IF rec_count > 0 THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END

Best Regard,
Gary

Takis Diakoumis

unread,
Mar 29, 2012, 8:46:54 AM3/29/12
to execut...@googlegroups.com
hi

EQ attempts to detect a number of specific query types - one of which
is create procedure or create function.

the issue in this specific case is in fact the drop statement you have
just before the create. the current implementation detects the drop
function first and proceeds to tokenize the remainder around the
semi-colons as it assumes a series of individual statements after
detecting the drop statement on the first line.

if you remove the drop statement, it should work. also, if you select
to execute as a single statement from the popup menu - this should
work also.

i will investigate whether there is anything we can do here to allow
for cases such as the one you have presented and treat this like EQ
treats create procedure or function statements.

please let me know how you go.

thanks
Takis

--
http://executequery.org

Takis Diakoumis

unread,
Mar 29, 2012, 8:58:31 AM3/29/12
to execut...@googlegroups.com
i have modified the test for a create function or procedure to strip
out comments from the query before applying the test and executing.
the drop statement will now not affect the remainder.

this will be available in the next release.

i'm happy to provide you with access to an updated eq.jar file if you
would like this sooner.

thanks
Takis


On Thu, Mar 29, 2012 at 11:46 PM, Takis Diakoumis

--
http://executequery.org

Takis Diakoumis

unread,
Mar 29, 2012, 9:00:52 AM3/29/12
to execut...@googlegroups.com
sorry, that was not correct - the modification will only assist if you
were to comment out the drop statement.

On Thu, Mar 29, 2012 at 11:58 PM, Takis Diakoumis

--
http://executequery.org

Gary Chen

unread,
Mar 30, 2012, 3:26:56 AM3/30/12
to execut...@googlegroups.com
Hi Takis,

Yes, If I remove the drop statement in the first line, it works.
But if I only comment out this line, it cannot work either.

Anyway, many thanks for your kindly support.


Best Regards,
Gary

On Thu, Mar 29, 2012 at 9:00 PM, Takis Diakoumis

Viktor

unread,
May 22, 2012, 2:46:17 AM5/22/12
to execut...@googlegroups.com
Maybe create  option in preferences, which will disables interpretation of semicolons?

In the oracle database, I often execute a code like:


declare
...
begin
...
end;

or

begin
...
end;

четверг, 29 марта 2012 г., 16:46:54 UTC+4 пользователь Takis Diakoumis написал:

Takis Diakoumis

unread,
May 30, 2012, 8:04:01 AM5/30/12
to execut...@googlegroups.com
hello

the best way to do this right now is still using the 'Execute as
Single Statement' action from the popup menu in the editor (default
sort cut is CTRL-SHIFT-F5).

if this were added as an option, it would mean that when selected, you
could effectively not execute multiple statements - the semi-colon is
used as a delimiter for each statement. the statements would be sent
as-is to the driver and depending on the driver/database the results
would likely not be as expected.

the best approach here is still the execute a a single statement menu option.

thanks
Takis
--
http://executequery.org
Reply all
Reply to author
Forward
0 new messages