From 248c24390544ce758346b80526858cd73a378848 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Wed, 28 Jan 2009 20:45:10 +0000 Subject: We are not quoting the filter argument when filter type is 'IN' meaning the SQL is failing. --- Source/TableContent.m | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/TableContent.m b/Source/TableContent.m index 962f6dde..0fd35a05 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -428,22 +428,21 @@ return; } - //query started + // Query started [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self]; BOOL doQuote = YES; BOOL ignoreArgument = NO; // Start building the query string - queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", - [self fieldListForQuery], selectedTable]; + queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable]; // Add filter if appropriate if (([argument length] > 0) || [[[compareField selectedItem] title] hasSuffix:@"NULL"]) { - if ( ![compareType isEqualToString:@""] ) { - if ( [compareType isEqualToString:@"string"] ) { - //string comparision - switch ( tag ) { + if (![compareType isEqualToString:@""]) { + if ([compareType isEqualToString:@"string"]) { + // String comparision + switch (tag) { case 0: compareOperator = @"LIKE"; break; @@ -461,7 +460,7 @@ case 4: compareOperator = @"IN"; doQuote = NO; - [argument setString:[[@"(" stringByAppendingString:argument] stringByAppendingString:@")"]]; + [argument setString:[[@"('" stringByAppendingString:argument] stringByAppendingString:@"')"]]; break; case 5: compareOperator = @"IS NULL"; -- cgit v1.2.3