FMResultSet Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | FMResultSet.h |
Properties
query
Executed query
@property (atomic, retain) NSString *queryDiscussion
Executed query
Declared In
FMResultSet.h
columnNameToIndexMap
NSMutableDictionary mapping column names to numeric index
@property (readonly) NSMutableDictionary *columnNameToIndexMapDiscussion
NSMutableDictionary mapping column names to numeric index
Declared In
FMResultSet.h
statement
FMStatement used by result set.
@property (atomic, retain) FMStatement *statementDiscussion
FMStatement used by result set.
Declared In
FMResultSet.h
Creating and closing database
+ resultSetWithStatement:usingParentDatabase:
Create result set from FMStatement
+ (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase *)aDBParameters
statement |
A |
|---|---|
aDB |
A |
Return Value
A FMResultSet on success; nil on failure
Discussion
Create result set from FMStatement
Declared In
FMResultSet.h
Iterating through the result set
– next
Retrieve next row for result set.
- (BOOL)nextReturn Value
YES if row successfully retrieved; NO if end of result set reached
Discussion
Retrieve next row for result set.
You must always invoke next or nextWithError before attempting to access the values returned in a query, even if you’re only expecting one.
See Also
Declared In
FMResultSet.h
– nextWithError:
Retrieve next row for result set.
- (BOOL)nextWithError:(NSError **)outErrParameters
outErr |
A ‘NSError’ object to receive any error object (if any). |
|---|
Return Value
‘YES’ if row successfully retrieved; ‘NO’ if end of result set reached
Discussion
Retrieve next row for result set.
You must always invoke next or nextWithError before attempting to access the values returned in a query, even if you’re only expecting one.
See Also
Declared In
FMResultSet.h
– hasAnotherRow
Did the last call to next succeed in retrieving another row?
- (BOOL)hasAnotherRowReturn Value
YES if the last call to next succeeded in retrieving another record; NO if not.
Discussion
Did the last call to next succeed in retrieving another row?
Warning: The hasAnotherRow method must follow a call to next. If the previous database interaction was something other than a call to next, then this method may return NO, whether there is another row of data or not.
See Also
Declared In
FMResultSet.h
Retrieving information from result set
– columnCount
How many columns in result set
- (int)columnCountReturn Value
Integer value of the number of columns.
Discussion
How many columns in result set
Declared In
FMResultSet.h
– columnIndexForName:
Column index for column name
- (int)columnIndexForName:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
Zero-based index for column.
Discussion
Column index for column name
Declared In
FMResultSet.h
– columnNameForIndex:
Column name for column index
- (NSString *)columnNameForIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
columnName NSString value of the name of the column.
Discussion
Column name for column index
Declared In
FMResultSet.h
– intForColumn:
Result set integer value for column.
- (int)intForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
int value of the result set’s column.
Discussion
Result set integer value for column.
Declared In
FMResultSet.h
– intForColumnIndex:
Result set integer value for column.
- (int)intForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
int value of the result set’s column.
Discussion
Result set integer value for column.
Declared In
FMResultSet.h
– longForColumn:
Result set long value for column.
- (long)longForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
long value of the result set’s column.
Discussion
Result set long value for column.
Declared In
FMResultSet.h
– longForColumnIndex:
Result set long value for column.
- (long)longForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
long value of the result set’s column.
Discussion
Result set long value for column.
Declared In
FMResultSet.h
– longLongIntForColumn:
Result set long long int value for column.
- (long long int)longLongIntForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
long long int value of the result set’s column.
Discussion
Result set long long int value for column.
Declared In
FMResultSet.h
– longLongIntForColumnIndex:
Result set long long int value for column.
- (long long int)longLongIntForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
long long int value of the result set’s column.
Discussion
Result set long long int value for column.
Declared In
FMResultSet.h
– unsignedLongLongIntForColumn:
Result set unsigned long long int value for column.
- (unsigned long long int)unsignedLongLongIntForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
unsigned long long int value of the result set’s column.
Discussion
Result set unsigned long long int value for column.
Declared In
FMResultSet.h
– unsignedLongLongIntForColumnIndex:
Result set unsigned long long int value for column.
- (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
unsigned long long int value of the result set’s column.
Discussion
Result set unsigned long long int value for column.
Declared In
FMResultSet.h
– boolForColumn:
Result set BOOL value for column.
- (BOOL)boolForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
BOOL value of the result set’s column.
Discussion
Result set BOOL value for column.
Declared In
FMResultSet.h
– boolForColumnIndex:
Result set BOOL value for column.
- (BOOL)boolForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
BOOL value of the result set’s column.
Discussion
Result set BOOL value for column.
Declared In
FMResultSet.h
– doubleForColumn:
Result set double value for column.
- (double)doubleForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
double value of the result set’s column.
Discussion
Result set double value for column.
Declared In
FMResultSet.h
– doubleForColumnIndex:
Result set double value for column.
- (double)doubleForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
double value of the result set’s column.
Discussion
Result set double value for column.
Declared In
FMResultSet.h
– stringForColumn:
Result set NSString value for column.
- (NSString *)stringForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
NSString value of the result set’s column.
Discussion
Result set NSString value for column.
Declared In
FMResultSet.h
– stringForColumnIndex:
Result set NSString value for column.
- (NSString *)stringForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
NSString value of the result set’s column.
Discussion
Result set NSString value for column.
Declared In
FMResultSet.h
– dateForColumn:
Result set NSDate value for column.
- (NSDate *)dateForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
NSDate value of the result set’s column.
Discussion
Result set NSDate value for column.
Declared In
FMResultSet.h
– dateForColumnIndex:
Result set NSDate value for column.
- (NSDate *)dateForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
NSDate value of the result set’s column.
Discussion
Result set NSDate value for column.
Declared In
FMResultSet.h
– dataForColumn:
Result set NSData value for column.
- (NSData *)dataForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
NSData value of the result set’s column.
Discussion
Result set NSData value for column.
This is useful when storing binary data in table (such as image or the like).
Declared In
FMResultSet.h
– dataForColumnIndex:
Result set NSData value for column.
- (NSData *)dataForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
NSData value of the result set’s column.
Discussion
Result set NSData value for column.
Declared In
FMResultSet.h
– UTF8StringForColumnName:
Result set (const unsigned char *) value for column.
- (const unsigned char *)UTF8StringForColumnName:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
(const unsigned char *) value of the result set’s column.
Discussion
Result set (const unsigned char *) value for column.
Declared In
FMResultSet.h
– UTF8StringForColumnIndex:
Result set (const unsigned char *) value for column.
- (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
(const unsigned char *) value of the result set’s column.
Discussion
Result set (const unsigned char *) value for column.
Declared In
FMResultSet.h
– objectForColumnName:
Result set object for column.
- (id)objectForColumnName:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
Either NSNumber, NSString, NSData, or NSNull. If the column was NULL, this returns [NSNull null] object.
Discussion
Result set object for column.
See Also
Declared In
FMResultSet.h
– objectForColumnIndex:
Result set object for column.
- (id)objectForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
Either NSNumber, NSString, NSData, or NSNull. If the column was NULL, this returns [NSNull null] object.
Discussion
Result set object for column.
See Also
Declared In
FMResultSet.h
– objectForKeyedSubscript:
Result set object for column.
- (id)objectForKeyedSubscript:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
Either NSNumber, NSString, NSData, or NSNull. If the column was NULL, this returns [NSNull null] object.
Discussion
Result set object for column.
This method allows the use of the “boxed” syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported:
id result = rs[@"employee_name"];
This simplified syntax is equivalent to calling:
id result = [rs objectForKeyedSubscript:@"employee_name"];
which is, it turns out, equivalent to calling:
id result = [rs objectForColumnName:@"employee_name"];
Declared In
FMResultSet.h
– objectAtIndexedSubscript:
Result set object for column.
- (id)objectAtIndexedSubscript:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
Either NSNumber, NSString, NSData, or NSNull. If the column was NULL, this returns [NSNull null] object.
Discussion
Result set object for column.
This method allows the use of the “boxed” syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported:
id result = rs[0];
This simplified syntax is equivalent to calling:
id result = [rs objectForKeyedSubscript:0];
which is, it turns out, equivalent to calling:
id result = [rs objectForColumnName:0];
Declared In
FMResultSet.h
– dataNoCopyForColumn:
Result set NSData value for column.
- (NSData *)dataNoCopyForColumn:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
NSData value of the result set’s column.
Discussion
Result set NSData value for column.
Warning: If you are going to use this data after you iterate over the next row, or after you close the
result set, make sure to make a copy of the data first (or just use dataForColumn:/dataForColumnIndex:)
If you don’t, you’re going to be in a world of hurt when you try and use the data.
Declared In
FMResultSet.h
– dataNoCopyForColumnIndex:
Result set NSData value for column.
- (NSData *)dataNoCopyForColumnIndex:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
NSData value of the result set’s column.
Discussion
Result set NSData value for column.
Warning: If you are going to use this data after you iterate over the next row, or after you close the
result set, make sure to make a copy of the data first (or just use dataForColumn:/dataForColumnIndex:)
If you don’t, you’re going to be in a world of hurt when you try and use the data.
Declared In
FMResultSet.h
– columnIndexIsNull:
Is the column NULL?
- (BOOL)columnIndexIsNull:(int)columnIdxParameters
columnIdx |
Zero-based index for column. |
|---|
Return Value
YES if column is NULL; NO if not NULL.
Discussion
Is the column NULL?
Declared In
FMResultSet.h
– columnIsNull:
Is the column NULL?
- (BOOL)columnIsNull:(NSString *)columnNameParameters
columnName |
|
|---|
Return Value
YES if column is NULL; NO if not NULL.
Discussion
Is the column NULL?
Declared In
FMResultSet.h
– resultDictionary
Returns a dictionary of the row results mapped to case sensitive keys of the column names.
- (NSDictionary *)resultDictionaryReturn Value
NSDictionary of the row results.
Discussion
Returns a dictionary of the row results mapped to case sensitive keys of the column names.
Warning: The keys to the dictionary are case sensitive of the column names.
Declared In
FMResultSet.h
– resultDict
Returns a dictionary of the row results
- (NSDictionary *)resultDictDiscussion
Returns a dictionary of the row results
Warning: Deprecated: Please use resultDictionary instead. Also, beware that resultDictionary is case sensitive!
See Also
Declared In
FMResultSet.h
Key value coding magic
– kvcMagic:
Performs setValue to yield support for key value observing.
- (void)kvcMagic:(id)objectParameters
object |
The object for which the values will be set. This is the key-value-coding compliant object that you might, for example, observe. |
|---|
Discussion
Performs setValue to yield support for key value observing.
Declared In
FMResultSet.h