FMResultSet Class Reference
| Inherits from | NSObject |
| Declared in | FMResultSet.h FMResultSet.m |
Tasks
Properties
-
queryExecuted query
property -
columnNameToIndexMap
propertyNSMutableDictionarymapping column names to numeric index -
statement
propertyFMStatementused by result set.
Creating and closing database
-
+ resultSetWithStatement:usingParentDatabase:Create result set from
FMStatement -
– closeClose result set
Iterating through the result set
-
– nextRetrieve next row for result set.
-
– hasAnotherRowDid the last call to
nextsucceed in retrieving another row?
Retrieving information from result set
-
– columnCountHow many columns in result set
-
– columnIndexForName:Column index for column name
-
– columnNameForIndex:Column name for column index
-
– intForColumn:Result set integer value for column.
-
– intForColumnIndex:Result set integer value for column.
-
– longForColumn:Result set
longvalue for column. -
– longForColumnIndex:Result set long value for column.
-
– longLongIntForColumn:Result set
long long intvalue for column. -
– longLongIntForColumnIndex:Result set
long long intvalue for column. -
– unsignedLongLongIntForColumn:Result set
unsigned long long intvalue for column. -
– unsignedLongLongIntForColumnIndex:Result set
unsigned long long intvalue for column. -
– boolForColumn:Result set
BOOLvalue for column. -
– boolForColumnIndex:Result set
BOOLvalue for column. -
– doubleForColumn:Result set
doublevalue for column. -
– doubleForColumnIndex:Result set
doublevalue for column. -
– stringForColumn:Result set
NSStringvalue for column. -
– stringForColumnIndex:Result set
NSStringvalue for column. -
– dateForColumn:Result set
NSDatevalue for column. -
– dateForColumnIndex:Result set
NSDatevalue for column. -
– dataForColumn:Result set
NSDatavalue for column. -
– dataForColumnIndex:Result set
NSDatavalue for column. -
– UTF8StringForColumnName:Result set
(const unsigned char *)value for column. -
– UTF8StringForColumnIndex:Result set
(const unsigned char *)value for column. -
– objectForColumnName:Result set object for column.
-
– objectForColumnIndex:Result set object for column.
-
– objectForKeyedSubscript:Result set object for column.
-
– objectAtIndexedSubscript:Result set object for column.
-
– dataNoCopyForColumn:Result set
NSDatavalue for column. -
– dataNoCopyForColumnIndex:Result set
NSDatavalue for column. -
– columnIndexIsNull:Is the column
NULL? -
– columnIsNull:Is the column
NULL? -
– resultDictionaryReturns a dictionary of the row results mapped to case sensitive keys of the column names.
-
– resultDictReturns a dictionary of the row results
Key value coding magic
-
– kvcMagic:Performs
setValueto yield support for key value observing.
Properties
Class Methods
resultSetWithStatement:usingParentDatabase:
Create result set from FMStatement
+ (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase *)aDBReturn Value
A FMResultSet on success; nil on failure
Declared In
FMResultSet.hInstance Methods
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.
Declared In
FMResultSet.hUTF8StringForColumnName:
Result set (const unsigned char *) value for column.
- (const unsigned char *)UTF8StringForColumnName:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
(const unsigned char *) value of the result set’s column.
Declared In
FMResultSet.hboolForColumn:
Result set BOOL value for column.
- (BOOL)boolForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
BOOL value of the result set’s column.
Declared In
FMResultSet.hboolForColumnIndex:
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.
Declared In
FMResultSet.hcolumnCount
How many columns in result set
- (int)columnCountReturn Value
Integer value of the number of columns.
Declared In
FMResultSet.hcolumnIndexForName:
Column index for column name
- (int)columnIndexForName:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
Zero-based index for column.
Declared In
FMResultSet.hcolumnIndexIsNull:
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.
Declared In
FMResultSet.hcolumnIsNull:
Is the column NULL?
- (BOOL)columnIsNull:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
YES if column is NULL; NO if not NULL.
Declared In
FMResultSet.hcolumnNameForIndex:
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.
Declared In
FMResultSet.hdataForColumn:
Result set NSData value for column.
- (NSData *)dataForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
NSData value of the result set’s column.
Discussion
This is useful when storing binary data in table (such as image or the like).
Declared In
FMResultSet.hdataForColumnIndex:
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.
Declared In
FMResultSet.hdataNoCopyForColumn:
Result set NSData value for column.
- (NSData *)dataNoCopyForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
NSData value of the result set’s column.
Discussion
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.hdataNoCopyForColumnIndex:
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
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.hdateForColumn:
Result set NSDate value for column.
- (NSDate *)dateForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
NSDate value of the result set’s column.
Declared In
FMResultSet.hdateForColumnIndex:
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.
Declared In
FMResultSet.hdoubleForColumn:
Result set double value for column.
- (double)doubleForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
double value of the result set’s column.
Declared In
FMResultSet.hdoubleForColumnIndex:
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.
Declared In
FMResultSet.hhasAnotherRow
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
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.hintForColumn:
Result set integer value for column.
- (int)intForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
int value of the result set’s column.
Declared In
FMResultSet.hintForColumnIndex:
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.
Declared In
FMResultSet.hkvcMagic:
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.
Declared In
FMResultSet.hlongForColumn:
Result set long value for column.
- (long)longForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
long value of the result set’s column.
Declared In
FMResultSet.hlongForColumnIndex:
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.
Declared In
FMResultSet.hlongLongIntForColumn:
Result set long long int value for column.
- (long long int)longLongIntForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
long long int value of the result set’s column.
Declared In
FMResultSet.hlongLongIntForColumnIndex:
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.
Declared In
FMResultSet.hnext
Retrieve next row for result set.
- (BOOL)nextReturn Value
YES if row successfully retrieved; NO if end of result set reached
Discussion
You must always invoke next before attempting to access the values returned in a query, even if you’re only expecting one.
See Also
Declared In
FMResultSet.hobjectAtIndexedSubscript:
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
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.hobjectForColumnIndex:
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.
See Also
Declared In
FMResultSet.hobjectForColumnName:
Result set object for column.
- (id)objectForColumnName:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
Either NSNumber, NSString, NSData, or NSNull. If the column was NULL, this returns [NSNull null] object.
See Also
Declared In
FMResultSet.hobjectForKeyedSubscript:
Result set object for column.
- (id)objectForKeyedSubscript:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
Either NSNumber, NSString, NSData, or NSNull. If the column was NULL, this returns [NSNull null] object.
Discussion
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.hresultDict
Returns a dictionary of the row results
- (NSDictionary *)resultDictDiscussion
Warning: Deprecated: Please use resultDictionary instead. Also, beware that resultDictionary is case sensitive!
See Also
Declared In
FMResultSet.hresultDictionary
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
Warning: The keys to the dictionary are case sensitive of the column names.
Declared In
FMResultSet.hstringForColumn:
Result set NSString value for column.
- (NSString *)stringForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
NSString value of the result set’s column.
Declared In
FMResultSet.hstringForColumnIndex:
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.
Declared In
FMResultSet.hunsignedLongLongIntForColumn:
Result set unsigned long long int value for column.
- (unsigned long long int)unsignedLongLongIntForColumn:(NSString *)columnNameParameters
- columnName
NSStringvalue of the name of the column.
Return Value
unsigned long long int value of the result set’s column.
Declared In
FMResultSet.hunsignedLongLongIntForColumnIndex:
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.
Declared In
FMResultSet.h