AWSFMResultSet
Objective-C
@interface AWSFMResultSet : NSObject {
AWSFMDatabase *_parentDB;
AWSFMStatement *_statement;
NSString *_query;
NSMutableDictionary *_columnNameToIndexMap;
}
Swift
class AWSFMResultSet : NSObject
Represents the results of executing a query on an <FMDatabase>.
### See also
<FMDatabase>
-
Undocumented
Declaration
Objective-C
AWSFMDatabase *_parentDB -
Undocumented
Declaration
Objective-C
AWSFMStatement *_statement -
Undocumented
Declaration
Objective-C
NSString *_query -
Undocumented
Declaration
Objective-C
NSMutableDictionary *_columnNameToIndexMap
-
Executed query
Declaration
Objective-C
@property (retain) NSString *query;Swift
var query: String! { get set } -
NSMutableDictionarymapping column names to numeric indexDeclaration
Objective-C
@property (readonly) NSMutableDictionary *columnNameToIndexMap;Swift
var columnNameToIndexMap: NSMutableDictionary! { get } -
FMStatementused by result set.Declaration
Objective-C
@property (retain) AWSFMStatement *statement;Swift
var statement: AWSFMStatement! { get set }
-
Create result set from
<FMStatement>Declaration
Objective-C
+ (instancetype)resultSetWithStatement:(AWSFMStatement *)statement usingParentDatabase:(AWSFMDatabase *)aDB;Swift
convenience init!(statement: AWSFMStatement!, usingParentDatabase aDB: AWSFMDatabase!)Parameters
statementA
<FMStatement>to be performedaDBA
<FMDatabase>to be usedReturn Value
A
FMResultSeton success;nilon failure -
Close result set
Declaration
Objective-C
- (void)close;Swift
func close() -
Undocumented
Declaration
Objective-C
- (void)setParentDB:(AWSFMDatabase *)newDb;Swift
func setParentDB(_ newDb: AWSFMDatabase!)
-
Retrieve next row for result set.
You must always invoke
nextornextWithErrorbefore attempting to access the values returned in a query, even if you’re only expecting one.See
hasAnotherRow
Declaration
Objective-C
- (BOOL)next;Swift
func next() -> BoolReturn Value
YESif row successfully retrieved;NOif end of result set reached -
Retrieve next row for result set.
You must always invoke
nextornextWithErrorbefore attempting to access the values returned in a query, even if you’re only expecting one.See
hasAnotherRow
Declaration
Objective-C
- (BOOL)nextWithError:(NSError **)outErr;Swift
func nextWithError() throwsParameters
outErrA ‘NSError’ object to receive any error object (if any).
Return Value
‘YES’ if row successfully retrieved; ‘NO’ if end of result set reached
-
Did the last call to
<next>succeed in retrieving another row?See
next
Warning
The
hasAnotherRowmethod must follow a call to<next>. If the previous database interaction was something other than a call tonext, then this method may returnNO, whether there is another row of data or not.Declaration
Objective-C
- (BOOL)hasAnotherRow;Swift
func hasAnotherRow() -> BoolReturn Value
YESif the last call to<next>succeeded in retrieving another record;NOif not.
-
How many columns in result set
Declaration
Objective-C
- (int)columnCount;Swift
func columnCount() -> Int32Return Value
Integer value of the number of columns.
-
Column index for column name
Declaration
Objective-C
- (int)columnIndexForName:(NSString *)columnName;Swift
func columnIndex(forName columnName: String!) -> Int32Parameters
columnNameNSStringvalue of the name of the column.Return Value
Zero-based index for column.
-
Column name for column index
Declaration
Objective-C
- (NSString *)columnNameForIndex:(int)columnIdx;Swift
func columnName(for columnIdx: Int32) -> String!Parameters
columnIdxZero-based index for column.
Return Value
columnName
NSStringvalue of the name of the column. -
Result set integer value for column.
Declaration
Objective-C
- (int)intForColumn:(NSString *)columnName;Swift
func int(forColumn columnName: String!) -> Int32Parameters
columnNameNSStringvalue of the name of the column.Return Value
intvalue of the result set’s column. -
Result set integer value for column.
Declaration
Objective-C
- (int)intForColumnIndex:(int)columnIdx;Swift
func int(forColumnIndex columnIdx: Int32) -> Int32Parameters
columnIdxZero-based index for column.
Return Value
intvalue of the result set’s column. -
Result set
longvalue for column.Declaration
Objective-C
- (long)longForColumn:(NSString *)columnName;Swift
func long(forColumn columnName: String!) -> IntParameters
columnNameNSStringvalue of the name of the column.Return Value
longvalue of the result set’s column. -
Result set long value for column.
Declaration
Objective-C
- (long)longForColumnIndex:(int)columnIdx;Swift
func long(forColumnIndex columnIdx: Int32) -> IntParameters
columnIdxZero-based index for column.
Return Value
longvalue of the result set’s column. -
Result set
long long intvalue for column.Declaration
Objective-C
- (long long)longLongIntForColumn:(NSString *)columnName;Swift
func longLongInt(forColumn columnName: String!) -> Int64Parameters
columnNameNSStringvalue of the name of the column.Return Value
long long intvalue of the result set’s column. -
Result set
long long intvalue for column.Declaration
Objective-C
- (long long)longLongIntForColumnIndex:(int)columnIdx;Swift
func longLongInt(forColumnIndex columnIdx: Int32) -> Int64Parameters
columnIdxZero-based index for column.
Return Value
long long intvalue of the result set’s column. -
Result set
unsigned long long intvalue for column.Declaration
Objective-C
- (unsigned long long)unsignedLongLongIntForColumn:(NSString *)columnName;Swift
func unsignedLongLongInt(forColumn columnName: String!) -> UInt64Parameters
columnNameNSStringvalue of the name of the column.Return Value
unsigned long long intvalue of the result set’s column. -
Result set
unsigned long long intvalue for column.Declaration
Objective-C
- (unsigned long long)unsignedLongLongIntForColumnIndex:(int)columnIdx;Swift
func unsignedLongLongInt(forColumnIndex columnIdx: Int32) -> UInt64Parameters
columnIdxZero-based index for column.
Return Value
unsigned long long intvalue of the result set’s column. -
Result set
BOOLvalue for column.Declaration
Objective-C
- (BOOL)boolForColumn:(NSString *)columnName;Swift
func bool(forColumn columnName: String!) -> BoolParameters
columnNameNSStringvalue of the name of the column.Return Value
BOOLvalue of the result set’s column. -
Result set
BOOLvalue for column.Declaration
Objective-C
- (BOOL)boolForColumnIndex:(int)columnIdx;Swift
func bool(forColumnIndex columnIdx: Int32) -> BoolParameters
columnIdxZero-based index for column.
Return Value
BOOLvalue of the result set’s column. -
Result set
doublevalue for column.Declaration
Objective-C
- (double)doubleForColumn:(NSString *)columnName;Swift
func double(forColumn columnName: String!) -> DoubleParameters
columnNameNSStringvalue of the name of the column.Return Value
doublevalue of the result set’s column. -
Result set
doublevalue for column.Declaration
Objective-C
- (double)doubleForColumnIndex:(int)columnIdx;Swift
func double(forColumnIndex columnIdx: Int32) -> DoubleParameters
columnIdxZero-based index for column.
Return Value
doublevalue of the result set’s column. -
Result set
NSStringvalue for column.Declaration
Objective-C
- (NSString *)stringForColumn:(NSString *)columnName;Swift
func string(forColumn columnName: String!) -> String!Parameters
columnNameNSStringvalue of the name of the column.Return Value
NSStringvalue of the result set’s column. -
Result set
NSStringvalue for column.Declaration
Objective-C
- (NSString *)stringForColumnIndex:(int)columnIdx;Swift
func string(forColumnIndex columnIdx: Int32) -> String!Parameters
columnIdxZero-based index for column.
Return Value
NSStringvalue of the result set’s column. -
Result set
NSDatevalue for column.Declaration
Objective-C
- (NSDate *)dateForColumn:(NSString *)columnName;Swift
func date(forColumn columnName: String!) -> Date!Parameters
columnNameNSStringvalue of the name of the column.Return Value
NSDatevalue of the result set’s column. -
Result set
NSDatevalue for column.Declaration
Objective-C
- (NSDate *)dateForColumnIndex:(int)columnIdx;Swift
func date(forColumnIndex columnIdx: Int32) -> Date!Parameters
columnIdxZero-based index for column.
Return Value
NSDatevalue of the result set’s column. -
Result set
NSDatavalue for column.This is useful when storing binary data in table (such as image or the like).
Declaration
Objective-C
- (NSData *)dataForColumn:(NSString *)columnName;Swift
func data(forColumn columnName: String!) -> Data!Parameters
columnNameNSStringvalue of the name of the column.Return Value
NSDatavalue of the result set’s column. -
Result set
NSDatavalue for column.Declaration
Objective-C
- (NSData *)dataForColumnIndex:(int)columnIdx;Swift
func data(forColumnIndex columnIdx: Int32) -> Data!Parameters
columnIdxZero-based index for column.
Return Value
NSDatavalue of the result set’s column. -
Result set
(const unsigned char *)value for column.Declaration
Objective-C
- (const unsigned char *)UTF8StringForColumnName:(NSString *)columnName;Swift
func utf8String(forColumnName columnName: String!) -> UnsafePointer<UInt8>!Parameters
columnNameNSStringvalue of the name of the column.Return Value
(const unsigned char *)value of the result set’s column. -
Result set
(const unsigned char *)value for column.Declaration
Objective-C
- (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdx;Swift
func utf8String(forColumnIndex columnIdx: Int32) -> UnsafePointer<UInt8>!Parameters
columnIdxZero-based index for column.
Return Value
(const unsigned char *)value of the result set’s column. -
Result set object for column.
See
objectForKeyedSubscript:
Declaration
Objective-C
- (id)objectForColumnName:(NSString *)columnName;Swift
func object(forColumnName columnName: String!) -> Any!Parameters
columnNameNSStringvalue of the name of the column.Return Value
Either
NSNumber,NSString,NSData, orNSNull. If the column wasNULL, this returns[NSNull null]object. -
Result set object for column.
See
objectAtIndexedSubscript:
Declaration
Objective-C
- (id)objectForColumnIndex:(int)columnIdx;Swift
func object(forColumnIndex columnIdx: Int32) -> Any!Parameters
columnIdxZero-based index for column.
Return Value
Either
NSNumber,NSString,NSData, orNSNull. If the column wasNULL, this returns[NSNull null]object. -
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"];Declaration
Objective-C
- (id)objectForKeyedSubscript:(NSString *)columnName;Swift
subscript(columnName: String!) -> Any! { get }Parameters
columnNameNSStringvalue of the name of the column.Return Value
Either
NSNumber,NSString,NSData, orNSNull. If the column wasNULL, this returns[NSNull null]object. -
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];Declaration
Objective-C
- (id)objectAtIndexedSubscript:(int)columnIdx;Swift
subscript(columnIdx: Int32) -> Any! { get }Parameters
columnIdxZero-based index for column.
Return Value
Either
NSNumber,NSString,NSData, orNSNull. If the column wasNULL, this returns[NSNull null]object. -
Result set
NSDatavalue 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.Declaration
Objective-C
- (NSData *)dataNoCopyForColumn:(NSString *)columnName;Swift
func dataNoCopy(forColumn columnName: String!) -> Data!Parameters
columnNameNSStringvalue of the name of the column.Return Value
NSDatavalue of the result set’s column. -
Result set
NSDatavalue 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.Declaration
Objective-C
- (NSData *)dataNoCopyForColumnIndex:(int)columnIdx;Swift
func dataNoCopy(forColumnIndex columnIdx: Int32) -> Data!Parameters
columnIdxZero-based index for column.
Return Value
NSDatavalue of the result set’s column. -
Is the column
NULL?Declaration
Objective-C
- (BOOL)columnIndexIsNull:(int)columnIdx;Swift
func columnIndexIsNull(_ columnIdx: Int32) -> BoolParameters
columnIdxZero-based index for column.
Return Value
YESif column isNULL;NOif notNULL. -
Is the column
NULL?Declaration
Objective-C
- (BOOL)columnIsNull:(NSString *)columnName;Swift
func columnIsNull(_ columnName: String!) -> BoolParameters
columnNameNSStringvalue of the name of the column.Return Value
YESif column isNULL;NOif notNULL. -
Returns a dictionary of the row results mapped to case sensitive keys of the column names.
@returns
NSDictionaryof the row results.Warning
The keys to the dictionary are case sensitive of the column names.Declaration
Objective-C
- (NSDictionary *)resultDictionary;Swift
func resultDictionary() -> [AnyHashable : Any]! -
Deprecated
Returns a dictionary of the row results
See
resultDictionary
Warning
Deprecated: Please use
<resultDictionary>instead. Also, beware that<resultDictionary>is case sensitive!Declaration
Objective-C
- (NSDictionary *)resultDict;Swift
func resultDict() -> [AnyHashable : Any]!
-
Performs
setValueto yield support for key value observing.Declaration
Objective-C
- (void)kvcMagic:(id)object;Swift
func kvcMagic(_ object: Any!)Parameters
objectThe object for which the values will be set. This is the key-value-coding compliant object that you might, for example, observe.
View on GitHub
Install in Dash
AWSFMResultSet Class Reference