Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed some methods to properties. Hello 2011.

  • Loading branch information...
commit c9c26372005817ce8f374f54df39597286500fbe 1 parent a43c195
@ccgus ccgus authored
View
3  CHANGES_AND_TODO_LIST.txt
@@ -3,6 +3,9 @@ Zip, nada, zilch. Got any ideas?
If you would like to contribute some code- awesome! I just ask that you make it conform to the coding conventions already set in here, and to add a couple of tests for your new code to fmdb.m. And of course, the code should be of general use to more than just a couple of folks. Send your patches to gus@flyingmeat.com.
+2011.06.22
+ Changed some methods to properties. Hello 2011.
+
2011.04.09
Added a method to validate a SQL statement.
Added a method to retrieve the number of columns in a result set.
View
42 src/FMDatabase.h
@@ -19,6 +19,15 @@
}
+@property (assign) BOOL inTransaction;
+@property (assign) BOOL traceExecution;
+@property (assign) BOOL checkedOut;
+@property (assign) int busyRetryTimeout;
+@property (assign) BOOL crashOnErrors;
+@property (assign) BOOL logsErrors;
+@property (retain) NSMutableDictionary *cachedStatements;
+
+
+ (id)databaseWithPath:(NSString*)inPath;
- (id)initWithPath:(NSString*)inPath;
@@ -62,33 +71,13 @@
- (BOOL)beginTransaction;
- (BOOL)beginDeferredTransaction;
-- (BOOL)logsErrors;
-- (void)setLogsErrors:(BOOL)flag;
-
-- (BOOL)crashOnErrors;
-- (void)setCrashOnErrors:(BOOL)flag;
-
- (BOOL)inUse;
- (void)setInUse:(BOOL)value;
-- (BOOL)inTransaction;
-- (void)setInTransaction:(BOOL)flag;
-
-- (BOOL)traceExecution;
-- (void)setTraceExecution:(BOOL)flag;
-
-- (BOOL)checkedOut;
-- (void)setCheckedOut:(BOOL)flag;
-
-- (int)busyRetryTimeout;
-- (void)setBusyRetryTimeout:(int)newBusyRetryTimeout;
- (BOOL)shouldCacheStatements;
- (void)setShouldCacheStatements:(BOOL)value;
-- (NSMutableDictionary *)cachedStatements;
-- (void)setCachedStatements:(NSMutableDictionary *)value;
-
+ (NSString*)sqliteLibVersion;
@@ -102,19 +91,12 @@
long useCount;
}
+@property (assign) long useCount;
+@property (retain) NSString *query;
+@property (assign) sqlite3_stmt *statement;
- (void)close;
- (void)reset;
-- (sqlite3_stmt *)statement;
-- (void)setStatement:(sqlite3_stmt *)value;
-
-- (NSString *)query;
-- (void)setQuery:(NSString *)value;
-
-- (long)useCount;
-- (void)setUseCount:(long)value;
-
-
@end
View
92 src/FMDatabase.m
@@ -2,6 +2,13 @@
#import "unistd.h"
@implementation FMDatabase
+@synthesize inTransaction;
+@synthesize cachedStatements;
+@synthesize logsErrors;
+@synthesize crashOnErrors;
+@synthesize busyRetryTimeout;
+@synthesize checkedOut;
+@synthesize traceExecution;
+ (id)databaseWithPath:(NSString*)aPath {
return [[[self alloc] initWithPath:aPath] autorelease];
@@ -798,19 +805,7 @@ - (BOOL)beginTransaction {
return b;
}
-- (BOOL)logsErrors {
- return logsErrors;
-}
-- (void)setLogsErrors:(BOOL)flag {
- logsErrors = flag;
-}
-- (BOOL)crashOnErrors {
- return crashOnErrors;
-}
-- (void)setCrashOnErrors:(BOOL)flag {
- crashOnErrors = flag;
-}
- (BOOL)inUse {
return inUse || inTransaction;
@@ -820,35 +815,6 @@ - (void)setInUse:(BOOL)b {
inUse = b;
}
-- (BOOL)inTransaction {
- return inTransaction;
-}
-- (void)setInTransaction:(BOOL)flag {
- inTransaction = flag;
-}
-
-- (BOOL)traceExecution {
- return traceExecution;
-}
-- (void)setTraceExecution:(BOOL)flag {
- traceExecution = flag;
-}
-
-- (BOOL)checkedOut {
- return checkedOut;
-}
-- (void)setCheckedOut:(BOOL)flag {
- checkedOut = flag;
-}
-
-
-- (int)busyRetryTimeout {
- return busyRetryTimeout;
-}
-- (void)setBusyRetryTimeout:(int)newBusyRetryTimeout {
- busyRetryTimeout = newBusyRetryTimeout;
-}
-
- (BOOL)shouldCacheStatements {
return shouldCacheStatements;
@@ -867,23 +833,15 @@ - (void)setShouldCacheStatements:(BOOL)value {
}
}
-- (NSMutableDictionary *)cachedStatements {
- return cachedStatements;
-}
-
-- (void)setCachedStatements:(NSMutableDictionary *)value {
- if (cachedStatements != value) {
- [cachedStatements release];
- cachedStatements = [value retain];
- }
-}
-
@end
@implementation FMStatement
+@synthesize statement;
+@synthesize query;
+@synthesize useCount;
- (void)finalize {
[self close];
@@ -896,7 +854,6 @@ - (void)dealloc {
[super dealloc];
}
-
- (void)close {
if (statement) {
sqlite3_finalize(statement);
@@ -910,35 +867,6 @@ - (void)reset {
}
}
-- (sqlite3_stmt *)statement {
- return statement;
-}
-
-- (void)setStatement:(sqlite3_stmt *)value {
- statement = value;
-}
-
-- (NSString *)query {
- return query;
-}
-
-- (void)setQuery:(NSString *)value {
- if (query != value) {
- [query release];
- query = [value retain];
- }
-}
-
-- (long)useCount {
- return useCount;
-}
-
-- (void)setUseCount:(long)value {
- if (useCount != value) {
- useCount = value;
- }
-}
-
- (NSString*)description {
return [NSString stringWithFormat:@"%@ %d hit(s) for query %@", [super description], useCount, query];
}
View
5 src/FMResultSet.h
@@ -25,13 +25,14 @@
BOOL columnNamesSetup;
}
+@property (retain) NSString *query;
+@property (retain) NSMutableDictionary *columnNameToIndexMap;
+@property (retain) FMStatement *statement;
+ (id)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB;
- (void)close;
-- (NSString *)query;
-- (void)setQuery:(NSString *)value;
- (FMStatement *)statement;
- (void)setStatement:(FMStatement *)value;
View
36 src/FMResultSet.m
@@ -13,6 +13,9 @@ - (void)setColumnNameToIndexMap:(NSMutableDictionary *)value;
@end
@implementation FMResultSet
+@synthesize query;
+@synthesize columnNameToIndexMap;
+@synthesize statement;
+ (id)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB {
@@ -372,37 +375,4 @@ - (void)setParentDB:(FMDatabase *)newDb {
}
-- (NSString *)query {
- return query;
-}
-
-- (void)setQuery:(NSString *)value {
- [value retain];
- [query release];
- query = value;
-}
-
-- (NSMutableDictionary *)columnNameToIndexMap {
- return columnNameToIndexMap;
-}
-
-- (void)setColumnNameToIndexMap:(NSMutableDictionary *)value {
- [value retain];
- [columnNameToIndexMap release];
- columnNameToIndexMap = value;
-}
-
-- (FMStatement *)statement {
- return statement;
-}
-
-- (void)setStatement:(FMStatement *)value {
- if (statement != value) {
- [statement release];
- statement = [value retain];
- }
-}
-
-
-
@end
Please sign in to comment.
Something went wrong with that request. Please try again.