SQL-Statement problem

Dear all

i am having a problem with SQL-Statement-1.005, whereas 
SQL-Statement-0.1020 is working fine.

SQL ERROR: Mismatched parentheses in WHERE clause!
SV = RV(0x810cad0) at 0x829105c
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,ROK)
  RV = 0x83844e4
DBD::CSV::st execute failed: dbih_getcom handle 
'DBD::CSV::Statement=HASH(0x83844e4)'
is not a DBI handle (has no magic) at 
/usr/local/lib/perl5/site_perl/5.6.0/SQL/Statement.pm line 164.

I think i tracked this down to Parser.pm the cleansql routine which 
skips closing parens, but not the
corresponding openings:
     warn "Before $sql";
     $sql =~ s~'(([^'$e]|$e.|'')+)'~push(@$fields,$1);$i++;"?$i?"~ge;
     warn "After $sql";

Before
SELECT KOLOM1,KOLOM8,KOLOM5,KOLOM6,KOLOM7 FROM MYTABLE
WHERE ( (  ( ( KOLOM4 = '123456' OR KOLOM4 = '' ) AND KOLOM3 = '127' ) 
OR KOLOM8 = 'TRUE' ) AND KOLOM1 = 'bla' )
at /usr/local/lib/perl5/site_perl/5.6.0/SQL/Parser.pm line 1679.


After SELECT KOLOM1,KOLOM8,KOLOM5,KOLOM6,KOLOM7 FROM MYTABLE
WHERE ( (  ( ( KOLOM4 = ?0? OR KOLOM4 = '?1?127?2?TRUE?3?bla' )
at /usr/local/lib/perl5/site_perl/5.6.0/SQL/Parser.pm line 1681.


The (not ideal)query is generated from another application, which is not 
easy to change, so that is not an option
Switching to SQL-Statement-0.1020 solves this, but introduces another 
problem, (there i cannot use the
SELECT KOLOM1, NULL, KOLOM3 statement)

Any suggestions ?

Thanks
Walter Takens

0
takens
2/14/2003 10:21:56 AM
perl.dbi.users 11085 articles. 1 followers. Follow

3 Replies
355 Views

Similar Articles

[PageSpeed] 22



>=20
> Dear all
>=20
> i am having a problem with SQL-Statement-1.005, whereas=20
> SQL-Statement-0.1020 is working fine.

Where dit oyu get the Label SQL-Statement-1.00XX ?
Why didn't you mark the two queries below with those?

>=20
> SQL ERROR: Mismatched parentheses in WHERE clause!
> SV =3D RV(0x810cad0) at 0x829105c
>   REFCNT =3D 1
>   FLAGS =3D (PADBUSY,PADMY,ROK)
>   RV =3D 0x83844e4
> DBD::CSV::st execute failed: dbih_getcom handle=20
> 'DBD::CSV::Statement=3DHASH(0x83844e4)'
> is not a DBI handle (has no magic) at=20
> /usr/local/lib/perl5/site_perl/5.6.0/SQL/Statement.pm line 164.
>=20
> I think i tracked this down to Parser.pm the cleansql routine which=20
> skips closing parens, but not the
> corresponding openings:
>      warn "Before $sql";
>      $sql =3D~ =
s~'(([^'$e]|$e.|'')+)'~push(@$fields,$1);$i++;"?$i?"~ge;
>      warn "After $sql";
>=20
> Before
> SELECT KOLOM1,KOLOM8,KOLOM5,KOLOM6,KOLOM7 FROM MYTABLE
> WHERE ( (  ( ( KOLOM4 =3D '123456' OR KOLOM4 =3D '' ) AND KOLOM3=20
> =3D '127' )=20
> OR KOLOM8 =3D 'TRUE' ) AND KOLOM1 =3D 'bla' )

Does this query work from the command line app?

It seems to me it wouldn't becaue you have 4 ('s and 3 )'s
So just by ete balling it I'd say you have a "Mismatched parentheses in =
WHERE clause".

Is there an echo? :)

If it work sfrom the command Line I'd be surprised.


> at /usr/local/lib/perl5/site_perl/5.6.0/SQL/Parser.pm line 1679.
>=20
>=20
> After SELECT KOLOM1,KOLOM8,KOLOM5,KOLOM6,KOLOM7 FROM MYTABLE=20
> WHERE ( (  ( ( KOLOM4 =3D ?0? OR KOLOM4 =3D '?1?127?2?TRUE?3?bla'=20
> ) at /usr/local/lib/perl5/site_perl/5.6.0/SQL/Parser.pm line 1681.
>=20
>=20
> The (not ideal)query is generated from another application,=20
> which is not=20
> easy to change, so that is not an option
> Switching to SQL-Statement-0.1020 solves this, but introduces another=20
> problem, (there i cannot use the
> SELECT KOLOM1, NULL, KOLOM3 statement)
>=20
> Any suggestions ?
>=20
> Thanks
> Walter Takens
>=20
>=20
0
dmuey
2/14/2003 6:16:49 PM
Walter B. Takens wrote:

> Dear all
>
> i am having a problem with SQL-Statement-1.005, whereas 
> SQL-Statement-0.1020 is working fine.
>
> SELECT KOLOM1,KOLOM8,KOLOM5,KOLOM6,KOLOM7 FROM MYTABLE
> WHERE ( (  ( ( KOLOM4 = '123456' OR KOLOM4 = '' ) AND KOLOM3 = '127' ) 
> OR KOLOM8 = 'TRUE' ) AND KOLOM1 = 'bla' ) 

Yes, sorry, there are two bugs in SQL::Statement that are biting you 
there, I am working on both.  The first is the = '' construction -- the 
parser gets confused by that.  The second is the unecessary (but quite 
valid) enclosing of the WHERE clause in outer parens.  Sorry, there is 
no quick fix, I'll try for a new release as soon as I can.

-- 
Jeff

0
jeff
2/14/2003 7:27:48 PM
Dan Muey wrote:

>>Before
>>SELECT KOLOM1,KOLOM8,KOLOM5,KOLOM6,KOLOM7 FROM MYTABLE
>>WHERE ( (  ( ( KOLOM4 = '123456' OR KOLOM4 = '' ) AND KOLOM3 
>>= '127' ) 
>>OR KOLOM8 = 'TRUE' ) AND KOLOM1 = 'bla' )
>>
>
>Does this query work from the command line app?
>
>It seems to me it wouldn't becaue you have 4 ('s and 3 )'s
>

I count four and four.  The problem is on my end, not on Walter's.

-- 
Jeff

0
jeff
2/14/2003 7:28:40 PM
Reply:

Similar Artilces:

SQL::Statement v2, consequences to Meta-DBD's (and DBI) and the future of DBI::SQL::Nano
Hi Tim, regarding to our short discussion in #dbi about the future of SQL::Statement and the implications to DBI::SQL::Nano here the open discussion for all. I've want to improve SQL::Statement by design, that means I want to design it from the basics using Design Patterns (especially the Command Pattern and the Factory Pattern - and surely some more). The goal should be, to reduce the amount of conditionals in the code and move them into polymorphism. I want to start with a BNF based parser, which should be more extensible and should allow translations into other dialects by d...

Problem in SQL Developing as restricted user (member of user group)
Greetings,VWD EE and other Tools do not have problems working O.K. on my machine, when I am logged-on as restricted(limited) user, both environment and local web server are functioning, and it was MS effort to do it right.BUT the Problem is, when I try to connect to database->new DB connection(either through vwd or management studio etc). I get an Error - which should be written to event log (according to msg) but it isn't - that I can't connect. I am sure that it is because NO SQL SERVER2005EXPRESS instance is running, which I think is the only prerequisite to have it work (I do not need...

Problem with analytic sql function (The OVER SQL construct or statement is not supported)
Hi All!  Could You comment the next situation:I'm configuring my TableAdapter just like Scott Mitchell does in his tutorialhttp://www.asp.net/learn/data-access/tutorial-70-vb.aspxThe only principal difference is that I need Insert/update and deletemethods to be generated (His aim is only SELECT).I'm also using analytic function (ROW_NUMBER) and I'm also gettinwarning “The OVER SQL construct or statement is not supported.” Yousay then that it could be ignored. But, in this case statements tomodify data (insert/update and delete) aren't being generated, thoughafter w...

SQL::Statement problem
I posted a similar message to Jeff directly but I never got a confirmation that he actually received. So let's try here... Firstly, I've found out that RLIKE is broken: sub is_matched { ... if ($op =~ /LIKE|CLIKE/i) { $val2 = quotemeta($val2); $val2 =~ s/\\%/.*/g; $val2 =~ s/_/./g; } If $op i s'RLIKE', and since 'RLIKE' contains the string 'LIKE', the pattern is run through quotemeta(). Also, the SQL operators IS and the LIKE family are case-sensitive, which is contrary to SQL specs if I'm not mista...

Problem with sql statement
Hi all I've got some trouble with a sql statement. What I have got: 4 Tables 1. tFuel------------------------FuelId | FuelDescription ... 1 | Diesel  2 | SomeOtherKindOfFuel 2. tFuelPrice------------------------GasStationId | FuelId | Price ...1 | 1 | 1.451 | 2 | 1.30 3. tGasStation------------------------GasStationId | GasStationGroupId | Name ...1 | 2 | Millers Gas Station |2 | 1 | Chucky's Gas Station | 4. tGasStationGroup------------------------GasStationGroupId | Name ...1 | BP2 | Shell So, what I want to achive is the following I'd like to show the user a list of all...

SQL Statement problem
I am trying to pull certain information from a database by using the ISQL window, but Powerbuilder keeps locking up when I type the following code, could someone please show me what I'm doing wrong (assuming that all of the spelling is correct)? Thanks!!! SELECT t0.code, t0.billcode FROM billcode t0 WHERE t0.code in (SELECT distinct t1.code FROM app_charges_old t1 WHERE t1.invoice_number IN (SELECT t2.invoice_number FROM invoice_summary_old t2 WHER...

SQL Statement Problem
Hello all, Let's see if we have some pro's out here or not. This could be simple actually, but I don't know how... I have two tables, "Projects", and "Tasks." Now what I am trying to do is list the projects on a page. And I have managed to do that nicely. And, while it's looking, I actually have it open up another recordset inside of that one (which is looping) and have it lookup the tasks status percentage. So, when looking at one record, it looks like this: Projects - ID Title Status 1 Sam...

SQL statement problems
Hey gang, I'm trying to work out why on earth my SQL statement refuses to work. I've tested it on my db within Access, yet working off the website itself, it just refuses to return anything when there should be 7 or so listed. Can anyone see anything wrong with my statement (warning, it's long): strConnection = @"Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + (string) Server.MapPath("GAAP.mdb"); strSqlCommand = "SELECT STUDENT.STUDENT_ID, STUDENT.STUDENT_LAST_NAME, STUDENT.STUDENT_FIRST_NAME, UNIT_STUDENT.STUDENT_EMAIL, UNIT_STUDENT.STUDENT_PASSWO...

Problem with IF statement in SQL
 Can someone please tell me what I'm doing wrong here:  CREATE PROCEDURE dbo.AddProductToEnquiry @SessionID int, @ProductID int AS DECLARE @CountProductInEnquiry int SET @CountProductInEnquiry = (SELECT Count(*) FROM Enquiry_Items WHERE SessionID=@SessionID AND ProductID=@ProductID) IF @CountProductInEnquiry = 0 THEN INSERT INTO Enquiry_Items ([SessionID], [ProductID], [Date]) VALUES (@SessionID, @ProductID, GETDATE()) END IF   Cheers,Curt Regards, Curt  Actually I think Ive fixed it. Can someone please conf...

A problem about SQL Statement
Hello, I've got a problem about a Select statement with the following criteria: Data Table Key Num1 Num2 A 1 2 A 1 2 A 2 3 B 0 0 B 1 1 C 2 1 C 1 2 I would like to select all row of a key if the (sum of num1 - sum of num2) with that key != 0 In the above case, the outcome would be: A 1 2 A 1 2 A 2 3 Could any body advise what the SQL should be? Many thanks!   Hi,newbie Try Like This I have shown the select query in bold   CReate table Test_Sql ([Key] varchar(20),[Num1] int, [Num2] i...

Problem with defaults and User defined datatype in SQL Server 2000 or SQL 7
why does powerdesigner create a default in the definition of a table like this (SQL 2000 or 7.5 don't allow it). I use PD7.5.0.826 create table dbo.STOCK ( STOCKID TStockId not null, Goods TGoods not null, Amount TAmount not null default 'create default D_TAmount as 0',, constraint PK_STOCK primary key (STOCKID) ) go Anybody got a clue to fix the definition file to use the correct syntax Found the problem, it was and error introduced after reading models created from ...

[perl5-dbi/DBI-Test] 471857: merge *.bak pattern from SQL::Statement
----==_mimepart_51fabf251b56b_1d099afd586404f Date: Thu, 01 Aug 2013 13:03:49 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <51fabf2524dcd_1d099afd5864130@hookshot-fe4-pe1-prd.aws.github.net.mail> Branch: refs/heads/master Home: https://github.com/perl5-dbi/DBI-Test Commit: 4718570be270e1a88269b7e94dc1ec8e9abdee3c https://github.com/perl5-dbi/DBI-Test/commit/4718570be270e1a88269b7e94dc1ec8e9abdee3c Author: Jens Rehsack <sno@netbsd.org> Date: 2013-08-01 (Thu, 01 Aug 2013) Changed pa...

Problems with SQL statement
Hello all I have the below SQL statement querying my access database. To me the code looks fine and I can't see what’s wrong with it, but when I execute it I get the syntax error message at the bottom of this post. The code is supposed to take input text from a search field and use it to search selected fields in the database. It then returns these where there are matches and where the quantity is = 1. I'm sure the problem is something really simple but all help would be appreciated. The SQL query: ("Select ProductID, ProductName, " _ & "BriefDescription, ...

SQL Statement problem
Can someone please tell me what is wrong with my SQL below..I think I am missing a quote somewhere... "select distinct itype from TR_data_and_history where stationname ='" & StationNameString & " and highkv ='" & VoltageString & "' " StationNameString single quotes are not endedSushila Bowalekar PatelVisual ASP/ASP.NET MVPhttp://weblogs.asp.net/sushilasb Thank you..that was the problem. Final statement = "select distinct itype from TR_data_and_history where stationname ='" & StationNameString & "' and highkv...

Web resources about - SQL-Statement problem - perl.dbi.users

Resources last updated: 12/29/2015 5:56:29 AM