aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-21 10:46:23 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-21 10:46:23 +0000
commit383863f98dfc488db0181e01d39da1bb025d421b (patch)
treecd556ef65645fbc58102828348cf5efec690f101
parent0efe2f26810e8849035ed77ddb2e642643345dee (diff)
downloadsequelpro-383863f98dfc488db0181e01d39da1bb025d421b.tar.gz
sequelpro-383863f98dfc488db0181e01d39da1bb025d421b.tar.bz2
sequelpro-383863f98dfc488db0181e01d39da1bb025d421b.zip
• fixed bug for table sorter in Custom Query:
- remove all comments before changing/adding the ORDER clause (it can happen that the original ORDER clause was commented out and the table sorter wouldn't work)
-rw-r--r--Source/CustomQuery.m3
1 files changed, 3 insertions, 0 deletions
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))?"])