Subject: | Need SQL Beautify Help |
Date: | Wed, 22 Apr 2009 19:41:59 -0500 |
To: | <bug-SQL-Beautify [...] rt.cpan.org> |
From: | "Steve Reiss" <Steve.Reiss [...] paraccel.com> |
Hi Jonas,
I found your EXCELLENT SQL Beautify module on CPAN last week for a project that I'm working on. It works great!
I have a problem where a literal in a WHERE clause gets split into 2 tokens and beautified into token1 token2. My example :
(problem token is in BOLD)
$sql_query = "select day, listtime from sales where field = N'problem' ";
%opts = (spaces => 2);
my $sql_beauty = new MyBeautify(%opts);
$sql_beauty->query($sql_query);
my $nice_sql = $sql_beauty->beautify;
print $nice_sql;
Output =
(I added the print *token = to the module at the top of the processing loop)
*token = select
*token = day
*token = ,
*token = listtime
*token = from
*token = sales
*token = where
*token = field
*token = =
*token = N
*token = 'problem'
select
day,
listtime
from
sales
where
field = N 'problem' ç incorrectly formatted token
The SQL now will fail to run because :
field = N<space>'problem'
Is invalid SQL - I get a type error on the N when running the query
Is there any way to work around this problem that I've run into?
Many thanks!
Steve Reiss | QA Engineer
PAR)ACCEL
steve.reiss@PARACCEL.COM <mailto:steve.reiss@PARACCEL.COM> | WWW.PARACCEL.COM <http://www.paraccel.com/>
3 Results Way, Cupertino, CA 95014
PHONE: 408-861-3524