PageRenderTime 36ms CodeModel.GetById 16ms app.highlight 14ms RepoModel.GetById 2ms app.codeStats 0ms

/fmdb/FMResultSet.h

http://github.com/petewarden/iPhoneTracker
C Header | 93 lines | 59 code | 28 blank | 6 comment | 0 complexity | d846649be502cc0aff0e4b8007c3498f MD5 | raw file
 1#import <Foundation/Foundation.h>
 2#import "sqlite3.h"
 3
 4#ifndef __has_feature      // Optional.
 5#define __has_feature(x) 0 // Compatibility with non-clang compilers.
 6#endif
 7
 8#ifndef NS_RETURNS_NOT_RETAINED
 9#if __has_feature(attribute_ns_returns_not_retained)
10#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
11#else
12#define NS_RETURNS_NOT_RETAINED
13#endif
14#endif
15
16@class FMDatabase;
17@class FMStatement;
18
19@interface FMResultSet : NSObject {
20    FMDatabase *parentDB;
21    FMStatement *statement;
22    
23    NSString *query;
24    NSMutableDictionary *columnNameToIndexMap;
25    BOOL columnNamesSetup;
26}
27
28
29+ (id)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB;
30
31- (void)close;
32
33- (NSString *)query;
34- (void)setQuery:(NSString *)value;
35
36- (FMStatement *)statement;
37- (void)setStatement:(FMStatement *)value;
38
39- (void)setParentDB:(FMDatabase *)newDb;
40
41- (BOOL)next;
42- (BOOL)hasAnotherRow;
43
44- (int)columnIndexForName:(NSString*)columnName;
45- (NSString*)columnNameForIndex:(int)columnIdx;
46
47- (int)intForColumn:(NSString*)columnName;
48- (int)intForColumnIndex:(int)columnIdx;
49
50- (long)longForColumn:(NSString*)columnName;
51- (long)longForColumnIndex:(int)columnIdx;
52
53- (long long int)longLongIntForColumn:(NSString*)columnName;
54- (long long int)longLongIntForColumnIndex:(int)columnIdx;
55
56- (BOOL)boolForColumn:(NSString*)columnName;
57- (BOOL)boolForColumnIndex:(int)columnIdx;
58
59- (double)doubleForColumn:(NSString*)columnName;
60- (double)doubleForColumnIndex:(int)columnIdx;
61
62- (NSString*)stringForColumn:(NSString*)columnName;
63- (NSString*)stringForColumnIndex:(int)columnIdx;
64
65- (NSDate*)dateForColumn:(NSString*)columnName;
66- (NSDate*)dateForColumnIndex:(int)columnIdx;
67
68- (NSData*)dataForColumn:(NSString*)columnName;
69- (NSData*)dataForColumnIndex:(int)columnIdx;
70
71- (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdx;
72- (const unsigned char *)UTF8StringForColumnName:(NSString*)columnName;
73
74// returns one of NSNumber, NSString, NSData, or NSNull
75- (id)objectForColumnIndex:(int)columnIdx;
76- (id)objectForColumnName:(NSString*)columnName;
77
78/*
79If you are going to use this data after you iterate over the next row, or after you close the
80result set, make sure to make a copy of the data first (or just use dataForColumn:/dataForColumnIndex:)
81If you don't, you're going to be in a world of hurt when you try and use the data.
82*/
83- (NSData*)dataNoCopyForColumn:(NSString*)columnName NS_RETURNS_NOT_RETAINED;
84- (NSData*)dataNoCopyForColumnIndex:(int)columnIdx NS_RETURNS_NOT_RETAINED;
85
86
87- (BOOL)columnIndexIsNull:(int)columnIdx;
88- (BOOL)columnIsNull:(NSString*)columnName;
89
90- (void)kvcMagic:(id)object;
91- (NSDictionary *)resultDict;
92
93@end