aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/QueryKit/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-07-10 10:25:09 +0000
committerstuconnolly <stuart02@gmail.com>2012-07-10 10:25:09 +0000
commit4aebe5fb9cdcd145ef3b3135700e27d13315effd (patch)
treeee498c6797ff797a063193c53b2825a081055eab /Frameworks/QueryKit/Source
parent80645cb916efdf81e0a7ec0b8d6e0c1be5b05da3 (diff)
downloadsequelpro-4aebe5fb9cdcd145ef3b3135700e27d13315effd.tar.gz
sequelpro-4aebe5fb9cdcd145ef3b3135700e27d13315effd.tar.bz2
sequelpro-4aebe5fb9cdcd145ef3b3135700e27d13315effd.zip
Additional QueryKit tests.
Diffstat (limited to 'Frameworks/QueryKit/Source')
-rw-r--r--Frameworks/QueryKit/Source/QKQuery.h18
-rw-r--r--Frameworks/QueryKit/Source/QKQuery.m7
-rw-r--r--Frameworks/QueryKit/Source/QKQueryGenericParameter.h6
-rw-r--r--Frameworks/QueryKit/Source/QKQueryParameter.h2
-rw-r--r--Frameworks/QueryKit/Source/QKQueryTypes.h1
5 files changed, 21 insertions, 13 deletions
diff --git a/Frameworks/QueryKit/Source/QKQuery.h b/Frameworks/QueryKit/Source/QKQuery.h
index 1cb93d15..e3b7f148 100644
--- a/Frameworks/QueryKit/Source/QKQuery.h
+++ b/Frameworks/QueryKit/Source/QKQuery.h
@@ -62,37 +62,41 @@
/**
* @property _database The database the query is to be run against (optional).
*/
-@property (readwrite, retain, getter=database, setter=setDatabase:) NSString *_database;
+@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(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(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(readwrite, retain, getter=fields, setter=setFields:) NSMutableArray *_fields;
/**
* @property _updateFields The fields of an UPDATE query.
*/
-@property (readwrite, retain, getter=updateParameters, setter=setUpdateParameters:) NSMutableArray *_updateParameters;
+@property(readwrite, retain, getter=updateParameters, setter=setUpdateParameters:) NSMutableArray *_updateParameters;
/**
* @property _queryType The type of query to be built.
*/
-@property (readwrite, assign, getter=queryType, setter=setQueryType:) QKQueryType _queryType;
+@property(readwrite, assign, getter=queryType, setter=setQueryType:) QKQueryType _queryType;
/**
* @property _useQuotes Indicates whether or not the query's fields should be quoted.
*/
-@property (readwrite, assign, getter=useQuotes) BOOL _useQuotes;
+@property(readwrite, assign, getter=useQuotes) BOOL _useQuotes;
+
+@property(readonly, getter=groupByFields) NSMutableArray *_groupByFields;
+
+@property(readonly, getter=orderByFields) NSMutableArray *_orderByFields;
+ (QKQuery *)queryTable:(NSString *)table;
+ (QKQuery *)selectQueryFromTable:(NSString *)table;
diff --git a/Frameworks/QueryKit/Source/QKQuery.m b/Frameworks/QueryKit/Source/QKQuery.m
index 124bb5d2..c60f3162 100644
--- a/Frameworks/QueryKit/Source/QKQuery.m
+++ b/Frameworks/QueryKit/Source/QKQuery.m
@@ -60,6 +60,8 @@ static NSString *QKNoQueryTableException = @"QKNoQueryTable";
@synthesize _fields;
@synthesize _updateParameters;
@synthesize _useQuotes;
+@synthesize _groupByFields;
+@synthesize _orderByFields;
#pragma mark -
#pragma mark Initialization
@@ -85,7 +87,7 @@ static NSString *QKNoQueryTableException = @"QKNoQueryTable";
[self setFields:[[NSMutableArray alloc] init]];
[self setUpdateParameters:[[NSMutableArray alloc] init]];
[self setParameters:[[NSMutableArray alloc] init]];
- [self setQueryType:(QKQueryType)-1];
+ [self setQueryType:QKUnknownQuery];
[self setUseQuotes:YES];
_orderDescending = NO;
@@ -119,7 +121,8 @@ static NSString *QKNoQueryTableException = @"QKNoQueryTable";
{
[self setTable:nil];
[self setDatabase:nil];
- [self setQueryType:(QKQueryType)-1];
+ [self setUseQuotes:YES];
+ [self setQueryType:QKUnknownQuery];
[_fields removeAllObjects];
[_parameters removeAllObjects];
diff --git a/Frameworks/QueryKit/Source/QKQueryGenericParameter.h b/Frameworks/QueryKit/Source/QKQueryGenericParameter.h
index ba1e63cd..63e9b529 100644
--- a/Frameworks/QueryKit/Source/QKQueryGenericParameter.h
+++ b/Frameworks/QueryKit/Source/QKQueryGenericParameter.h
@@ -38,16 +38,16 @@
/**
* @property _field The field component of the parameter.
*/
-@property (readwrite, retain, getter=field, setter=setField:) NSString *_field;
+@property(readwrite, retain, getter=field, setter=setField:) NSString *_field;
/**
* @property _quoteField Indicates whether or not this parameters field should be quoted.
*/
-@property (readwrite, assign, getter=useQuotes, setter=setUseQuotes:) BOOL _useQuotes;
+@property(readwrite, assign, getter=useQuotes, setter=setUseQuotes:) BOOL _useQuotes;
/**
*@property _value The value component of the parameter.
*/
-@property (readwrite, retain, getter=value, setter=setValue:) id _value;
+@property(readwrite, retain, getter=value, setter=setValue:) id _value;
@end
diff --git a/Frameworks/QueryKit/Source/QKQueryParameter.h b/Frameworks/QueryKit/Source/QKQueryParameter.h
index b2436468..8cbcafd6 100644
--- a/Frameworks/QueryKit/Source/QKQueryParameter.h
+++ b/Frameworks/QueryKit/Source/QKQueryParameter.h
@@ -46,7 +46,7 @@
/**
* @property _operator The operator component of the parameter.
*/
-@property (readwrite, assign, getter=operator, setter=setOperator:) QKQueryOperator _operator;
+@property(readwrite, assign, getter=operator, setter=setOperator:) QKQueryOperator _operator;
+ (QKQueryParameter *)queryParamWithField:(NSString *)field operator:(QKQueryOperator)op value:(id)value;
diff --git a/Frameworks/QueryKit/Source/QKQueryTypes.h b/Frameworks/QueryKit/Source/QKQueryTypes.h
index 96978ce2..9416a0aa 100644
--- a/Frameworks/QueryKit/Source/QKQueryTypes.h
+++ b/Frameworks/QueryKit/Source/QKQueryTypes.h
@@ -35,6 +35,7 @@
*/
typedef enum
{
+ QKUnknownQuery = -1,
QKSelectQuery,
QKUpdateQuery,
QKInsertQuery,