[This topic is migrated from our old forums. The original author name has been removed]
A couple of questions/issues with @run:
1) If I @run a filename that doesn't exist, (say, "@run nonexist;"), I get an error alert indicating the file doesn't exist, as expected. However, the Debug Window also pops up, and displays the Java IOException info as well, which probably shouldn't happen. It looks like you are only half-catching the underlying exception? DbVis 7.0.6 on OSX 10.6.3 with 64-bit Java 1.6.0_17.
java.io.IOException: @run nonexist
/Users/oberst/Apps/nonexist (No such file or directory)
at com.onseven.dbvis.R.E.?(Z:1005)
at com.onseven.dbvis.R.E.?(Z:2872)
at com.onseven.dbvis.R.E$D.?(Z:42)
at se.pureit.swing.A.O$2.run(Z:1192)
at java.lang.Thread.run(Thread.java:637)
2) assume I have 2 legitimate SQL files in the current working directory, "testfile.sql" and "subdir/subtest.sql" (note the second one is in a subdirectory called "subdir": If I run the following:
@run testfile.sql;
@run subdir/subtest.sql;
things work as expected. However, if I add a third line:
@run testfile.sql;
@run subdir/subtest.sql;
@run nonexist;
Then it looks like the non-existing file in line three causes this to fail in initial parsing stage, and neither of the first two lines ever get executed. I'm not sure if this is because of the Java exception glitch above is halting execution unexpectedly, or even if that is fixed your intention is to not execute the entire script because of the reference to the bogus filename?
3) The following works as expected, running testfile.sql, changing the directory to subdir, then running subtest.sql from there:
@run testfile.sql;
@cd subdir;
@run subtest.sql;
However, this doesn't work:
@run testfile.sql;
@cd ${newpath||subdir}$;
@run subtest.sql;
The intent is to allow a user-variable as the parameter to "@cd", but instead the " ${newpath||subdir}$/subtest.sql (No such file or directory)" error dialog comes up. It looks like you check for the existence of files for "@run" +before+ you do the variable substitution. It may not be feasible to alter your parsing logic, but if it were possible to defer the filename checks until +after+ the substitutions are done, it would officially be a Nifty Thing... :)
4) @cd nonexist;
It might be nice if the @cd command resulted in a warning (or perhaps an error) for a non-existent path. A command like "@ddl wombat="objId;" returns an error state, so it looks like this is possible for your client commands.
Hi David,
Thanks for reporting this. Answers below:
> 1) If I @run a filename that doesn't exist, (say, "@run nonexist;"), I get an error alert indicating the file doesn't exist, as expected. However, the Debug Window also pops up, and displays the Java IOException info as well, which probably shouldn't happen. It looks like you are only half-catching the underlying exception? DbVis 7.0.6 on OSX 10.6.3 with 64-bit Java 1.6.0_17.
>
> java.io.IOException: @run nonexist
/Users/oberst/Apps/nonexist (No such file or directory)
> at com.onseven.dbvis.R.E.?(Z:1005)
> at com.onseven.dbvis.R.E.?(Z:2872)
> at com.onseven.dbvis.R.E$D.?(Z:42)
> at se.pureit.swing.A.O$2.run(Z:1192)
> at java.lang.Thread.run(Thread.java:637)
The message in the Debug Window should not be written in this case. It will be fixed in the next maintenance release.
> 2) assume I have 2 legitimate SQL files in the current working directory, "testfile.sql" and "subdir/subtest.sql" (note the second one is in a subdirectory called "subdir": If I run the following:
>
> @run testfile.sql;
> @run subdir/subtest.sql;
>
> things work as expected. However, if I add a third line:
>
> @run testfile.sql;
> @run subdir/subtest.sql;
> @run nonexist;
>
> Then it looks like the non-existing file in line three causes this to fail in initial parsing stage, and neither of the first two lines ever get executed. I'm not sure if this is because of the Java exception glitch above is halting execution unexpectedly, or even if that is fixed your intention is to not execute the entire script because of the reference to the bogus filename?
This is the intended behavior, and will continue to be like this even after 1) is fixed.
> 3) The following works as expected, running testfile.sql, changing the directory to subdir, then running subtest.sql from there:
>
> @run testfile.sql;
> @cd subdir;
> @run subtest.sql;
>
> However, this doesn't work:
>
> @run testfile.sql;
> @cd ${newpath||subdir}$;
> @run subtest.sql;
>
> The intent is to allow a user-variable as the parameter to "@cd", but instead the " ${newpath||subdir}$/subtest.sql (No such file or directory)" error dialog comes up. It looks like you check for the existence of files for "@run" +before+ you do the variable substitution. It may not be feasible to alter your parsing logic, but if it were possible to defer the filename checks until +after+ the substitutions are done, it would officially be a Nifty Thing... :)
I can't promise anything, but I will have a look at what it would take to make it possible to use variables in @cd and @run commands.
> 4) @cd nonexist;
>
> It might be nice if the @cd command resulted in a warning (or perhaps an error) for a non-existent path. A command like "@ddl wombat="objId;" returns an error state, so it looks like this is possible for your client commands.
I'll have a look at this as well.
Best Regards,
Hans
Roger Bjärevall
said
over 14 years ago
[This reply is migrated from our old forums.]
Re: @run issues
David,
This is now fixed in DbVisualizer 7.0.7.
Best Regards
Roger
anonymous
/Users/oberst/Apps/nonexist (No such file or directory) at com.onseven.dbvis.R.E.?(Z:1005) at com.onseven.dbvis.R.E.?(Z:2872) at com.onseven.dbvis.R.E$D.?(Z:42) at se.pureit.swing.A.O$2.run(Z:1192) at java.lang.Thread.run(Thread.java:637) 2) assume I have 2 legitimate SQL files in the current working directory, "testfile.sql" and "subdir/subtest.sql" (note the second one is in a subdirectory called "subdir": If I run the following: @run testfile.sql; @run subdir/subtest.sql; things work as expected. However, if I add a third line: @run testfile.sql; @run subdir/subtest.sql; @run nonexist; Then it looks like the non-existing file in line three causes this to fail in initial parsing stage, and neither of the first two lines ever get executed. I'm not sure if this is because of the Java exception glitch above is halting execution unexpectedly, or even if that is fixed your intention is to not execute the entire script because of the reference to the bogus filename? 3) The following works as expected, running testfile.sql, changing the directory to subdir, then running subtest.sql from there: @run testfile.sql; @cd subdir; @run subtest.sql; However, this doesn't work: @run testfile.sql; @cd ${newpath||subdir}$; @run subtest.sql; The intent is to allow a user-variable as the parameter to "@cd", but instead the " ${newpath||subdir}$/subtest.sql (No such file or directory)" error dialog comes up. It looks like you check for the existence of files for "@run" +before+ you do the variable substitution. It may not be feasible to alter your parsing logic, but if it were possible to defer the filename checks until +after+ the substitutions are done, it would officially be a Nifty Thing... :) 4) @cd nonexist; It might be nice if the @cd command resulted in a warning (or perhaps an error) for a non-existent path. A command like "@ddl wombat="objId;" returns an error state, so it looks like this is possible for your client commands.