This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Build: NetBeans IDE 6.1 RC1 (Build 200804100130) VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_05-b13 OS: Windows XP, 5.1, x86 User Comments: 1. Add MySQL DB to an IDE (try jdbc:mysql://rave-db.russia.sun.com/travel or jdbc:mysql://jbrave-pc1.sfbay.sun.com/travel; login/password for both is 'travel'). 2. Open SQL Editor and add following code: delimiter ?? create procedure test() as begin set x = select count(*) from person; if x == 2 select * from trip; end if; end?? delimiter ; 3. Run query. Result: StringIndexOutOfBoundsException arises.
Created attachment 60270 [details] stacktrace
I set priority to P2 because I don't see any workaround. If there is some, please let me know and downgrade priority back to P3.
I was able to reproduce. It's an off-by-one error in my parsing. The workaround is to add an extra space after the last character in your command text. Then your example fails with a syntax error. I think I gave you this example, sorry. Try delimiter ?? create procedure test() begin declare x tinyint; select count(*) from person into x; if x = 2 then select * from trip; end if; end?? delimiter ; *with* the extra space at the end. Actually, you don't need to say 'delimiter ;' at the end if you're not going to run any more SQL after declaring stored proc.
You can validate the stored proc is there by opening up the Procedures node for the connection...
http://hg.netbeans.org/main?cmd=changeset;node=81cf7bae4006
Verified with trunk build 080422. Do push into patch1 branch.
The fix has been ported into the release61_fixes branch: http://hg.netbeans.org/release61_fixes/rev/9d5bff554439