diff options
author | stuconnolly <stuart02@gmail.com> | 2012-09-16 04:27:12 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-09-16 04:27:12 +0000 |
commit | a0b76fba5ade5b1c018cb7ebcfae193cec114f5f (patch) | |
tree | 3a64048771b0fed2efac5de13176c6a4c28031fc /Frameworks/PostgresKit/Source/FLXPostgresResult.m | |
parent | 202413b252af301e314a097b3deda6ac1a592a2a (diff) | |
download | sequelpro-a0b76fba5ade5b1c018cb7ebcfae193cec114f5f.tar.gz sequelpro-a0b76fba5ade5b1c018cb7ebcfae193cec114f5f.tar.bz2 sequelpro-a0b76fba5ade5b1c018cb7ebcfae193cec114f5f.zip |
Add the ability to set the default row return type.
Diffstat (limited to 'Frameworks/PostgresKit/Source/FLXPostgresResult.m')
-rw-r--r-- | Frameworks/PostgresKit/Source/FLXPostgresResult.m | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Frameworks/PostgresKit/Source/FLXPostgresResult.m b/Frameworks/PostgresKit/Source/FLXPostgresResult.m index 57a26268..06950a3b 100644 --- a/Frameworks/PostgresKit/Source/FLXPostgresResult.m +++ b/Frameworks/PostgresKit/Source/FLXPostgresResult.m @@ -38,6 +38,7 @@ @synthesize numberOfRows = _numberOfRows; @synthesize numberOfFields = _numberOfFields; @synthesize stringEncoding = _stringEncoding; +@synthesize defaultRowType = _defaultRowType; #pragma mark - #pragma mark Initialisation @@ -73,6 +74,7 @@ _connection = [connection retain]; _stringEncoding = [_connection stringEncoding]; + _defaultRowType = FLXPostgresResultRowAsDictionary; _typeHandlers = (void **)calloc(sizeof(void *), _numberOfFields); @@ -115,6 +117,16 @@ #pragma mark Data Retrieval /** + * Return the current row in the type of the currently set default (defaults to dictionary). + * + * @return The row of data. + */ +- (id)row +{ + return [self rowAsType:_defaultRowType]; +} + +/** * Return the current row as an array. * * @return The array of data. @@ -143,9 +155,7 @@ { if (_row >= _numberOfRows) return nil; - id data; - - data = (type == FLXPostgresResultRowAsArray) ? [NSMutableArray arrayWithCapacity:_numberOfFields] : [NSMutableDictionary dictionaryWithCapacity:_numberOfFields]; + id data = (type == FLXPostgresResultRowAsArray) ? [NSMutableArray arrayWithCapacity:_numberOfFields] : [NSMutableDictionary dictionaryWithCapacity:_numberOfFields]; for (NSUInteger i = 0; i < _numberOfFields; i++) { |