diff options
author | stuconnolly <stuart02@gmail.com> | 2012-03-25 19:36:35 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-03-25 19:36:35 +0000 |
commit | e516badf6b875c27ce095c9987aaa4004b98844e (patch) | |
tree | d0dd66e86e998b062cc36aab8644a47c7e9e03cd /Frameworks/QueryKit/Source/QKQuery.m | |
parent | c79d9608d59d6daf5a644a48881b621316206c4e (diff) | |
download | sequelpro-e516badf6b875c27ce095c9987aaa4004b98844e.tar.gz sequelpro-e516badf6b875c27ce095c9987aaa4004b98844e.tar.bz2 sequelpro-e516badf6b875c27ce095c9987aaa4004b98844e.zip |
QueryKit: add clear method so query instances can be reused.
Diffstat (limited to 'Frameworks/QueryKit/Source/QKQuery.m')
-rw-r--r-- | Frameworks/QueryKit/Source/QKQuery.m | 21 |
1 files changed, 21 insertions, 0 deletions
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 |