Permalink
Browse files

Deprecated columnExists:columnName: in favor of columnExists:inTableW…

…ithName:
  • Loading branch information...
1 parent 9c749a9 commit eef884233feea36e93b1f0cc2e5cc33a2bd43fc2 @ccgus committed May 25, 2012
Showing with 18 additions and 7 deletions.
  1. +4 −1 CHANGES_AND_TODO_LIST.txt
  2. +5 −1 src/FMDatabaseAdditions.h
  3. +6 −3 src/FMDatabaseAdditions.m
  4. +3 −2 src/fmdb.m
@@ -3,7 +3,10 @@ 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.
-
+2012.05.25:
+ Deprecated columnExists:columnName: in favor of columnExists:inTableWithName:
+ Remembered to update the changes notes. I've been forgetting to do this recently.
+
2012.03.22:
Deprecated resultDict and replaced it with resultDictionary on FMResultSet. Slight change in behavior as well- resultDictionary will return case sensitive keys.
Fixed a problem with getTableSchema: not working with table names that start with a number.
@@ -26,8 +26,12 @@
- (BOOL)tableExists:(NSString*)tableName;
- (FMResultSet*)getSchema;
- (FMResultSet*)getTableSchema:(NSString*)tableName;
-- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName;
+
+- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName;
- (BOOL)validateSQL:(NSString*)sql error:(NSError**)error;
+// deprecated - use columnExists:inTableWithName: instead.
+- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated));
+
@end
@@ -94,8 +94,7 @@ - (FMResultSet*)getTableSchema:(NSString*)tableName {
return rs;
}
-
-- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName {
+- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName {
BOOL returnBool = NO;
@@ -106,7 +105,7 @@ - (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName {
//check if column is present in table schema
while ([rs next]) {
- if ([[[rs stringForColumn:@"name"] lowercaseString] isEqualToString: columnName]) {
+ if ([[[rs stringForColumn:@"name"] lowercaseString] isEqualToString:columnName]) {
returnBool = YES;
break;
}
@@ -118,6 +117,10 @@ - (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName {
return returnBool;
}
+- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)) {
+ return [self columnExists:columnName inTableWithName:tableName];
+}
+
- (BOOL)validateSQL:(NSString*)sql error:(NSError**)error {
sqlite3_stmt *pStmt = NULL;
BOOL validationSucceeded = YES;
View
@@ -345,8 +345,9 @@ int main (int argc, const char * argv[]) {
}
-
-
+ FMDBQuickCheck([db columnExists:@"a" inTableWithName:@"nulltest"]);
+ FMDBQuickCheck([db columnExists:@"b" inTableWithName:@"nulltest"]);
+ FMDBQuickCheck(![db columnExists:@"c" inTableWithName:@"nulltest"]);
// null dates

0 comments on commit eef8842

Please sign in to comment.