From 383863f98dfc488db0181e01d39da1bb025d421b Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 21 Jul 2009 10:46:23 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20bug=20for=20table=20sorter=20in=20C?= =?UTF-8?q?ustom=20Query:=20-=20remove=20all=20comments=20before=20changin?= =?UTF-8?q?g/adding=20the=20ORDER=20clause=20(it=20can=20happen=20that=20t?= =?UTF-8?q?he=20original=20ORDER=20clause=20was=20commented=20out=20and=20?= =?UTF-8?q?the=20table=20sorter=20wouldn't=20work)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CustomQuery.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index c870237c..9ca44003 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -1437,6 +1437,9 @@ NSString* newOrder = [NSString stringWithFormat:@" ORDER BY %i %@ ", [[tableColumn identifier] intValue]+1, (isDesc)?@"DESC":@"ASC"]; //make queryString and perform query + [queryString replaceOccurrencesOfRegex:@"--.*?\n" withString:@""]; + [queryString replaceOccurrencesOfRegex:@"--.*?$" withString:@""]; + [queryString replaceOccurrencesOfRegex:@"/\\*(.|\n)*?\\*/" withString:@""]; if([queryString isMatchedByRegex:@"(?i)\\s+ORDER\\s+BY\\s+(.|\\n)+(\\s+(DESC|ASC))?(\\s|\\n)+(?=(LI|PR|IN|FO|LO))"]) [queryString replaceOccurrencesOfRegex:@"(?i)\\s+ORDER\\s+BY\\s+(.|\\n)+((\\s|\\n)+(DESC|ASC))?(\\s|\\n)+(?=(LI|PR|IN|FO|LO))" withString:newOrder]; else if ([queryString isMatchedByRegex:@"(?i)\\s+ORDER\\s+BY\\s+(.|\\n)+((\\s|\\n)+(DESC|ASC))?"]) -- cgit v1.2.3