From 92022eb14512d1e6aa17c6bb956f83d7b3f7e579 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 25 Feb 2012 18:38:21 +0000 Subject: Move QueryKit to it's own project. --- Frameworks/QueryKit/QKQuery.h | 110 ---- Frameworks/QueryKit/QKQuery.m | 438 --------------- Frameworks/QueryKit/QKQueryOperators.h | 56 -- Frameworks/QueryKit/QKQueryParameter.h | 70 --- Frameworks/QueryKit/QKQueryParameter.m | 86 --- Frameworks/QueryKit/QKQueryTypes.h | 45 -- Frameworks/QueryKit/QKQueryUtilities.h | 46 -- Frameworks/QueryKit/QKQueryUtilities.m | 96 ---- Frameworks/QueryKit/QueryKit.h | 37 -- .../QueryKit/QueryKit.xcodeproj/project.pbxproj | 593 +++++++++++++++++++++ Frameworks/QueryKit/Resources/Info.plist | 22 + Frameworks/QueryKit/Resources/Tests-Info.plist | 22 + Frameworks/QueryKit/Source/QKQuery.h | 110 ++++ Frameworks/QueryKit/Source/QKQuery.m | 438 +++++++++++++++ Frameworks/QueryKit/Source/QKQueryOperators.h | 56 ++ Frameworks/QueryKit/Source/QKQueryParameter.h | 70 +++ Frameworks/QueryKit/Source/QKQueryParameter.m | 86 +++ Frameworks/QueryKit/Source/QKQueryTypes.h | 45 ++ Frameworks/QueryKit/Source/QKQueryUtilities.h | 46 ++ Frameworks/QueryKit/Source/QKQueryUtilities.m | 96 ++++ Frameworks/QueryKit/Source/QueryKit-Prefix.pch | 3 + Frameworks/QueryKit/Source/QueryKit.h | 37 ++ Frameworks/QueryKit/Tests/QKSelectQueryTests.h | 35 ++ Frameworks/QueryKit/Tests/QKSelectQueryTests.m | 76 +++ Resources/Plists/QueryKit-Info.plist | 22 - UnitTests/QKSelectQueryTests.h | 35 -- UnitTests/QKSelectQueryTests.m | 76 --- sequel-pro.xcodeproj/project.pbxproj | 261 ++------- 28 files changed, 1794 insertions(+), 1319 deletions(-) delete mode 100644 Frameworks/QueryKit/QKQuery.h delete mode 100644 Frameworks/QueryKit/QKQuery.m delete mode 100644 Frameworks/QueryKit/QKQueryOperators.h delete mode 100644 Frameworks/QueryKit/QKQueryParameter.h delete mode 100644 Frameworks/QueryKit/QKQueryParameter.m delete mode 100644 Frameworks/QueryKit/QKQueryTypes.h delete mode 100644 Frameworks/QueryKit/QKQueryUtilities.h delete mode 100644 Frameworks/QueryKit/QKQueryUtilities.m delete mode 100644 Frameworks/QueryKit/QueryKit.h create mode 100644 Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj create mode 100644 Frameworks/QueryKit/Resources/Info.plist create mode 100644 Frameworks/QueryKit/Resources/Tests-Info.plist create mode 100644 Frameworks/QueryKit/Source/QKQuery.h create mode 100644 Frameworks/QueryKit/Source/QKQuery.m create mode 100644 Frameworks/QueryKit/Source/QKQueryOperators.h create mode 100644 Frameworks/QueryKit/Source/QKQueryParameter.h create mode 100644 Frameworks/QueryKit/Source/QKQueryParameter.m create mode 100644 Frameworks/QueryKit/Source/QKQueryTypes.h create mode 100644 Frameworks/QueryKit/Source/QKQueryUtilities.h create mode 100644 Frameworks/QueryKit/Source/QKQueryUtilities.m create mode 100644 Frameworks/QueryKit/Source/QueryKit-Prefix.pch create mode 100644 Frameworks/QueryKit/Source/QueryKit.h create mode 100644 Frameworks/QueryKit/Tests/QKSelectQueryTests.h create mode 100644 Frameworks/QueryKit/Tests/QKSelectQueryTests.m delete mode 100644 Resources/Plists/QueryKit-Info.plist delete mode 100644 UnitTests/QKSelectQueryTests.h delete mode 100644 UnitTests/QKSelectQueryTests.m diff --git a/Frameworks/QueryKit/QKQuery.h b/Frameworks/QueryKit/QKQuery.h deleted file mode 100644 index b3670808..00000000 --- a/Frameworks/QueryKit/QKQuery.h +++ /dev/null @@ -1,110 +0,0 @@ -// -// $Id$ -// -// QKQuery.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -#import "QKQueryTypes.h" -#import "QKQueryOperators.h" -#import "QKQueryParameter.h" - -/** - * @class QKQuery QKQuery.h - * - * @author Stuart Connolly http://stuconnolly.com/ - * - * Main QueryKit query class. - */ -@interface QKQuery : NSObject -{ - NSString *_database; - NSString *_table; - - NSMutableString *_query; - NSMutableArray *_parameters; - NSMutableArray *_fields; - NSMutableArray *_groupByFields; - NSMutableArray *_orderByFields; - - QKQueryType _queryType; - - BOOL _quoteFields; - BOOL _orderDescending; -} - -/** - * @property _database The database the query is to be run against (optional). - */ -@property (readwrite, retain, getter=database, setter=setDatabase:) NSString *_database; - -/** - * @property _table The table the query is to be run against. - */ -@property (readwrite, retain, getter=table, setter=setTable:) NSString *_table; - -/** - * @property _parameters The parameters (constraints) of the query. - */ -@property (readwrite, retain, getter=parameters, setter=setParameters:) NSMutableArray *_parameters; - -/** - * @property _fields The fields of the query. - */ -@property (readwrite, retain, getter=fields, setter=setFields:) NSMutableArray *_fields; - -/** - * @property _queryType The type of query to be built. - */ -@property (readwrite, assign, getter=queryType, setter=setQueryType:) QKQueryType _queryType; - -/** - * @property _quoteFields Indicates whether or not the query's fields should be quoted. - */ -@property (readwrite, assign, getter=quoteFields, setter=setQuoteFields:) BOOL _quoteFields; - -+ (QKQuery *)queryTable:(NSString *)table; -+ (QKQuery *)selectQueryFromTable:(NSString *)table; - -- (id)initWithTable:(NSString *)table; - -- (NSString *)query; - -- (void)addField:(NSString *)field; -- (void)addFields:(NSArray *)fields; - -- (void)addParameter:(QKQueryParameter *)parameter; -- (void)addParameter:(NSString *)field operator:(QKQueryOperator)operator value:(id)value; - -- (void)groupByField:(NSString *)field; -- (void)groupByFields:(NSArray *)fields; - -- (void)orderByField:(NSString *)field descending:(BOOL)descending; -- (void)orderByFields:(NSArray *)fields descending:(BOOL)descending; - -@end diff --git a/Frameworks/QueryKit/QKQuery.m b/Frameworks/QueryKit/QKQuery.m deleted file mode 100644 index 31755b6d..00000000 --- a/Frameworks/QueryKit/QKQuery.m +++ /dev/null @@ -1,438 +0,0 @@ -// -// $Id$ -// -// QKQuery.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -#import "QKQuery.h" - -static NSString *QKNoQueryTypeException = @"QKNoQueryType"; -static NSString *QKNoQueryTableException = @"QKNoQueryTable"; - -@interface QKQuery () - -- (void)_validateRequiements; - -- (NSString *)_buildQuery; -- (NSString *)_buildFieldList; -- (NSString *)_buildConstraints; -- (NSString *)_buildGroupByClause; -- (NSString *)_buildOrderByClause; - -- (BOOL)_addString:(NSString *)string toArray:(NSMutableArray *)array; - -@end - -@implementation QKQuery - -@synthesize _database; -@synthesize _table; -@synthesize _parameters; -@synthesize _queryType; -@synthesize _fields; -@synthesize _quoteFields; - -#pragma mark - -#pragma mark Initialization - -+ (QKQuery *)queryTable:(NSString *)table -{ - return [[[QKQuery alloc] initWithTable:table] autorelease]; -} - -+ (QKQuery *)selectQueryFromTable:(NSString *)table -{ - QKQuery *query = [[[QKQuery alloc] initWithTable:table] autorelease]; - - [query setQueryType:QKSelectQuery]; - - return query; -} - -- (id)initWithTable:(NSString *)table -{ - if ((self = [super init])) { - [self setTable:table]; - [self setFields:[[NSMutableArray alloc] init]]; - [self setParameters:[[NSMutableArray alloc] init]]; - [self setQueryType:-1]; - [self setQuoteFields:NO]; - - _orderDescending = NO; - - _groupByFields = [[NSMutableArray alloc] init]; - _orderByFields = [[NSMutableArray alloc] init]; - - _query = [[NSMutableString alloc] init]; - } - - return self; -} - -#pragma mark - -#pragma mark Public API - -- (NSString *)query -{ - return _query ? [self _buildQuery] : @""; -} - -#pragma mark - -#pragma mark Fields - -/** - * Shortcut for adding a new field to this query. - */ -- (void)addField:(NSString *)field -{ - [self _addString:field toArray:_fields]; -} - -/** - * Convenience method for adding more than one field. - * - * @param The array (of strings) of fields to add. - */ -- (void)addFields:(NSArray *)fields -{ - for (NSString *field in fields) - { - [self addField:field]; - } -} - -#pragma mark - -#pragma mark Parameters - -/** - * Adds the supplied parameter. - * - * @param parameter The parameter to add. - */ -- (void)addParameter:(QKQueryParameter *)parameter -{ - if ([parameter field] && ([[parameter field] length] > 0) && ((NSInteger)[parameter operator] > -1) && [parameter value]) { - [_parameters addObject:parameter]; - } -} - -/** - * Convenience method for adding a new parameter. - */ -- (void)addParameter:(NSString *)field operator:(QKQueryOperator)operator value:(id)value -{ - [self addParameter:[QKQueryParameter queryParamWithField:field operator:operator value:value]]; -} - -#pragma mark - -#pragma mark Grouping - -/** - * Adds the supplied field to the query's GROUP BY clause. - */ -- (void)groupByField:(NSString *)field -{ - [self _addString:field toArray:_groupByFields]; -} - -/** - * Convenience method for adding more than one field to the query's GROUP BY clause. - */ -- (void)groupByFields:(NSArray *)fields -{ - for (NSString *field in fields) - { - [self groupByField:field]; - } -} - -#pragma mark - -#pragma mark Ordering - -/** - * Adds the supplied field to the query's ORDER BY clause. - */ -- (void)orderByField:(NSString *)field descending:(BOOL)descending -{ - _orderDescending = descending; - - [self _addString:field toArray:_orderByFields]; -} - -/** - * Convenience method for adding more than one field to the query's ORDER BY clause. - */ -- (void)orderByFields:(NSArray *)fields descending:(BOOL)descending -{ - for (NSString *field in fields) - { - [self orderByField:field descending:descending]; - } -} - -#pragma mark - -#pragma mark Private API - -/** - * Validates that everything necessary to build the query has been set. - */ -- (void)_validateRequiements -{ - if (_queryType == -1) { - [NSException raise:QKNoQueryTypeException format:@"Attempt to build query with no query type specified."]; - } - - if (!_table || [_table length] == 0) { - [NSException raise:QKNoQueryTableException format:@"Attempt to build query with no query table specified."]; - } -} - -/** - * Builds the actual query. - */ -- (NSString *)_buildQuery -{ - [self _validateRequiements]; - - BOOL isSelect = (_queryType == QKSelectQuery); - BOOL isInsert = (_queryType == QKInsertQuery); - BOOL isUpdate = (_queryType == QKUpdateQuery); - BOOL isDelete = (_queryType == QKDeleteQuery); - - NSString *fields = [self _buildFieldList]; - - if (isSelect) { - [_query appendFormat:@"SELECT %@ FROM ", fields]; - } - else if (isInsert) { - [_query appendString:@"INSERT INTO "]; - } - else if (isUpdate) { - [_query appendString:@"UPDATE "]; - } - else if (isDelete) { - [_query appendString:@"DELETE FROM "]; - } - - if (_database && [_database length] > 0) { - [_query appendFormat:@"%@.", _database]; - } - - [_query appendString:_table]; - - if ([_parameters count] > 0) { - [_query appendString:@" WHERE "]; - [_query appendString:[self _buildConstraints]]; - } - - if (isSelect) { - NSString *groupBy = [self _buildGroupByClause]; - NSString *orderBy = [self _buildOrderByClause]; - - if ([groupBy length] > 0) { - [_query appendFormat:@" %@", groupBy]; - } - - if ([orderBy length] > 0) { - [_query appendFormat:@" %@", orderBy]; - } - } - - return _query; -} - -/** - * Builds the string representation of the query's field list. - */ -- (NSString *)_buildFieldList -{ - NSMutableString *fields = [NSMutableString string]; - - if ([_fields count] == 0) { - [fields appendString:@"*"]; - - return fields; - } - - for (NSString *field in _fields) - { - field = [field stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - - if ([field length] == 0) continue; - - if (_quoteFields) { - [fields appendString:@"`"]; - } - - [fields appendString:field]; - - if (_quoteFields) { - [fields appendString:@"`"]; - } - - [fields appendString:@", "]; - } - - if ([fields hasSuffix:@", "]) { - [fields setString:[fields substringToIndex:([fields length] - 2)]]; - } - - return fields; -} - -/** - * Builds the string representation of the query's constraints. - */ -- (NSString *)_buildConstraints -{ - NSMutableString *constraints = [NSMutableString string]; - - if ([_parameters count] == 0) return constraints; - - for (QKQueryParameter *param in _parameters) - { - [constraints appendFormat:@"%@ ", param]; - - [constraints appendString:@" AND "]; - } - - if ([constraints hasSuffix:@" AND "]) { - [constraints setString:[constraints substringToIndex:([constraints length] - 5)]]; - } - - return constraints; -} - -/** - * Builds the string representation of the query's GROUP BY clause. - * - * @return The GROUP BY clause - */ -- (NSString *)_buildGroupByClause -{ - NSMutableString *groupBy = [NSMutableString string]; - - if ([_groupByFields count] == 0) return groupBy; - - [groupBy appendString:@"GROUP BY "]; - - for (NSString *field in _groupByFields) - { - [groupBy appendString:field]; - [groupBy appendString:@", "]; - } - - if ([groupBy hasSuffix:@", "]) { - [groupBy setString:[groupBy substringToIndex:([groupBy length] - 2)]]; - } - - return groupBy; -} - -/** - * Builds the string representation of the query's ORDER BY clause. - * - * @return The ORDER BY clause - */ -- (NSString *)_buildOrderByClause -{ - NSMutableString *orderBy = [NSMutableString string]; - - if ([_orderByFields count] == 0) return orderBy; - - [orderBy appendString:@"ORDER BY "]; - - for (NSString *field in _orderByFields) - { - [orderBy appendString:field]; - [orderBy appendString:@", "]; - } - - if ([orderBy hasSuffix:@", "]) { - [orderBy setString:[orderBy substringToIndex:([orderBy length] - 2)]]; - } - - if (_orderDescending) { - [orderBy appendString:@" DESC"]; - } - - return orderBy; -} - -/** - * Adds the supplied string to the supplied array, but only if the length is greater than zero. - * - * @param string The string to add to the array - * @param array The array to add the string to - * - * @return A BOOL indicating whether or not the string was added. - */ -- (BOOL)_addString:(NSString *)string toArray:(NSMutableArray *)array -{ - BOOL result = NO; - - if (!string || !array) return result; - - string = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - - if ([string length] > 0) { - [array addObject:string]; - - result = YES; - } - - return result; -} - -#pragma mark - - -/** - * Same as calling -query. - */ -- (NSString *)description -{ - return [self query]; -} - -#pragma mark - - -- (void)dealloc -{ - if (_table) [_table release], _table = nil; - if (_database) [_database release], _database = nil; - if (_query) [_query release], _query = nil; - if (_parameters) [_parameters release], _parameters = nil; - if (_fields) [_fields release], _fields = nil; - if (_groupByFields) [_groupByFields release], _groupByFields = nil; - if (_orderByFields) [_orderByFields release], _orderByFields = nil; - - [super dealloc]; -} - -@end diff --git a/Frameworks/QueryKit/QKQueryOperators.h b/Frameworks/QueryKit/QKQueryOperators.h deleted file mode 100644 index 247496fd..00000000 --- a/Frameworks/QueryKit/QKQueryOperators.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// $Id$ -// -// QKQueryOperators.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -/** - * @enum QKQueryOperator - * - * Used to specify the operator to use for a specific query parameter. - * - * Note that this is by no means a complete list of available operators, only the most commonly used ones. - * Other operators can be added as and when they are required. - */ -typedef enum -{ - QKEqualityOperator, - QKNotEqualOperator, - QKLikeOperator, - QKNotLikeOperator, - QKInOperator, - QKNotInOperator, - QKIsNullOperator, - QKIsNotNullOperator, - QKGreaterThanOperator, - QKLessThanOperator, - QKGreaterThanOrEqualOperator, - QKLessThanOrEqualOperator -} -QKQueryOperator; diff --git a/Frameworks/QueryKit/QKQueryParameter.h b/Frameworks/QueryKit/QKQueryParameter.h deleted file mode 100644 index 3a24eb8d..00000000 --- a/Frameworks/QueryKit/QKQueryParameter.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// $Id$ -// -// QKQueryParameter.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -#import "QKQueryOperators.h" - -/** - * @class QKQueryParameter QKQueryParameter.h - * - * @author Stuart Connolly http://stuconnolly.com/ - * - * QueryKit query parameter class. - */ -@interface QKQueryParameter : NSObject -{ - NSString *_field; - - QKQueryOperator _operator; - - id _value; -} - -/** - * @property _field The field component of the parameter. - */ -@property (readwrite, retain, getter=field, setter=setField:) NSString *_field; - -/** - * @property _operator The operator component of the parameter. - */ -@property (readwrite, assign, getter=operator, setter=setOperator:) QKQueryOperator _operator; - -/** - *@property _value The value component of the parameter. - */ -@property (readwrite, retain, getter=value, setter=setValue:) id _value; - -+ (QKQueryParameter *)queryParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value; - -- (id)initParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value; - -@end diff --git a/Frameworks/QueryKit/QKQueryParameter.m b/Frameworks/QueryKit/QKQueryParameter.m deleted file mode 100644 index bc9efa2f..00000000 --- a/Frameworks/QueryKit/QKQueryParameter.m +++ /dev/null @@ -1,86 +0,0 @@ -// -// $Id$ -// -// QKQueryParameter.m -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -#import "QKQueryParameter.h" -#import "QKQueryUtilities.h" - -@implementation QKQueryParameter - -@synthesize _field; -@synthesize _operator; -@synthesize _value; - -#pragma mark - -#pragma mark Initialisation - -+ (QKQueryParameter *)queryParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value -{ - return [[[QKQueryParameter alloc] initParamWithField:field operator:op value:value] autorelease]; -} - -- (id)initParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value -{ - if ((self = [super init])) { - [self setField:field]; - [self setOperator:op]; - [self setValue:value]; - } - - return self; -} - -#pragma mark - - -- (NSString *)description -{ - NSMutableString *string = [NSMutableString string]; - - NSString *field = [_field stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - - [string appendString:field]; - [string appendFormat:@" %@ ", [QKQueryUtilities operatorRepresentationForType:_operator]]; - [string appendFormat:(![_value isKindOfClass:[NSNumber class]]) ? @"'%@'" : @"%@", [_value description]]; - - return string; -} - -#pragma mark - - -- (void)dealloc -{ - if (_field) [_field release], _field = nil; - if (_value) [_value release], _value = nil; - - [super dealloc]; -} - -@end diff --git a/Frameworks/QueryKit/QKQueryTypes.h b/Frameworks/QueryKit/QKQueryTypes.h deleted file mode 100644 index 1e9e7403..00000000 --- a/Frameworks/QueryKit/QKQueryTypes.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// $Id$ -// -// QKQueryTypes.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -/** - * @enum QKQueryType - * - * Used to specify the type of query to be constructed. - */ -typedef enum -{ - QKSelectQuery, - QKUpdateQuery, - QKInsertQuery, - QKDeleteQuery, -} -QKQueryType; diff --git a/Frameworks/QueryKit/QKQueryUtilities.h b/Frameworks/QueryKit/QKQueryUtilities.h deleted file mode 100644 index 352c5533..00000000 --- a/Frameworks/QueryKit/QKQueryUtilities.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// -// QKQueryUtilities.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -#import "QKQueryOperators.h" - -/** - * @class QKQueryUtilities QKQueryUtilities.h - * - * @author Stuart Connolly http://stuconnolly.com/ - * - * QueryKit utilities class. - */ -@interface QKQueryUtilities : NSObject - -+ (NSString *)operatorRepresentationForType:(QKQueryOperator)operator; - -@end diff --git a/Frameworks/QueryKit/QKQueryUtilities.m b/Frameworks/QueryKit/QKQueryUtilities.m deleted file mode 100644 index 5e4eb4ab..00000000 --- a/Frameworks/QueryKit/QKQueryUtilities.m +++ /dev/null @@ -1,96 +0,0 @@ -// -// $Id$ -// -// QKQueryUtilities.m -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -#import "QKQueryUtilities.h" - -static NSString *QKUnrecognisedQueryOperatorException = @"QKUnrecognisedQueryOperator"; - -@implementation QKQueryUtilities - -/** - * Returns a string representation of the supplied operator type. - * - * @param operator The operator - * - * @return A string represenation of the operator. - */ -+ (NSString *)operatorRepresentationForType:(QKQueryOperator)operator -{ - NSString *opString = nil; - - switch (operator) - { - case QKEqualityOperator: - opString = @"="; - break; - case QKNotEqualOperator: - opString = @"!="; - break; - case QKLikeOperator: - opString = @"LIKE"; - break; - case QKNotLikeOperator: - opString = @"NOT LIKE"; - break; - case QKInOperator: - opString = @"IN"; - break; - case QKNotInOperator: - opString = @"NOT IN"; - break; - case QKIsNullOperator: - opString = @"IS NULL"; - break; - case QKIsNotNullOperator: - opString = @"IS NOT NULL"; - break; - case QKGreaterThanOperator: - opString = @">"; - break; - case QKLessThanOperator: - opString = @"<"; - break; - case QKGreaterThanOrEqualOperator: - opString = @">="; - break; - case QKLessThanOrEqualOperator: - opString = @"<="; - break; - default: - [NSException raise:QKUnrecognisedQueryOperatorException format:@"Unrecognised query operator type: %d", operator]; - break; - } - - return opString; -} - -@end diff --git a/Frameworks/QueryKit/QueryKit.h b/Frameworks/QueryKit/QueryKit.h deleted file mode 100644 index 04c072de..00000000 --- a/Frameworks/QueryKit/QueryKit.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// $Id$ -// -// QueryKit.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at - -#import -#import -#import -#import -#import diff --git a/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj b/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj new file mode 100644 index 00000000..cd1fffae --- /dev/null +++ b/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj @@ -0,0 +1,593 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 17E5951F14F301DF0054EE08 /* QKQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E5951614F301DF0054EE08 /* QKQuery.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 17E5952014F301DF0054EE08 /* QKQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E5951714F301DF0054EE08 /* QKQuery.m */; }; + 17E5952114F301DF0054EE08 /* QKQueryOperators.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E5951814F301DF0054EE08 /* QKQueryOperators.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 17E5952214F301DF0054EE08 /* QKQueryParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E5951914F301DF0054EE08 /* QKQueryParameter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 17E5952314F301DF0054EE08 /* QKQueryParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E5951A14F301DF0054EE08 /* QKQueryParameter.m */; }; + 17E5952414F301DF0054EE08 /* QKQueryTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E5951B14F301DF0054EE08 /* QKQueryTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 17E5952514F301DF0054EE08 /* QKQueryUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E5951C14F301DF0054EE08 /* QKQueryUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 17E5952614F301DF0054EE08 /* QKQueryUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E5951D14F301DF0054EE08 /* QKQueryUtilities.m */; }; + 17E5952714F301DF0054EE08 /* QueryKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E5951E14F301DF0054EE08 /* QueryKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 17E595F214F3058F0054EE08 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17E595F114F3058F0054EE08 /* Foundation.framework */; }; + 17E596A814F308160054EE08 /* QKSelectQueryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E5969814F307B70054EE08 /* QKSelectQueryTests.m */; }; + 17E596A914F308250054EE08 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17E595F114F3058F0054EE08 /* Foundation.framework */; }; + 17F620BE14F961C1003E7290 /* QueryKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* QueryKit.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 17E596BE14F916B40054EE08 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = QueryKit; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 17E5951614F301DF0054EE08 /* QKQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQuery.h; sourceTree = ""; }; + 17E5951714F301DF0054EE08 /* QKQuery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKQuery.m; sourceTree = ""; }; + 17E5951814F301DF0054EE08 /* QKQueryOperators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryOperators.h; sourceTree = ""; }; + 17E5951914F301DF0054EE08 /* QKQueryParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryParameter.h; sourceTree = ""; }; + 17E5951A14F301DF0054EE08 /* QKQueryParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKQueryParameter.m; sourceTree = ""; }; + 17E5951B14F301DF0054EE08 /* QKQueryTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryTypes.h; sourceTree = ""; }; + 17E5951C14F301DF0054EE08 /* QKQueryUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryUtilities.h; sourceTree = ""; }; + 17E5951D14F301DF0054EE08 /* QKQueryUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKQueryUtilities.m; sourceTree = ""; }; + 17E5951E14F301DF0054EE08 /* QueryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QueryKit.h; sourceTree = ""; }; + 17E595F114F3058F0054EE08 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 17E5969714F307B70054EE08 /* QKSelectQueryTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKSelectQueryTests.h; sourceTree = ""; }; + 17E5969814F307B70054EE08 /* QKSelectQueryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKSelectQueryTests.m; sourceTree = ""; }; + 17E5969E14F307CE0054EE08 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + 17E5969F14F307CE0054EE08 /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Tests-Info.plist"; path = "Resources/Tests-Info.plist"; sourceTree = ""; }; + 32DBCF5E0370ADEE00C91783 /* QueryKit-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "QueryKit-Prefix.pch"; path = "Source/QueryKit-Prefix.pch"; sourceTree = ""; }; + 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = ""; }; + 8DC2EF5B0486A6940098B216 /* QueryKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = QueryKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 17E5969B14F307CE0054EE08 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 17E596A914F308250054EE08 /* Foundation.framework in Frameworks */, + 17F620BE14F961C1003E7290 /* QueryKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DC2EF560486A6940098B216 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 17E595F214F3058F0054EE08 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + 8DC2EF5B0486A6940098B216 /* QueryKit.framework */, + 17E5969E14F307CE0054EE08 /* Tests.octest */, + ); + name = Products; + sourceTree = ""; + }; + 0867D691FE84028FC02AAC07 /* QueryKit */ = { + isa = PBXGroup; + children = ( + 32DBCF5E0370ADEE00C91783 /* QueryKit-Prefix.pch */, + 08FB77AEFE84172EC02AAC07 /* Source */, + 17E5969614F3079E0054EE08 /* Tests */, + 089C1665FE841158C02AAC07 /* Resources */, + 0867D69AFE84028FC02AAC07 /* Frameworks */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = QueryKit; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 17E595F114F3058F0054EE08 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 8DC2EF5A0486A6940098B216 /* Info.plist */, + 17E5969F14F307CE0054EE08 /* Tests-Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AEFE84172EC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 17E5951E14F301DF0054EE08 /* QueryKit.h */, + 17E5951614F301DF0054EE08 /* QKQuery.h */, + 17E5951714F301DF0054EE08 /* QKQuery.m */, + 17E5951914F301DF0054EE08 /* QKQueryParameter.h */, + 17E5951A14F301DF0054EE08 /* QKQueryParameter.m */, + 17E5951C14F301DF0054EE08 /* QKQueryUtilities.h */, + 17E5951D14F301DF0054EE08 /* QKQueryUtilities.m */, + 17E5952814F301F40054EE08 /* Constants */, + ); + path = Source; + sourceTree = ""; + }; + 17E5952814F301F40054EE08 /* Constants */ = { + isa = PBXGroup; + children = ( + 17E5951B14F301DF0054EE08 /* QKQueryTypes.h */, + 17E5951814F301DF0054EE08 /* QKQueryOperators.h */, + ); + name = Constants; + sourceTree = ""; + }; + 17E5969614F3079E0054EE08 /* Tests */ = { + isa = PBXGroup; + children = ( + 17E5969714F307B70054EE08 /* QKSelectQueryTests.h */, + 17E5969814F307B70054EE08 /* QKSelectQueryTests.m */, + ); + path = Tests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8DC2EF500486A6940098B216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 17E5951F14F301DF0054EE08 /* QKQuery.h in Headers */, + 17E5952114F301DF0054EE08 /* QKQueryOperators.h in Headers */, + 17E5952214F301DF0054EE08 /* QKQueryParameter.h in Headers */, + 17E5952414F301DF0054EE08 /* QKQueryTypes.h in Headers */, + 17E5952514F301DF0054EE08 /* QKQueryUtilities.h in Headers */, + 17E5952714F301DF0054EE08 /* QueryKit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 17E5969D14F307CE0054EE08 /* Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 17E596A614F307CE0054EE08 /* Build configuration list for PBXNativeTarget "Tests" */; + buildPhases = ( + 17E5969914F307CE0054EE08 /* Resources */, + 17E5969A14F307CE0054EE08 /* Sources */, + 17E5969B14F307CE0054EE08 /* Frameworks */, + 17E5969C14F307CE0054EE08 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 17E596BF14F916B40054EE08 /* PBXTargetDependency */, + ); + name = Tests; + productName = Tests; + productReference = 17E5969E14F307CE0054EE08 /* Tests.octest */; + productType = "com.apple.product-type.bundle"; + }; + 8DC2EF4F0486A6940098B216 /* QueryKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "QueryKit" */; + buildPhases = ( + 8DC2EF500486A6940098B216 /* Headers */, + 8DC2EF520486A6940098B216 /* Resources */, + 8DC2EF540486A6940098B216 /* Sources */, + 8DC2EF560486A6940098B216 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = QueryKit; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = QueryKit; + productReference = 8DC2EF5B0486A6940098B216 /* QueryKit.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "QueryKit" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 0867D691FE84028FC02AAC07 /* QueryKit */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DC2EF4F0486A6940098B216 /* QueryKit */, + 17E5969D14F307CE0054EE08 /* Tests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 17E5969914F307CE0054EE08 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DC2EF520486A6940098B216 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 17E5969C14F307CE0054EE08 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 17E5969A14F307CE0054EE08 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 17E596A814F308160054EE08 /* QKSelectQueryTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DC2EF540486A6940098B216 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 17E5952014F301DF0054EE08 /* QKQuery.m in Sources */, + 17E5952314F301DF0054EE08 /* QKQueryParameter.m in Sources */, + 17E5952614F301DF0054EE08 /* QKQueryUtilities.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 17E596BF14F916B40054EE08 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* QueryKit */; + targetProxy = 17E596BE14F916B40054EE08 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 17E5952D14F302740054EE08 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Source/QueryKit-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Resources/Info.plist; + INFOPLIST_PREFIX_HEADER = ""; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = Distribution; + }; + 17E5952E14F302740054EE08 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Source/QueryKit-Prefix.pch"; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PROTOTYPE_CONVERSION = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_VALUE = YES; + INFOPLIST_FILE = Resources/Info.plist; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + PRODUCT_NAME = QueryKit; + WRAPPER_EXTENSION = framework; + }; + name = Distribution; + }; + 17E596A314F307CE0054EE08 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + INFOPLIST_FILE = "Resources/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + OTHER_LDFLAGS = ( + "-framework", + Cocoa, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + WRAPPER_EXTENSION = octest; + }; + name = Debug; + }; + 17E596A414F307CE0054EE08 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + INFOPLIST_FILE = "Resources/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + OTHER_LDFLAGS = ( + "-framework", + Cocoa, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + WRAPPER_EXTENSION = octest; + ZERO_LINK = NO; + }; + name = Release; + }; + 17E596A514F307CE0054EE08 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + INFOPLIST_FILE = "Resources/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + OTHER_LDFLAGS = ( + "-framework", + Cocoa, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + WRAPPER_EXTENSION = octest; + }; + name = Distribution; + }; + 1DEB91AE08733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Source/QueryKit-Prefix.pch"; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PROTOTYPE_CONVERSION = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_VALUE = YES; + GENERATE_PKGINFO_FILE = YES; + INFOPLIST_FILE = Resources/Info.plist; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + PRODUCT_NAME = QueryKit; + WARNING_CFLAGS = "-Wmost"; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + 1DEB91AF08733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = ( + i386, + x86_64, + ppc, + ); + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Source/QueryKit-Prefix.pch"; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PROTOTYPE_CONVERSION = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_VALUE = YES; + INFOPLIST_FILE = Resources/Info.plist; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + PRODUCT_NAME = QueryKit; + SDKROOT = macosx10.5; + VALID_ARCHS = "ppc i386 x86_64"; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + 1DEB91B208733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Source/QueryKit-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Resources/Info.plist; + INFOPLIST_PREFIX_HEADER = ""; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = Debug; + }; + 1DEB91B308733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Source/QueryKit-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Resources/Info.plist; + INFOPLIST_PREFIX_HEADER = ""; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 17E596A614F307CE0054EE08 /* Build configuration list for PBXNativeTarget "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 17E596A314F307CE0054EE08 /* Debug */, + 17E596A414F307CE0054EE08 /* Release */, + 17E596A514F307CE0054EE08 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "QueryKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91AE08733DA50010E9CD /* Debug */, + 1DEB91AF08733DA50010E9CD /* Release */, + 17E5952E14F302740054EE08 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "QueryKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91B208733DA50010E9CD /* Debug */, + 1DEB91B308733DA50010E9CD /* Release */, + 17E5952D14F302740054EE08 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/Frameworks/QueryKit/Resources/Info.plist b/Frameworks/QueryKit/Resources/Info.plist new file mode 100644 index 00000000..b76ed0eb --- /dev/null +++ b/Frameworks/QueryKit/Resources/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + QueryKit + CFBundleIdentifier + com.google.code.sequel-pro.querykit + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Frameworks/QueryKit/Resources/Tests-Info.plist b/Frameworks/QueryKit/Resources/Tests-Info.plist new file mode 100644 index 00000000..607c2ef5 --- /dev/null +++ b/Frameworks/QueryKit/Resources/Tests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Tests + CFBundleIdentifier + com.google.code.sequel-pro.querykit.tests + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Frameworks/QueryKit/Source/QKQuery.h b/Frameworks/QueryKit/Source/QKQuery.h new file mode 100644 index 00000000..b45dc556 --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQuery.h @@ -0,0 +1,110 @@ +// +// $Id: QKQuery.h 3421 2011-09-10 22:58:45Z stuart02 $ +// +// QKQuery.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +#import "QKQueryTypes.h" +#import "QKQueryOperators.h" +#import "QKQueryParameter.h" + +/** + * @class QKQuery QKQuery.h + * + * @author Stuart Connolly http://stuconnolly.com/ + * + * Main QueryKit query class. + */ +@interface QKQuery : NSObject +{ + NSString *_database; + NSString *_table; + + NSMutableString *_query; + NSMutableArray *_parameters; + NSMutableArray *_fields; + NSMutableArray *_groupByFields; + NSMutableArray *_orderByFields; + + QKQueryType _queryType; + + BOOL _quoteFields; + BOOL _orderDescending; +} + +/** + * @property _database The database the query is to be run against (optional). + */ +@property (readwrite, retain, getter=database, setter=setDatabase:) NSString *_database; + +/** + * @property _table The table the query is to be run against. + */ +@property (readwrite, retain, getter=table, setter=setTable:) NSString *_table; + +/** + * @property _parameters The parameters (constraints) of the query. + */ +@property (readwrite, retain, getter=parameters, setter=setParameters:) NSMutableArray *_parameters; + +/** + * @property _fields The fields of the query. + */ +@property (readwrite, retain, getter=fields, setter=setFields:) NSMutableArray *_fields; + +/** + * @property _queryType The type of query to be built. + */ +@property (readwrite, assign, getter=queryType, setter=setQueryType:) QKQueryType _queryType; + +/** + * @property _quoteFields Indicates whether or not the query's fields should be quoted. + */ +@property (readwrite, assign, getter=quoteFields, setter=setQuoteFields:) BOOL _quoteFields; + ++ (QKQuery *)queryTable:(NSString *)table; ++ (QKQuery *)selectQueryFromTable:(NSString *)table; + +- (id)initWithTable:(NSString *)table; + +- (NSString *)query; + +- (void)addField:(NSString *)field; +- (void)addFields:(NSArray *)fields; + +- (void)addParameter:(QKQueryParameter *)parameter; +- (void)addParameter:(NSString *)field operator:(QKQueryOperator)operator value:(id)value; + +- (void)groupByField:(NSString *)field; +- (void)groupByFields:(NSArray *)fields; + +- (void)orderByField:(NSString *)field descending:(BOOL)descending; +- (void)orderByFields:(NSArray *)fields descending:(BOOL)descending; + +@end diff --git a/Frameworks/QueryKit/Source/QKQuery.m b/Frameworks/QueryKit/Source/QKQuery.m new file mode 100644 index 00000000..ded198ba --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQuery.m @@ -0,0 +1,438 @@ +// +// $Id: QKQuery.m 3432 2011-09-27 00:21:35Z stuart02 $ +// +// QKQuery.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +#import "QKQuery.h" + +static NSString *QKNoQueryTypeException = @"QKNoQueryType"; +static NSString *QKNoQueryTableException = @"QKNoQueryTable"; + +@interface QKQuery () + +- (void)_validateRequiements; + +- (NSString *)_buildQuery; +- (NSString *)_buildFieldList; +- (NSString *)_buildConstraints; +- (NSString *)_buildGroupByClause; +- (NSString *)_buildOrderByClause; + +- (BOOL)_addString:(NSString *)string toArray:(NSMutableArray *)array; + +@end + +@implementation QKQuery + +@synthesize _database; +@synthesize _table; +@synthesize _parameters; +@synthesize _queryType; +@synthesize _fields; +@synthesize _quoteFields; + +#pragma mark - +#pragma mark Initialization + ++ (QKQuery *)queryTable:(NSString *)table +{ + return [[[QKQuery alloc] initWithTable:table] autorelease]; +} + ++ (QKQuery *)selectQueryFromTable:(NSString *)table +{ + QKQuery *query = [[[QKQuery alloc] initWithTable:table] autorelease]; + + [query setQueryType:QKSelectQuery]; + + return query; +} + +- (id)initWithTable:(NSString *)table +{ + if ((self = [super init])) { + [self setTable:table]; + [self setFields:[[NSMutableArray alloc] init]]; + [self setParameters:[[NSMutableArray alloc] init]]; + [self setQueryType:(QKQueryType)-1]; + [self setQuoteFields:NO]; + + _orderDescending = NO; + + _groupByFields = [[NSMutableArray alloc] init]; + _orderByFields = [[NSMutableArray alloc] init]; + + _query = [[NSMutableString alloc] init]; + } + + return self; +} + +#pragma mark - +#pragma mark Public API + +- (NSString *)query +{ + return _query ? [self _buildQuery] : @""; +} + +#pragma mark - +#pragma mark Fields + +/** + * Shortcut for adding a new field to this query. + */ +- (void)addField:(NSString *)field +{ + [self _addString:field toArray:_fields]; +} + +/** + * Convenience method for adding more than one field. + * + * @param The array (of strings) of fields to add. + */ +- (void)addFields:(NSArray *)fields +{ + for (NSString *field in fields) + { + [self addField:field]; + } +} + +#pragma mark - +#pragma mark Parameters + +/** + * Adds the supplied parameter. + * + * @param parameter The parameter to add. + */ +- (void)addParameter:(QKQueryParameter *)parameter +{ + if ([parameter field] && ([[parameter field] length] > 0) && ((NSInteger)[parameter operator] > -1) && [parameter value]) { + [_parameters addObject:parameter]; + } +} + +/** + * Convenience method for adding a new parameter. + */ +- (void)addParameter:(NSString *)field operator:(QKQueryOperator)operator value:(id)value +{ + [self addParameter:[QKQueryParameter queryParamWithField:field operator:operator value:value]]; +} + +#pragma mark - +#pragma mark Grouping + +/** + * Adds the supplied field to the query's GROUP BY clause. + */ +- (void)groupByField:(NSString *)field +{ + [self _addString:field toArray:_groupByFields]; +} + +/** + * Convenience method for adding more than one field to the query's GROUP BY clause. + */ +- (void)groupByFields:(NSArray *)fields +{ + for (NSString *field in fields) + { + [self groupByField:field]; + } +} + +#pragma mark - +#pragma mark Ordering + +/** + * Adds the supplied field to the query's ORDER BY clause. + */ +- (void)orderByField:(NSString *)field descending:(BOOL)descending +{ + _orderDescending = descending; + + [self _addString:field toArray:_orderByFields]; +} + +/** + * Convenience method for adding more than one field to the query's ORDER BY clause. + */ +- (void)orderByFields:(NSArray *)fields descending:(BOOL)descending +{ + for (NSString *field in fields) + { + [self orderByField:field descending:descending]; + } +} + +#pragma mark - +#pragma mark Private API + +/** + * Validates that everything necessary to build the query has been set. + */ +- (void)_validateRequiements +{ + if (_queryType == -1) { + [NSException raise:QKNoQueryTypeException format:@"Attempt to build query with no query type specified."]; + } + + if (!_table || [_table length] == 0) { + [NSException raise:QKNoQueryTableException format:@"Attempt to build query with no query table specified."]; + } +} + +/** + * Builds the actual query. + */ +- (NSString *)_buildQuery +{ + [self _validateRequiements]; + + BOOL isSelect = (_queryType == QKSelectQuery); + BOOL isInsert = (_queryType == QKInsertQuery); + BOOL isUpdate = (_queryType == QKUpdateQuery); + BOOL isDelete = (_queryType == QKDeleteQuery); + + NSString *fields = [self _buildFieldList]; + + if (isSelect) { + [_query appendFormat:@"SELECT %@ FROM ", fields]; + } + else if (isInsert) { + [_query appendString:@"INSERT INTO "]; + } + else if (isUpdate) { + [_query appendString:@"UPDATE "]; + } + else if (isDelete) { + [_query appendString:@"DELETE FROM "]; + } + + if (_database && [_database length] > 0) { + [_query appendFormat:@"%@.", _database]; + } + + [_query appendString:_table]; + + if ([_parameters count] > 0) { + [_query appendString:@" WHERE "]; + [_query appendString:[self _buildConstraints]]; + } + + if (isSelect) { + NSString *groupBy = [self _buildGroupByClause]; + NSString *orderBy = [self _buildOrderByClause]; + + if ([groupBy length] > 0) { + [_query appendFormat:@" %@", groupBy]; + } + + if ([orderBy length] > 0) { + [_query appendFormat:@" %@", orderBy]; + } + } + + return _query; +} + +/** + * Builds the string representation of the query's field list. + */ +- (NSString *)_buildFieldList +{ + NSMutableString *fields = [NSMutableString string]; + + if ([_fields count] == 0) { + [fields appendString:@"*"]; + + return fields; + } + + for (NSString *field in _fields) + { + field = [field stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + + if ([field length] == 0) continue; + + if (_quoteFields) { + [fields appendString:@"`"]; + } + + [fields appendString:field]; + + if (_quoteFields) { + [fields appendString:@"`"]; + } + + [fields appendString:@", "]; + } + + if ([fields hasSuffix:@", "]) { + [fields setString:[fields substringToIndex:([fields length] - 2)]]; + } + + return fields; +} + +/** + * Builds the string representation of the query's constraints. + */ +- (NSString *)_buildConstraints +{ + NSMutableString *constraints = [NSMutableString string]; + + if ([_parameters count] == 0) return constraints; + + for (QKQueryParameter *param in _parameters) + { + [constraints appendFormat:@"%@ ", param]; + + [constraints appendString:@" AND "]; + } + + if ([constraints hasSuffix:@" AND "]) { + [constraints setString:[constraints substringToIndex:([constraints length] - 5)]]; + } + + return constraints; +} + +/** + * Builds the string representation of the query's GROUP BY clause. + * + * @return The GROUP BY clause + */ +- (NSString *)_buildGroupByClause +{ + NSMutableString *groupBy = [NSMutableString string]; + + if ([_groupByFields count] == 0) return groupBy; + + [groupBy appendString:@"GROUP BY "]; + + for (NSString *field in _groupByFields) + { + [groupBy appendString:field]; + [groupBy appendString:@", "]; + } + + if ([groupBy hasSuffix:@", "]) { + [groupBy setString:[groupBy substringToIndex:([groupBy length] - 2)]]; + } + + return groupBy; +} + +/** + * Builds the string representation of the query's ORDER BY clause. + * + * @return The ORDER BY clause + */ +- (NSString *)_buildOrderByClause +{ + NSMutableString *orderBy = [NSMutableString string]; + + if ([_orderByFields count] == 0) return orderBy; + + [orderBy appendString:@"ORDER BY "]; + + for (NSString *field in _orderByFields) + { + [orderBy appendString:field]; + [orderBy appendString:@", "]; + } + + if ([orderBy hasSuffix:@", "]) { + [orderBy setString:[orderBy substringToIndex:([orderBy length] - 2)]]; + } + + if (_orderDescending) { + [orderBy appendString:@" DESC"]; + } + + return orderBy; +} + +/** + * Adds the supplied string to the supplied array, but only if the length is greater than zero. + * + * @param string The string to add to the array + * @param array The array to add the string to + * + * @return A BOOL indicating whether or not the string was added. + */ +- (BOOL)_addString:(NSString *)string toArray:(NSMutableArray *)array +{ + BOOL result = NO; + + if (!string || !array) return result; + + string = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + + if ([string length] > 0) { + [array addObject:string]; + + result = YES; + } + + return result; +} + +#pragma mark - + +/** + * Same as calling -query. + */ +- (NSString *)description +{ + return [self query]; +} + +#pragma mark - + +- (void)dealloc +{ + if (_table) [_table release], _table = nil; + if (_database) [_database release], _database = nil; + if (_query) [_query release], _query = nil; + if (_parameters) [_parameters release], _parameters = nil; + if (_fields) [_fields release], _fields = nil; + if (_groupByFields) [_groupByFields release], _groupByFields = nil; + if (_orderByFields) [_orderByFields release], _orderByFields = nil; + + [super dealloc]; +} + +@end diff --git a/Frameworks/QueryKit/Source/QKQueryOperators.h b/Frameworks/QueryKit/Source/QKQueryOperators.h new file mode 100644 index 00000000..32e64563 --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQueryOperators.h @@ -0,0 +1,56 @@ +// +// $Id: QKQueryOperators.h 3423 2011-09-12 16:50:15Z stuart02 $ +// +// QKQueryOperators.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +/** + * @enum QKQueryOperator + * + * Used to specify the operator to use for a specific query parameter. + * + * Note that this is by no means a complete list of available operators, only the most commonly used ones. + * Other operators can be added as and when they are required. + */ +typedef enum +{ + QKEqualityOperator, + QKNotEqualOperator, + QKLikeOperator, + QKNotLikeOperator, + QKInOperator, + QKNotInOperator, + QKIsNullOperator, + QKIsNotNullOperator, + QKGreaterThanOperator, + QKLessThanOperator, + QKGreaterThanOrEqualOperator, + QKLessThanOrEqualOperator +} +QKQueryOperator; diff --git a/Frameworks/QueryKit/Source/QKQueryParameter.h b/Frameworks/QueryKit/Source/QKQueryParameter.h new file mode 100644 index 00000000..78c5739f --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQueryParameter.h @@ -0,0 +1,70 @@ +// +// $Id: QKQueryParameter.h 3421 2011-09-10 22:58:45Z stuart02 $ +// +// QKQueryParameter.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +#import "QKQueryOperators.h" + +/** + * @class QKQueryParameter QKQueryParameter.h + * + * @author Stuart Connolly http://stuconnolly.com/ + * + * QueryKit query parameter class. + */ +@interface QKQueryParameter : NSObject +{ + NSString *_field; + + QKQueryOperator _operator; + + id _value; +} + +/** + * @property _field The field component of the parameter. + */ +@property (readwrite, retain, getter=field, setter=setField:) NSString *_field; + +/** + * @property _operator The operator component of the parameter. + */ +@property (readwrite, assign, getter=operator, setter=setOperator:) QKQueryOperator _operator; + +/** + *@property _value The value component of the parameter. + */ +@property (readwrite, retain, getter=value, setter=setValue:) id _value; + ++ (QKQueryParameter *)queryParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value; + +- (id)initParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value; + +@end diff --git a/Frameworks/QueryKit/Source/QKQueryParameter.m b/Frameworks/QueryKit/Source/QKQueryParameter.m new file mode 100644 index 00000000..7f6064e6 --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQueryParameter.m @@ -0,0 +1,86 @@ +// +// $Id: QKQueryParameter.m 3432 2011-09-27 00:21:35Z stuart02 $ +// +// QKQueryParameter.m +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +#import "QKQueryParameter.h" +#import "QKQueryUtilities.h" + +@implementation QKQueryParameter + +@synthesize _field; +@synthesize _operator; +@synthesize _value; + +#pragma mark - +#pragma mark Initialisation + ++ (QKQueryParameter *)queryParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value +{ + return [[[QKQueryParameter alloc] initParamWithField:field operator:op value:value] autorelease]; +} + +- (id)initParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value +{ + if ((self = [super init])) { + [self setField:field]; + [self setOperator:op]; + [self setValue:value]; + } + + return self; +} + +#pragma mark - + +- (NSString *)description +{ + NSMutableString *string = [NSMutableString string]; + + NSString *field = [_field stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + + [string appendString:field]; + [string appendFormat:@" %@ ", [QKQueryUtilities operatorRepresentationForType:_operator]]; + [string appendFormat:(![_value isKindOfClass:[NSNumber class]]) ? @"'%@'" : @"%@", [_value description]]; + + return string; +} + +#pragma mark - + +- (void)dealloc +{ + if (_field) [_field release], _field = nil; + if (_value) [_value release], _value = nil; + + [super dealloc]; +} + +@end diff --git a/Frameworks/QueryKit/Source/QKQueryTypes.h b/Frameworks/QueryKit/Source/QKQueryTypes.h new file mode 100644 index 00000000..4ab338ec --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQueryTypes.h @@ -0,0 +1,45 @@ +// +// $Id: QKQueryTypes.h 3423 2011-09-12 16:50:15Z stuart02 $ +// +// QKQueryTypes.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +/** + * @enum QKQueryType + * + * Used to specify the type of query to be constructed. + */ +typedef enum +{ + QKSelectQuery, + QKUpdateQuery, + QKInsertQuery, + QKDeleteQuery, +} +QKQueryType; diff --git a/Frameworks/QueryKit/Source/QKQueryUtilities.h b/Frameworks/QueryKit/Source/QKQueryUtilities.h new file mode 100644 index 00000000..9049b191 --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQueryUtilities.h @@ -0,0 +1,46 @@ +// +// $Id: QKQueryUtilities.h 3421 2011-09-10 22:58:45Z stuart02 $ +// +// QKQueryUtilities.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +#import "QKQueryOperators.h" + +/** + * @class QKQueryUtilities QKQueryUtilities.h + * + * @author Stuart Connolly http://stuconnolly.com/ + * + * QueryKit utilities class. + */ +@interface QKQueryUtilities : NSObject + ++ (NSString *)operatorRepresentationForType:(QKQueryOperator)operator; + +@end diff --git a/Frameworks/QueryKit/Source/QKQueryUtilities.m b/Frameworks/QueryKit/Source/QKQueryUtilities.m new file mode 100644 index 00000000..dde1bd77 --- /dev/null +++ b/Frameworks/QueryKit/Source/QKQueryUtilities.m @@ -0,0 +1,96 @@ +// +// $Id: QKQueryUtilities.m 3421 2011-09-10 22:58:45Z stuart02 $ +// +// QKQueryUtilities.m +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +#import "QKQueryUtilities.h" + +static NSString *QKUnrecognisedQueryOperatorException = @"QKUnrecognisedQueryOperator"; + +@implementation QKQueryUtilities + +/** + * Returns a string representation of the supplied operator type. + * + * @param operator The operator + * + * @return A string represenation of the operator. + */ ++ (NSString *)operatorRepresentationForType:(QKQueryOperator)operator +{ + NSString *opString = nil; + + switch (operator) + { + case QKEqualityOperator: + opString = @"="; + break; + case QKNotEqualOperator: + opString = @"!="; + break; + case QKLikeOperator: + opString = @"LIKE"; + break; + case QKNotLikeOperator: + opString = @"NOT LIKE"; + break; + case QKInOperator: + opString = @"IN"; + break; + case QKNotInOperator: + opString = @"NOT IN"; + break; + case QKIsNullOperator: + opString = @"IS NULL"; + break; + case QKIsNotNullOperator: + opString = @"IS NOT NULL"; + break; + case QKGreaterThanOperator: + opString = @">"; + break; + case QKLessThanOperator: + opString = @"<"; + break; + case QKGreaterThanOrEqualOperator: + opString = @">="; + break; + case QKLessThanOrEqualOperator: + opString = @"<="; + break; + default: + [NSException raise:QKUnrecognisedQueryOperatorException format:@"Unrecognised query operator type: %d", operator]; + break; + } + + return opString; +} + +@end diff --git a/Frameworks/QueryKit/Source/QueryKit-Prefix.pch b/Frameworks/QueryKit/Source/QueryKit-Prefix.pch new file mode 100644 index 00000000..60070a9c --- /dev/null +++ b/Frameworks/QueryKit/Source/QueryKit-Prefix.pch @@ -0,0 +1,3 @@ +#ifdef __OBJC__ + #import +#endif diff --git a/Frameworks/QueryKit/Source/QueryKit.h b/Frameworks/QueryKit/Source/QueryKit.h new file mode 100644 index 00000000..f8570025 --- /dev/null +++ b/Frameworks/QueryKit/Source/QueryKit.h @@ -0,0 +1,37 @@ +// +// $Id: QueryKit.h 3431 2011-09-26 22:26:24Z stuart02 $ +// +// QueryKit.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at + +#import +#import +#import +#import +#import diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryTests.h b/Frameworks/QueryKit/Tests/QKSelectQueryTests.h new file mode 100644 index 00000000..e8b3c3b7 --- /dev/null +++ b/Frameworks/QueryKit/Tests/QKSelectQueryTests.h @@ -0,0 +1,35 @@ +// +// $Id: QKSelectQueryTests.h 3431 2011-09-26 22:26:24Z stuart02 $ +// +// QKSelectQueryTests.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +#import + +@interface QKSelectQueryTests : SenTestCase +{ + QKQuery *_query; +} + +@end diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryTests.m b/Frameworks/QueryKit/Tests/QKSelectQueryTests.m new file mode 100644 index 00000000..fdce3ca8 --- /dev/null +++ b/Frameworks/QueryKit/Tests/QKSelectQueryTests.m @@ -0,0 +1,76 @@ +// +// $Id: QKSelectQueryTests.m 3432 2011-09-27 00:21:35Z stuart02 $ +// +// QKSelectQueryTests.m +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 +// Copyright (c) 2011 Stuart Connolly. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import "QKSelectQueryTests.h" + +static NSString *QKTestTableName = @"test_table"; + +static NSString *QKTestFieldOne = @"test_field1"; +static NSString *QKTestFieldTwo = @"test_field2"; +static NSString *QKTestFieldThree = @"test_field3"; +static NSString *QKTestFieldFour = @"test_field4"; + +static NSUInteger QKTestParameterOne = 10; + +@implementation QKSelectQueryTests + +#pragma mark - +#pragma mark Setup & tear down + +- (void)setUp +{ + _query = [QKQuery selectQueryFromTable:QKTestTableName]; + + [_query addField:QKTestFieldOne]; + [_query addField:QKTestFieldTwo]; + [_query addField:QKTestFieldThree]; + [_query addField:QKTestFieldFour]; + + [_query addParameter:QKTestFieldOne operator:QKEqualityOperator value:[NSNumber numberWithUnsignedInteger:QKTestParameterOne]]; +} + +#pragma mark - +#pragma mark Tests + +- (void)testSelectQueryTypeIsCorrect +{ + STAssertTrue([[_query query] hasPrefix:@"SELECT"], @"query type"); +} + +- (void)testSelectQueryFieldsAreCorrect +{ + NSString *query = [NSString stringWithFormat:@"SELECT %@, %@, %@, %@", QKTestFieldOne, QKTestFieldTwo, QKTestFieldThree, QKTestFieldFour]; + + STAssertTrue([[_query query] hasPrefix:query], @"query fields"); +} + +- (void)testSelectQueryConstraintsAreCorrect +{ + NSString *query = [NSString stringWithFormat:@"WHERE %@ %@ %@", QKTestFieldOne, [QKQueryUtilities operatorRepresentationForType:QKEqualityOperator], [NSNumber numberWithUnsignedInteger:QKTestParameterOne]]; + + STAssertTrue(([[_query query] rangeOfString:query].location != NSNotFound), @"query constraints"); +} + +@end diff --git a/Resources/Plists/QueryKit-Info.plist b/Resources/Plists/QueryKit-Info.plist deleted file mode 100644 index b76ed0eb..00000000 --- a/Resources/Plists/QueryKit-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - QueryKit - CFBundleIdentifier - com.google.code.sequel-pro.querykit - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/UnitTests/QKSelectQueryTests.h b/UnitTests/QKSelectQueryTests.h deleted file mode 100644 index 5a7bdafc..00000000 --- a/UnitTests/QKSelectQueryTests.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// $Id$ -// -// QKSelectQueryTests.h -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -#import - -@interface QKSelectQueryTests : SenTestCase -{ - QKQuery *_query; -} - -@end diff --git a/UnitTests/QKSelectQueryTests.m b/UnitTests/QKSelectQueryTests.m deleted file mode 100644 index 84b4584c..00000000 --- a/UnitTests/QKSelectQueryTests.m +++ /dev/null @@ -1,76 +0,0 @@ -// -// $Id$ -// -// QKSelectQueryTests.m -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on September 4, 2011 -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import "QKSelectQueryTests.h" - -static NSString *QKTestTableName = @"test_table"; - -static NSString *QKTestFieldOne = @"test_field1"; -static NSString *QKTestFieldTwo = @"test_field2"; -static NSString *QKTestFieldThree = @"test_field3"; -static NSString *QKTestFieldFour = @"test_field4"; - -static NSUInteger QKTestParameterOne = 10; - -@implementation QKSelectQueryTests - -#pragma mark - -#pragma mark Setup & tear down - -- (void)setUp -{ - _query = [QKQuery selectQueryFromTable:QKTestTableName]; - - [_query addField:QKTestFieldOne]; - [_query addField:QKTestFieldTwo]; - [_query addField:QKTestFieldThree]; - [_query addField:QKTestFieldFour]; - - [_query addParameter:QKTestFieldOne operator:QKEqualityOperator value:[NSNumber numberWithUnsignedInteger:QKTestParameterOne]]; -} - -#pragma mark - -#pragma mark Tests - -- (void)testSelectQueryTypeIsCorrect -{ - STAssertTrue([[_query query] hasPrefix:@"SELECT"], @"query type"); -} - -- (void)testSelectQueryFieldsAreCorrect -{ - NSString *query = [NSString stringWithFormat:@"SELECT %@, %@, %@, %@", QKTestFieldOne, QKTestFieldTwo, QKTestFieldThree, QKTestFieldFour]; - - STAssertTrue([[_query query] hasPrefix:query], @"query fields"); -} - -- (void)testSelectQueryConstraintsAreCorrect -{ - NSString *query = [NSString stringWithFormat:@"WHERE %@ %@ %@", QKTestFieldOne, [QKQueryUtilities operatorRepresentationForType:QKEqualityOperator], [NSNumber numberWithUnsignedInteger:QKTestParameterOne]]; - - STAssertTrue(([[_query query] rangeOfString:query].location != NSNotFound), @"query constraints"); -} - -@end diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 761c9e40..579712a1 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -139,6 +139,7 @@ 17E090E811498FC9007FC1B4 /* SPPrintController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E090E711498FC9007FC1B4 /* SPPrintController.m */; }; 17E0937E114AE154007FC1B4 /* SPTableInfoPrintTemplate.html in Resources */ = {isa = PBXBuildFile; fileRef = 17E0937D114AE154007FC1B4 /* SPTableInfoPrintTemplate.html */; }; 17E20E0012D660C3007F75A6 /* OCMock.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 11D44DEF118F5887002AA43C /* OCMock.framework */; }; + 17E5955414F3041C0054EE08 /* QueryKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17E5955314F304000054EE08 /* QueryKit.framework */; }; 17E641460EF01EB5001BC333 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E641440EF01EB5001BC333 /* main.m */; }; 17E641560EF01EF6001BC333 /* SPCustomQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E641490EF01EF6001BC333 /* SPCustomQuery.m */; }; 17E641570EF01EF6001BC333 /* SPAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E6414B0EF01EF6001BC333 /* SPAppController.m */; }; @@ -179,16 +180,6 @@ 17F90E2C1210B34900274C98 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 17F90E2B1210B34900274C98 /* Credits.rtf */; }; 17F90E481210B42700274C98 /* SPExportFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F90E471210B42700274C98 /* SPExportFile.m */; }; 17F90E4B1210B43A00274C98 /* SPExportFileUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F90E4A1210B43A00274C98 /* SPExportFileUtilities.m */; }; - 17FC35C01413D13F00AC3602 /* QKQueryOperators.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC358B1413CF7200AC3602 /* QKQueryOperators.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 17FC35C21413D14000AC3602 /* QKQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC358D1413CF7200AC3602 /* QKQuery.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 17FC35C31413D14100AC3602 /* QKQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FC358E1413CF7200AC3602 /* QKQuery.m */; }; - 17FC35C91413D14800AC3602 /* QKQueryTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC35941413CF7200AC3602 /* QKQueryTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 17FC35CA1413D14A00AC3602 /* QueryKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC35911413CF7200AC3602 /* QueryKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 17FC360B1413DAED00AC3602 /* QKQueryParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC36091413DAED00AC3602 /* QKQueryParameter.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 17FC360C1413DAED00AC3602 /* QKQueryParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FC360A1413DAED00AC3602 /* QKQueryParameter.m */; }; - 17FC3626141411B800AC3602 /* QKQueryUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC3624141411B800AC3602 /* QKQueryUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 17FC3627141411B800AC3602 /* QKQueryUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FC3625141411B800AC3602 /* QKQueryUtilities.m */; }; - 17FC3634141415F100AC3602 /* QKSelectQueryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FC3633141415F100AC3602 /* QKSelectQueryTests.m */; }; 17FDB04C1280778B00DBBBC2 /* SPFontPreviewTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FDB04B1280778B00DBBBC2 /* SPFontPreviewTextField.m */; }; 296DC89F0F8FD336002A3258 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 296DC89E0F8FD336002A3258 /* WebKit.framework */; }; 296DC8B60F909194002A3258 /* MGTemplateEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8A70F909194002A3258 /* MGTemplateEngine.m */; }; @@ -522,11 +513,25 @@ remoteGlobalIDString = 17B7B5611016012700F057DE; remoteInfo = MCPKit; }; - 17FC36351414164000AC3602 /* PBXContainerItemProxy */ = { + 17E5955214F304000054EE08 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; + containerPortal = 17E5954E14F304000054EE08 /* QueryKit.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8DC2EF5B0486A6940098B216 /* QueryKit.framework */; + remoteInfo = QueryKit; + }; + 17E596A114F307CE0054EE08 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 17E5954E14F304000054EE08 /* QueryKit.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 17E5969E14F307CE0054EE08 /* Tests.octest */; + remoteInfo = Tests; + }; + 17E5971314F917380054EE08 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 17E5954E14F304000054EE08 /* QueryKit.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 17FC35AB1413CFE700AC3602; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216 /* QueryKit */; remoteInfo = QueryKit; }; 5847571D120A1C6D0057631F /* PBXContainerItemProxy */ = { @@ -841,6 +846,7 @@ 17E090E711498FC9007FC1B4 /* SPPrintController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPPrintController.m; sourceTree = ""; }; 17E0937D114AE154007FC1B4 /* SPTableInfoPrintTemplate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = SPTableInfoPrintTemplate.html; path = Templates/SPTableInfoPrintTemplate.html; sourceTree = ""; }; 17E20E1E12D6645F007F75A6 /* run-tests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "run-tests.sh"; sourceTree = ""; }; + 17E5954E14F304000054EE08 /* QueryKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = QueryKit.xcodeproj; path = Frameworks/QueryKit/QueryKit.xcodeproj; sourceTree = ""; }; 17E641440EF01EB5001BC333 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 17E641450EF01EB5001BC333 /* Sequel-Pro.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Sequel-Pro.pch"; sourceTree = ""; }; 17E641480EF01EF6001BC333 /* SPCustomQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPCustomQuery.h; sourceTree = ""; }; @@ -900,19 +906,6 @@ 17F90E471210B42700274C98 /* SPExportFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPExportFile.m; sourceTree = ""; }; 17F90E491210B43A00274C98 /* SPExportFileUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPExportFileUtilities.h; sourceTree = ""; }; 17F90E4A1210B43A00274C98 /* SPExportFileUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPExportFileUtilities.m; sourceTree = ""; }; - 17FC358B1413CF7200AC3602 /* QKQueryOperators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryOperators.h; sourceTree = ""; }; - 17FC358D1413CF7200AC3602 /* QKQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQuery.h; sourceTree = ""; }; - 17FC358E1413CF7200AC3602 /* QKQuery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKQuery.m; sourceTree = ""; }; - 17FC35911413CF7200AC3602 /* QueryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QueryKit.h; sourceTree = ""; }; - 17FC35941413CF7200AC3602 /* QKQueryTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryTypes.h; sourceTree = ""; }; - 17FC35A01413CFBC00AC3602 /* QueryKit-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "QueryKit-Info.plist"; path = "Plists/QueryKit-Info.plist"; sourceTree = ""; }; - 17FC35AC1413CFE700AC3602 /* QueryKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = QueryKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 17FC36091413DAED00AC3602 /* QKQueryParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryParameter.h; sourceTree = ""; }; - 17FC360A1413DAED00AC3602 /* QKQueryParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKQueryParameter.m; sourceTree = ""; }; - 17FC3624141411B800AC3602 /* QKQueryUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryUtilities.h; sourceTree = ""; }; - 17FC3625141411B800AC3602 /* QKQueryUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKQueryUtilities.m; sourceTree = ""; }; - 17FC3632141415F100AC3602 /* QKSelectQueryTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKSelectQueryTests.h; sourceTree = ""; }; - 17FC3633141415F100AC3602 /* QKSelectQueryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKSelectQueryTests.m; sourceTree = ""; }; 17FDB04A1280778B00DBBBC2 /* SPFontPreviewTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPFontPreviewTextField.h; sourceTree = ""; }; 17FDB04B1280778B00DBBBC2 /* SPFontPreviewTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFontPreviewTextField.m; sourceTree = ""; }; 296DC89E0F8FD336002A3258 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = ""; }; @@ -1353,13 +1346,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 17FC35AA1413CFE700AC3602 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 584754C0120A04560057631F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1418,6 +1404,7 @@ 179ECECA11F265FC009C6A40 /* libbz2.dylib in Frameworks */, 58C6C71611FBB17200A3F5E9 /* UniversalDetector.framework in Frameworks */, 58DC0D5F1293293400B76DA5 /* ShortcutRecorder.framework in Frameworks */, + 17E5955414F3041C0054EE08 /* QueryKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1726,7 +1713,6 @@ children = ( 17E641F60EF02088001BC333 /* Info.plist */, 17DD52C1115074B3007D8950 /* InfoPlist.strings */, - 17FC35A01413CFBC00AC3602 /* QueryKit-Info.plist */, 17DA04EA0FC1A7DA00D66140 /* Unit Tests-Info.plist */, B58731270F838C9E00087794 /* PreferenceDefaults.plist */, 17B7B58B1016022C00F057DE /* MCPKit-Info.plist */, @@ -2088,6 +2074,15 @@ name = "Outline Views"; sourceTree = ""; }; + 17E5954F14F304000054EE08 /* Products */ = { + isa = PBXGroup; + children = ( + 17E5955314F304000054EE08 /* QueryKit.framework */, + 17E596A214F307CE0054EE08 /* Tests.octest */, + ); + name = Products; + sourceTree = ""; + }; 17E641420EF01E8A001BC333 /* Source */ = { isa = PBXGroup; children = ( @@ -2383,45 +2378,10 @@ name = Model; sourceTree = ""; }; - 17FC358A1413CF7200AC3602 /* QueryKit */ = { - isa = PBXGroup; - children = ( - 17FC35911413CF7200AC3602 /* QueryKit.h */, - 17FC358D1413CF7200AC3602 /* QKQuery.h */, - 17FC358E1413CF7200AC3602 /* QKQuery.m */, - 17FC3624141411B800AC3602 /* QKQueryUtilities.h */, - 17FC3625141411B800AC3602 /* QKQueryUtilities.m */, - 17FC36091413DAED00AC3602 /* QKQueryParameter.h */, - 17FC360A1413DAED00AC3602 /* QKQueryParameter.m */, - 17FC35D31413D3BC00AC3602 /* Constants */, - ); - name = QueryKit; - path = Frameworks/QueryKit; - sourceTree = ""; - }; - 17FC35D31413D3BC00AC3602 /* Constants */ = { - isa = PBXGroup; - children = ( - 17FC35941413CF7200AC3602 /* QKQueryTypes.h */, - 17FC358B1413CF7200AC3602 /* QKQueryOperators.h */, - ); - name = Constants; - sourceTree = ""; - }; - 17FC362C141415C200AC3602 /* QueryKit */ = { - isa = PBXGroup; - children = ( - 17FC3632141415F100AC3602 /* QKSelectQueryTests.h */, - 17FC3633141415F100AC3602 /* QKSelectQueryTests.m */, - ); - name = QueryKit; - sourceTree = ""; - }; 17FC366814141A4B00AC3602 /* Frameworks */ = { isa = PBXGroup; children = ( 17DC885B126B36CF00E9AAEC /* MCPKit */, - 17FC362C141415C200AC3602 /* QueryKit */, ); name = Frameworks; sourceTree = ""; @@ -2429,9 +2389,9 @@ 17FC36AE141425D600AC3602 /* Frameworks */ = { isa = PBXGroup; children = ( + 17E5954E14F304000054EE08 /* QueryKit.xcodeproj */, 17B7B5551016002900F057DE /* MCPKit */, 58B906F811BD9B34000826E5 /* PSMTabBar */, - 17FC358A1413CF7200AC3602 /* QueryKit */, ); name = Frameworks; path = ..; @@ -2456,7 +2416,6 @@ 58B906E611BD989A000826E5 /* PSMTabBar.framework */, 58B9096111C3A42B000826E5 /* xibLocalizationPostprocessor */, 584754C2120A04560057631F /* Sequel Pro.qlgenerator */, - 17FC35AC1413CFE700AC3602 /* QueryKit.framework */, ); name = Products; sourceTree = ""; @@ -2790,19 +2749,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 17FC35A71413CFE700AC3602 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 17FC35C01413D13F00AC3602 /* QKQueryOperators.h in Headers */, - 17FC35C21413D14000AC3602 /* QKQuery.h in Headers */, - 17FC35C91413D14800AC3602 /* QKQueryTypes.h in Headers */, - 17FC35CA1413D14A00AC3602 /* QueryKit.h in Headers */, - 17FC360B1413DAED00AC3602 /* QKQueryParameter.h in Headers */, - 17FC3626141411B800AC3602 /* QKQueryUtilities.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 58B906E111BD989A000826E5 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -2853,23 +2799,6 @@ productReference = 17B7B5621016012700F057DE /* MCPKit.framework */; productType = "com.apple.product-type.framework"; }; - 17FC35AB1413CFE700AC3602 /* QueryKit */ = { - isa = PBXNativeTarget; - buildConfigurationList = 17FC35B11413CFE800AC3602 /* Build configuration list for PBXNativeTarget "QueryKit" */; - buildPhases = ( - 17FC35A71413CFE700AC3602 /* Headers */, - 17FC35A91413CFE700AC3602 /* Sources */, - 17FC35AA1413CFE700AC3602 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = QueryKit; - productName = QueryKit; - productReference = 17FC35AC1413CFE700AC3602 /* QueryKit.framework */; - productType = "com.apple.product-type.framework"; - }; 380F4ED80FC0B50500B0BFD7 /* Unit Tests */ = { isa = PBXNativeTarget; buildConfigurationList = 380F4EDE0FC0B50600B0BFD7 /* Build configuration list for PBXNativeTarget "Unit Tests" */; @@ -2884,7 +2813,6 @@ dependencies = ( 1792C2CD10AE239D00ABE758 /* PBXTargetDependency */, 1798AB0012676BAD000D946A /* PBXTargetDependency */, - 17FC36361414164000AC3602 /* PBXTargetDependency */, ); name = "Unit Tests"; productName = "Unit Tests"; @@ -2978,6 +2906,7 @@ 58CDB34B0FCE144000F8ACA3 /* PBXTargetDependency */, 58B9097011C3A462000826E5 /* PBXTargetDependency */, 5847571E120A1C6D0057631F /* PBXTargetDependency */, + 17E5971414F917380054EE08 /* PBXTargetDependency */, ); name = "Sequel Pro"; productInstallPath = "$(HOME)/Applications"; @@ -3003,6 +2932,12 @@ ); mainGroup = 2A37F4AAFDCFA73011CA2CEA /* sequel-pro */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 17E5954F14F304000054EE08 /* Products */; + ProjectRef = 17E5954E14F304000054EE08 /* QueryKit.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 8D15AC270486D014006FF6A4 /* Sequel Pro */, @@ -3010,7 +2945,6 @@ 58CDB3350FCE13C900F8ACA3 /* SequelProTunnelAssistant */, 17B7B5611016012700F057DE /* MCPKit */, 58B906E511BD989A000826E5 /* PSMTabBar */, - 17FC35AB1413CFE700AC3602 /* QueryKit */, 58B9096011C3A42B000826E5 /* xibLocalizationPostprocessor */, 584754C1120A04560057631F /* Sequel Pro QLGenerator */, 1798AB1C12676EA0000D946A /* Localize */, @@ -3018,6 +2952,23 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 17E5955314F304000054EE08 /* QueryKit.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = QueryKit.framework; + remoteRef = 17E5955214F304000054EE08 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 17E596A214F307CE0054EE08 /* Tests.octest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = Tests.octest; + remoteRef = 17E596A114F307CE0054EE08 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 584754BE120A04560057631F /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -3282,16 +3233,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 17FC35A91413CFE700AC3602 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 17FC35C31413D14100AC3602 /* QKQuery.m in Sources */, - 17FC360C1413DAED00AC3602 /* QKQueryParameter.m in Sources */, - 17FC3627141411B800AC3602 /* QKQueryUtilities.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 380F4ED50FC0B50500B0BFD7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -3307,7 +3248,6 @@ 176059B813361D380098E162 /* SPDatabaseInfoTest.m in Sources */, 176059B913361D390098E162 /* SPTableCopyTest.m in Sources */, 176059BA13361D3A0098E162 /* SPDatabaseCopyTest.m in Sources */, - 17FC3634141415F100AC3602 /* QKSelectQueryTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3544,10 +3484,10 @@ target = 17B7B5611016012700F057DE /* MCPKit */; targetProxy = 17B7B59A1016039200F057DE /* PBXContainerItemProxy */; }; - 17FC36361414164000AC3602 /* PBXTargetDependency */ = { + 17E5971414F917380054EE08 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 17FC35AB1413CFE700AC3602 /* QueryKit */; - targetProxy = 17FC36351414164000AC3602 /* PBXContainerItemProxy */; + name = QueryKit; + targetProxy = 17E5971314F917380054EE08 /* PBXContainerItemProxy */; }; 5847571E120A1C6D0057631F /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -4249,81 +4189,6 @@ }; name = Distribution; }; - 17FC35AE1413CFE800AC3602 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - INFOPLIST_FILE = "Resources/Plists/QueryKit-Info.plist"; - INSTALL_PATH = "$(HOME)/Library/Frameworks"; - OTHER_LDFLAGS = ( - "-framework", - Foundation, - ); - PREBINDING = NO; - PRODUCT_NAME = QueryKit; - SDKROOT = macosx10.6; - }; - name = Debug; - }; - 17FC35AF1413CFE800AC3602 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - INFOPLIST_FILE = "Resources/Plists/QueryKit-Info.plist"; - INSTALL_PATH = "$(HOME)/Library/Frameworks"; - OTHER_LDFLAGS = ( - "-framework", - Foundation, - ); - PREBINDING = NO; - PRODUCT_NAME = QueryKit; - SDKROOT = macosx10.6; - ZERO_LINK = NO; - }; - name = Release; - }; - 17FC35B01413CFE800AC3602 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - INFOPLIST_FILE = "Resources/Plists/QueryKit-Info.plist"; - INSTALL_PATH = "$(HOME)/Library/Frameworks"; - OTHER_LDFLAGS = ( - "-framework", - Foundation, - ); - PREBINDING = NO; - PRODUCT_NAME = QueryKit; - SDKROOT = macosx10.6; - }; - name = Distribution; - }; 380F4EDB0FC0B50600B0BFD7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -4541,6 +4406,7 @@ "\"$(SRCROOT)/Frameworks\"", "\"$(SRCROOT)\"", ); + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Source/Sequel-Pro.pch"; @@ -4791,6 +4657,7 @@ "\"$(SRCROOT)/Frameworks\"", "\"$(SRCROOT)\"", ); + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Source/Sequel-Pro.pch"; @@ -4937,16 +4804,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 17FC35B11413CFE800AC3602 /* Build configuration list for PBXNativeTarget "QueryKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 17FC35AE1413CFE800AC3602 /* Debug */, - 17FC35AF1413CFE800AC3602 /* Release */, - 17FC35B01413CFE800AC3602 /* Distribution */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 380F4EDE0FC0B50600B0BFD7 /* Build configuration list for PBXNativeTarget "Unit Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( -- cgit v1.2.3