Hello,
I have been using DBI::Shell (via dbish) which provides a shell prompt for
interacting with a database and I think I have come across a bug that I might be able
to fix but am having trouble doing so. I looked on CPAN and Google and was not able to
find anything beyond basic information about the module. I could not find a bug list,
news group, mailing list, or website to track such problems. I would like to fix the
bug, and provide it as a fix to the author if it actually works.
In essence the bug is, if you use the character that normally precedes a dbish
command (default is /) in your statement other than for a command, DBI::Shell
interpretes everything that follows as a command. So if I type in:
INSERT INTO Table SET Foo='http://baz.com'/ (commands are terminated by a /)
DBI::Shell parses the first / instead of the last, which causes problems.
Also, DBI::Shell has things that follow the /, like "/describe Table" so you can't
just look for a terminating /.
Here is the code from DBI/Shell.pm that parses the command (line 354 on
V.11.2):
if ( $current_line =~ /
^(.*?)
$prefix
(?:(\w*)([^\|>]*))?
((?:\||>>?).+)?
$
/x) {
my ($stmt, $cmd, $args_string, $output) = ($1, $2, $3, $4||'');
-- cut --
I think the easiest thing would be to escape the prefix so I tried adding a
negative lookbehind assertion where you could escape the prefix with a backslash, but
it did not work, it still stopped at the first prefix:
-- cut --
^(.*?)
(?<!=\\)$prefix
(?:(\w*)([^\|>]*))?
-- cut --
I have not studied extended regexps too much, so I thought this would be a
good learning experience, and hopefully fix a module in the process.
If I am misunderstanding how to use DBI:Shell, let me know as well.
Thanks,
=-= Robert Thompson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]