Thank you! I'd been working on a regexp for this problem, but couldn't
get it to work. I've a series of SQL statements that cause dbish
incorrectly execute, where Oracle's sqlplus will parse correctly.

Yes ... I really need to release a newer version of dbish ... it's just that
I'm not sure if the code is ready.

Tom

On Fri, Oct 18, 2002 at 03:14:02PM +0000, Robert Thompson wrote:
>       I am using version 11.2, which according to cpan.org is the most
>       current. I could not find a bug list, or other resource, to see
>       if this bug was noted or a patch/fix available.
> 
>       I was able to make a fix for it, with the help of some other
>       perl gurus. The fix allows you to escape the prefix by preceding
>       it with a backslash. Below is a diff of the original
>       DBI/Shell.pm (ver 11.2) and the changed file. It has code to
>       detect the escaped prefix, and to remove the backslash from the
>       statement before continuing. This patch works for what I was
>       using it for, but I have not tested it thoroughly, for all
>       possible command combinations. Also, I only considered the $stmt
>       portion of the line, not the $cmd, $args_string, or $output.
> 
> 
> >$ diff -u ~/orig.Shell.pm Shell.pm 
> --- /home/rthompson/orig.Shell.pm       Thu Oct 17 14:55:25 2002
> +++ Shell.pm    Thu Oct 17 19:12:12 2002
> @@ -353,14 +353,17 @@
>  
>         if ( $current_line =~ /
>                 ^(.*?)
> -               $prefix
> +               (?<!\\)$prefix
>                 (?:(\w*)([^\|>]*))?
>                 ((?:\||>>?).+)?
>                 $
>         /x) {
>             my ($stmt, $cmd, $args_string, $output) = ($1, $2, $3, $4||''); 
>  
> -           $sh->{current_buffer} .= "$stmt\n" if length $stmt;
> +            if (length $stmt) {
> +                $stmt =~ s/\\$prefix/$prefix/g;
> +                $sh->{current_buffer} .= "$stmt\n";
> +            }
>  
>             $cmd = 'go' if $cmd eq '';
>             my @args = split ' ', $args_string||'';

-- 
Thomas A. Lowery

Reply via email to