PageRenderTime 304ms CodeModel.GetById 131ms app.highlight 9ms RepoModel.GetById 162ms app.codeStats 0ms

/fmdb/FMDatabase.h

http://github.com/petewarden/iPhoneTracker
C Header | 118 lines | 82 code | 35 blank | 1 comment | 0 complexity | f256a872ca3249a3af9811a0a70ec968 MD5 | raw file
  1#import <Foundation/Foundation.h>
  2#import "sqlite3.h"
  3#import "FMResultSet.h"
  4
  5@interface FMDatabase : NSObject 
  6{
  7	sqlite3*    db;
  8	NSString*   databasePath;
  9    BOOL        logsErrors;
 10    BOOL        crashOnErrors;
 11    BOOL        inUse;
 12    BOOL        inTransaction;
 13    BOOL        traceExecution;
 14    BOOL        checkedOut;
 15    int         busyRetryTimeout;
 16    BOOL        shouldCacheStatements;
 17    NSMutableDictionary *cachedStatements;
 18	NSMutableSet *openResultSets;
 19}
 20
 21
 22+ (id)databaseWithPath:(NSString*)inPath;
 23- (id)initWithPath:(NSString*)inPath;
 24
 25- (BOOL)open;
 26#if SQLITE_VERSION_NUMBER >= 3005000
 27- (BOOL)openWithFlags:(int)flags;
 28#endif
 29- (BOOL)close;
 30- (BOOL)goodConnection;
 31- (void)clearCachedStatements;
 32- (void)closeOpenResultSets;
 33
 34// encryption methods.  You need to have purchased the sqlite encryption extensions for these to work.
 35- (BOOL)setKey:(NSString*)key;
 36- (BOOL)rekey:(NSString*)key;
 37
 38
 39- (NSString *)databasePath;
 40
 41- (NSString*)lastErrorMessage;
 42
 43- (int)lastErrorCode;
 44- (BOOL)hadError;
 45- (sqlite_int64)lastInsertRowId;
 46
 47- (sqlite3*)sqliteHandle;
 48
 49- (BOOL)update:(NSString*)sql error:(NSError**)outErr bind:(id)bindArgs, ...;
 50- (BOOL)executeUpdate:(NSString*)sql, ...;
 51- (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray *)arguments;
 52- (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArray:(NSArray*)arrayArgs orVAList:(va_list)args; // you shouldn't ever need to call this.  use the previous two instead.
 53
 54- (FMResultSet *)executeQuery:(NSString*)sql, ...;
 55- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments;
 56- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orVAList:(va_list)args; // you shouldn't ever need to call this.  use the previous two instead.
 57
 58- (BOOL)rollback;
 59- (BOOL)commit;
 60- (BOOL)beginTransaction;
 61- (BOOL)beginDeferredTransaction;
 62
 63- (BOOL)logsErrors;
 64- (void)setLogsErrors:(BOOL)flag;
 65
 66- (BOOL)crashOnErrors;
 67- (void)setCrashOnErrors:(BOOL)flag;
 68
 69- (BOOL)inUse;
 70- (void)setInUse:(BOOL)value;
 71
 72- (BOOL)inTransaction;
 73- (void)setInTransaction:(BOOL)flag;
 74
 75- (BOOL)traceExecution;
 76- (void)setTraceExecution:(BOOL)flag;
 77
 78- (BOOL)checkedOut;
 79- (void)setCheckedOut:(BOOL)flag;
 80
 81- (int)busyRetryTimeout;
 82- (void)setBusyRetryTimeout:(int)newBusyRetryTimeout;
 83
 84- (BOOL)shouldCacheStatements;
 85- (void)setShouldCacheStatements:(BOOL)value;
 86
 87- (NSMutableDictionary *)cachedStatements;
 88- (void)setCachedStatements:(NSMutableDictionary *)value;
 89
 90
 91+ (NSString*)sqliteLibVersion;
 92
 93- (int)changes;
 94
 95@end
 96
 97@interface FMStatement : NSObject {
 98    sqlite3_stmt *statement;
 99    NSString *query;
100    long useCount;
101}
102
103
104- (void)close;
105- (void)reset;
106
107- (sqlite3_stmt *)statement;
108- (void)setStatement:(sqlite3_stmt *)value;
109
110- (NSString *)query;
111- (void)setQuery:(NSString *)value;
112
113- (long)useCount;
114- (void)setUseCount:(long)value;
115
116
117@end
118