0 Replies Latest reply on Dec 31, 2015 11:28 PM by RJLyders

    SQLcl: Release 4.2.0.15.295.1605: odd interpretation of # by SCRIPT command (with or without quotes)

    RJLyders

      System details:

          SQLcl: Release 4.2.0.15.295.1605

          Windows 7 64-bit Enterprise Service Pack 1

       

      NOTE: Very nice to be able to work with Javascript and SQL natively within SQLcl... very nice feature!

       

      While testing the SCRIPT command in SQLcl, I find that the "#" (pound or hash symbol) causes very odd behavior. It also doesn't seem to make any difference whether I enclose strings in single or double quotes or none.

       

      For instance, let's assume I have the following script files:

       

          D:\sqlcltest\sqlcl-hello.js:

          ctx.write('Hello World\n');

          D:\sqlcltest\sqlcl-hello#.js:

          ctx.write('Hello World\n');

       

      From within the directory D:\sqlcltest, I can start SQLcl and get the following results:

       

      SQL> script sqlcl-hello.js

       

      Hello World


      However, if I try to run the script with the filename that ends with "#", then I get a *BEEP* following by the a newline and I appear to be placed in editing mode.

      SQL> script sqlcl-hello#

        2* .js

       

      If I press the [ESCAPE] key then I get back to the SQL> prompt.

       

      Also, if I create a directory "D:\sqlcltest#" and copy the file "D:\sqlcltest\sqlcl-hello.js" to this new directory so that I have the following file:

          D:\sqlcltest#\sqlcl-hello.js:

          ctx.write('Hello World\n');

       

      From within the directory D:\sqlcltest#, I can start SQLcl and get the following results:

       

      SQL> script sqlcl-hello.js

       

      Could not load file: sqlcl-hello.js

       

      Another interesting point, if I try to run "host dir" in SQLcl while in the "D:\sqlcltest#" directory I get the following:

      SQL> host dir

       

      Cannot run program "cmd.exe" (in directory "D:\sqlcltest%23"): CreateProcess error=267, The directory name is invalid