View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021965FPCDatabase Componentspublic2012-05-06 19:012012-06-30 21:00
ReporterLudo Brands 
Assigned ToJoost van der Sluis 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version2.7.1Product Build21208 
Target VersionFixed in Version2.7.1 
Summary0021965: [Patch] TCustomSQLQuery.SQLParser fails when keyword is followed immediately by a left bracket
DescriptionA query such as 'select * from test where(id<>''00'')' is reported as read only because the parser never finds the "where" clause. Patch attached.
TagsNo tags attached.
FPCOldBugId
Fixed in Revision21742
Attached Filesdiff file icon sqldb.diff [^] (673 bytes) 2012-05-06 19:01 [Show Content]
? file icon testfieldtypes.pas.diff1 [^] (2,841 bytes) 2012-05-11 14:11
? file icon testfieldtypes.pas.diff2 [^] (3,206 bytes) 2012-05-14 12:20
? file icon sqldb.pp.diff2 [^] (9,318 bytes) 2012-05-14 12:21
? file icon sqldb.pp.diff2a [^] (9,995 bytes) 2012-05-15 09:52
? file icon testfieldtypes.pas.diff2a [^] (3,240 bytes) 2012-05-15 09:52

- Relationships
parent of 0022001resolvedLudo Brands Lazarus SQLQuery1.edit not edit or append 

-  Notes
(0059466)
LacaK (reporter)
2012-05-10 13:58

I am playing with parsing of sql statements with more complicated embedded comments like:
SQL.Text:='/**/SELECT * FROM/*a*/test --comment'0000013'/*WHERE(a>1)*/where/*a*/(a>3)/*c*/order by 1'

Where extracting for example TableName is more complicated.
So my question is if it is worth to rework parser to support it or simply do not support it and resigned to it.
(0059481)
LacaK (reporter)
2012-05-11 14:10

Testing patch in conjuction with ServerFilter reveals another bug.
(it seems, that SQLParser do not correctly set FWhereStartPos and/or FWhereStopPos)
See attached patch for test suite
(in future we may add there other more complex situations)
(0059577)
LacaK (reporter)
2012-05-14 12:20

Please look at patch 2. There are some improvements:
* fixed bug in AddFilter
* recognizes embedded comments /*..*/
* recognizes TableName in FROM part when used alias (SELECT ... FROM table [AS] t)
* recognizes ROWS (Firebird alternative to LIMIT)
Also tests updated.
(0059605)
LacaK (reporter)
2012-05-15 09:51
edited on: 2012-05-15 09:53

Patch 2a. Small improvements.
(f.e. MySQL requires space after -- comment start)

(0060755)
Marco van de Voort (manager)
2012-06-30 19:53

Committed.

- Issue History
Date Modified Username Field Change
2012-05-06 19:01 Ludo Brands New Issue
2012-05-06 19:01 Ludo Brands Status new => assigned
2012-05-06 19:01 Ludo Brands Assigned To => Joost van der Sluis
2012-05-06 19:01 Ludo Brands File Added: sqldb.diff
2012-05-10 13:58 LacaK Note Added: 0059466
2012-05-11 14:10 LacaK Note Added: 0059481
2012-05-11 14:11 LacaK File Added: testfieldtypes.pas.diff1
2012-05-14 12:20 LacaK Note Added: 0059577
2012-05-14 12:20 LacaK File Added: testfieldtypes.pas.diff2
2012-05-14 12:21 LacaK File Added: sqldb.pp.diff2
2012-05-15 09:51 LacaK Note Added: 0059605
2012-05-15 09:52 LacaK File Added: sqldb.pp.diff2a
2012-05-15 09:52 LacaK File Added: testfieldtypes.pas.diff2a
2012-05-15 09:53 LacaK Note Edited: 0059605
2012-06-30 19:53 Marco van de Voort Fixed in Revision => 21742
2012-06-30 19:53 Marco van de Voort Status assigned => resolved
2012-06-30 19:53 Marco van de Voort Fixed in Version => 2.7.1
2012-06-30 19:53 Marco van de Voort Resolution open => fixed
2012-06-30 19:53 Marco van de Voort Note Added: 0060755
2012-06-30 21:00 Ludo Brands Status resolved => closed
2012-10-27 11:48 Ludo Brands Relationship added parent of 0022001



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker