Skip Menu |

This queue is for tickets about the DBI-Shell CPAN distribution.

Report information
The Basics
Id: 21200
Status: resolved
Priority: 0/
Queue: DBI-Shell

People
Owner: DLAMBLEY [...] cpan.org
Requestors: jcalkins [...] swcp.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 11.93
Fixed in: (no value)



Subject: No escape for slash (/) to allow its use in a SQL statement.
Using "select 1/2;" causes an error "Command '2' not recognised". Dividing in a SQL statement is sometimes important. Let's say I want to find stock prices that are evenly divisible by 5.00 because my quote provider is giving lots of bad quotes. There's no floor() function in ODBC, so I use "select Symbol, QuoteTime, Last_Price from Watch_Detail where Last_Price/5 = int(Last_Price/5);" This causes an error in dbish but works great in Perl.
CC: jcalkins [...] swcp.com
Subject: Re: [rt.cpan.org #21200] No escape for slash (/) to allow its use in a SQL statement.
Date: Mon, 28 Aug 2006 21:55:45 -0400
To: bug-DBI-Shell [...] rt.cpan.org
From: "Thomas A. Lowery" <tlowery [...] rparts.us>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 jcalkins@swcp.com via RT wrote: Show quoted text
> Sun Aug 27 21:41:23 2006: Request 21200 was acted upon. > Transaction: Ticket created by jcalkins@swcp.com > Queue: DBI-Shell > Subject: No escape for slash (/) to allow its use in a SQL statement. > Broken in: (no value) > Severity: Normal > Owner: Nobody > Requestors: jcalkins@swcp.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=21200 > > > > Using "select 1/2;" causes an error "Command '2' not recognised". > Dividing in a SQL statement is sometimes important. Let's say I want to > find stock prices that are evenly divisible by 5.00 because my quote > provider is giving lots of bad quotes. There's no floor() function in > ODBC, so I use "select Symbol, QuoteTime, Last_Price from Watch_Detail > where Last_Price/5 = int(Last_Price/5);" This causes an error in dbish > but works great in Perl.
There's a problem with the Regex that determines what is and isn't a command. I've attempted to fix the problem over the years but haven't had success. The simplest work around is to change the command_prefix using the opt command or in your .dbish_config file. The only thing to note is that the command_prefix applies to all command not just execute. @> select 1; 1 '1' [1 rows of 1 fields returned] @> select 1 / 2; 1 '1' [1 rows of 1 fields returned] @> /opt batch: 0 chistory_size: 50 command_prefix: [/;] command_prefix_end: ; command_prefix_line: / debug: 0 desc_format: partbox desc_show_columns: COLUMN_NAME,DATA_TYPE,TYPE_NAME,COLUMN_SIZE,PK,NULLABLE,COLUMN_DEF,IS_NULLABLE,REMARKS desc_show_long: 1 desc_show_remarks: 1 editor: vi format: neat home_dir: /home/tlowery init_autocommit: 1 init_trace: 0 prompt: rhistory_head: 5 rhistory_size: 50 rhistory_tail: 5 seperator: , sqlpath: . tmp_dir: undef tmp_file: dbish8395.sql user_level: 1 @> /opt command_prefix=; /option command_prefix=; (was [/;]) @> select 1 / 2; 1 / 2 '0.50' [1 rows of 1 fields returned] Hope this helps. Tom -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFE856h3Tj212QIeB4RAvYkAJ9hkWew2IqRFEfwbXwDepiYZQk8IQCfYOHk rjyzaCk/A0Ls7CrkZY/uU8I= =5iuq -----END PGP SIGNATURE-----
Subject: Re: [rt.cpan.org #21200] No escape for slash (/) to allow its use in a SQL statement.
Date: Tue, 26 Sep 2006 10:43:32 -0600
To: "Thomas A. Lowery via RT" <bug-DBI-Shell [...] rt.cpan.org>, bug-DBI-Shell [...] rt.cpan.org
From: "Joe Calkins" <jcalkins [...] swcp.com>
Hi Tom, Thanks for your quick response. Sorry for my delayed reply. I followed your suggestion, and it works like a charm (except that ODBC is _very_ strange with some embedded calculations--not your problem). I changed my dbish instantiation batch file to automagically make the backslash a command character to match the mysql client: call dbish.bat -command_prefix=[\\;] %* Would you like me to retract the bug report or mark it resolved? Thanks again, -- Joe Calkins jcalkins@swcp.com mobile (505) 321-6030 On 28 Aug 2006 at 21:55, Thomas A. Lowery via RT wrote: <URL: http://rt.cpan.org/Ticket/Display.html?id=21200 > -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 jcalkins@swcp.com via RT wrote: Show quoted text
> Sun Aug 27 21:41:23 2006: Request 21200 was acted upon. > Transaction: Ticket created by jcalkins@swcp.com > Queue: DBI-Shell > Subject: No escape for slash (/) to allow its use in a SQL statement. > Broken in: (no value) > Severity: Normal > Owner: Nobody > Requestors: jcalkins@swcp.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=21200 > > > > Using "select 1/2;" causes an error "Command '2' not recognised". > Dividing in a SQL statement is sometimes important. Let's say I want to > find stock prices that are evenly divisible by 5.00 because my quote > provider is giving lots of bad quotes. There's no floor() function in > ODBC, so I use "select Symbol, QuoteTime, Last_Price from Watch_Detail > where Last_Price/5 = int(Last_Price/5);" This causes an error in dbish > but works great in Perl.
There's a problem with the Regex that determines what is and isn't a command. I've attempted to fix the problem over the years but haven't had success. The simplest work around is to change the command_prefix using the opt command or in your .dbish_config file. The only thing to note is that the command_prefix applies to all command not just execute. @> select 1; 1 '1' [1 rows of 1 fields returned] @> select 1 / 2; 1 '1' [1 rows of 1 fields returned] @> /opt batch: 0 chistory_size: 50 command_prefix: [/;] command_prefix_end: ; command_prefix_line: / debug: 0 desc_format: partbox desc_show_columns: COLUMN_NAME,DATA_TYPE,TYPE_NAME,COLUMN_SIZE,PK,NULLABLE,COLUMN_DEF,IS_NULLABLE,REMARKS desc_show_long: 1 desc_show_remarks: 1 editor: vi format: neat home_dir: /home/tlowery init_autocommit: 1 init_trace: 0 prompt: rhistory_head: 5 rhistory_size: 50 rhistory_tail: 5 seperator: , sqlpath: . tmp_dir: undef tmp_file: dbish8395.sql user_level: 1 @> /opt command_prefix=; /option command_prefix=; (was [/;]) @> select 1 / 2; 1 / 2 '0.50' [1 rows of 1 fields returned] Hope this helps. Tom -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFE856h3Tj212QIeB4RAvYkAJ9hkWew2IqRFEfwbXwDepiYZQk8IQCfYOHk rjyzaCk/A0Ls7CrkZY/uU8I= =5iuq -----END PGP SIGNATURE-----
Subject: Re: [rt.cpan.org #21200] No escape for slash (/) to allow its use in a SQL statement.
Date: Tue, 26 Sep 2006 21:46:56 -0400
To: bug-DBI-Shell [...] rt.cpan.org
From: "Thomas A. Lowery" <tlowery [...] rparts.us>
Just mark it resolved. Hopefully I'll have a better solution when time permits. jcalkins@swcp.com via RT wrote: Show quoted text
> Queue: DBI-Shell > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=21200 > > > Hi Tom, > > Thanks for your quick response. Sorry for my delayed reply. > > I followed your suggestion, and it works like a charm (except that ODBC is > _very_ strange with some embedded calculations--not your problem). > > I changed my dbish instantiation batch file to automagically make the backslash > a command character to match the mysql client: > call dbish.bat -command_prefix=[\\;] %* > > Would you like me to retract the bug report or mark it resolved? > > Thanks again, > >
On Tue Sep 26 21:47:22 2006, tlowery@rparts.us wrote: Show quoted text
> Just mark it resolved. Hopefully I'll have a better solution when > time > permits. > > jcalkins@swcp.com via RT wrote:
> > Queue: DBI-Shell > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=21200 > > > > > Hi Tom, > > > > Thanks for your quick response. Sorry for my delayed reply. > > > > I followed your suggestion, and it works like a charm (except that > > ODBC is > > _very_ strange with some embedded calculations--not your problem). > > > > I changed my dbish instantiation batch file to automagically make the > > backslash > > a command character to match the mysql client: > > call dbish.bat -command_prefix=[\\;] %* > > > > Would you like me to retract the bug report or mark it resolved? > > > > Thanks again, > > > >
I have added an error message which hopefully makes the behaviour clearer. https://repo.or.cz/perl-DBI-Shell.git/commitdiff/7b90a6c68035c03e89ef866e52a8bade3c86b5db All the best, Dave