aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Frameworks/QueryKit/Source/QKQuery.h1
-rw-r--r--Frameworks/QueryKit/Source/QKQuery.m21
2 files changed, 22 insertions, 0 deletions
diff --git a/Frameworks/QueryKit/Source/QKQuery.h b/Frameworks/QueryKit/Source/QKQuery.h
index 2132a158..c0f925bb 100644
--- a/Frameworks/QueryKit/Source/QKQuery.h
+++ b/Frameworks/QueryKit/Source/QKQuery.h
@@ -100,6 +100,7 @@
- (id)initWithTable:(NSString *)table;
- (NSString *)query;
+- (void)clear;
- (void)addField:(NSString *)field;
- (void)addFields:(NSArray *)fields;
diff --git a/Frameworks/QueryKit/Source/QKQuery.m b/Frameworks/QueryKit/Source/QKQuery.m
index d26b9f72..4be29ae2 100644
--- a/Frameworks/QueryKit/Source/QKQuery.m
+++ b/Frameworks/QueryKit/Source/QKQuery.m
@@ -100,11 +100,32 @@ static NSString *QKNoQueryTableException = @"QKNoQueryTable";
#pragma mark -
#pragma mark Public API
+/**
+ * Requests that the query be built.
+ *
+ * @return The generated query.
+ */
- (NSString *)query
{
return _query ? [self _buildQuery] : @"";
}
+/**
+ * Clears anything this instance should know about the query it's building.
+ */
+- (void)clear
+{
+ [self setTable:nil];
+ [self setDatabase:nil];
+ [self setQueryType:(QKQueryType)-1];
+
+ [_fields removeAllObjects];
+ [_parameters removeAllObjects];
+ [_updateParameters removeAllObjects];
+ [_groupByFields removeAllObjects];
+ [_orderByFields removeAllObjects];
+}
+
#pragma mark -
#pragma mark Fields