This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add native currency to account cells #36
- Loading branch information
1 parent
f350932
commit 53e35b3
Showing
11 changed files
with
207 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// FMDatabasePoolAdditions.h | ||
// iSub | ||
// | ||
// Created by Benjamin Baron on 3/9/16. | ||
// Copyright (c) 2016 Ben Baron. All rights reserved. | ||
// | ||
|
||
#import "FMDB.h" | ||
|
||
@interface FMDatabasePool (Additions) | ||
|
||
- (int)intForQuery:(NSString*)query, ...; | ||
- (long)longForQuery:(NSString*)query, ...; | ||
- (BOOL)boolForQuery:(NSString*)query, ...; | ||
- (double)doubleForQuery:(NSString*)query, ...; | ||
- (NSString*)stringForQuery:(NSString*)query, ...; | ||
- (NSData*)dataForQuery:(NSString*)query, ...; | ||
- (NSDate*)dateForQuery:(NSString*)query, ...; | ||
|
||
- (BOOL)tableExists:(NSString*)tableName; | ||
- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// | ||
// FMDatabasePoolAdditions.m | ||
// iSub | ||
// | ||
// Created by Benjamin Baron on 3/9/16. | ||
// Copyright (c) 2016 Ben Baron. All rights reserved. | ||
// | ||
|
||
#import "FMDatabasePoolAdditions.h" | ||
#import "FMDatabase.h" | ||
#import "FMDatabaseAdditions.h" | ||
|
||
@interface FMDatabase (PrivateStuff) | ||
- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args; | ||
@end | ||
|
||
@implementation FMDatabasePool (Additions) | ||
|
||
#define RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(type, sel) \ | ||
va_list args; \ | ||
va_start(args, query); \ | ||
__block va_list *args_ptr = &args; \ | ||
__block type ret; \ | ||
[self inDatabase:^(FMDatabase *db) { \ | ||
FMResultSet *resultSet = [db executeQuery:query withArgumentsInArray:nil orDictionary:nil orVAList:*args_ptr]; \ | ||
ret = [resultSet next] ? [resultSet sel:0] : (type)0; \ | ||
[resultSet close]; \ | ||
[resultSet setParentDB:nil]; \ | ||
}]; \ | ||
va_end(args); \ | ||
return ret; | ||
|
||
- (NSString*)stringForQuery:(NSString*)query, ... | ||
{ | ||
RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSString *, stringForColumnIndex); | ||
} | ||
|
||
- (int)intForQuery:(NSString*)query, ... | ||
{ | ||
RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(int, intForColumnIndex); | ||
} | ||
|
||
- (long)longForQuery:(NSString*)query, ... | ||
{ | ||
RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(long, longForColumnIndex); | ||
} | ||
|
||
- (BOOL)boolForQuery:(NSString*)query, ... | ||
{ | ||
RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(BOOL, boolForColumnIndex); | ||
} | ||
|
||
- (double)doubleForQuery:(NSString*)query, ... | ||
{ | ||
RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(double, doubleForColumnIndex); | ||
} | ||
|
||
- (NSData*)dataForQuery:(NSString*)query, ... | ||
{ | ||
RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSData *, dataForColumnIndex); | ||
} | ||
|
||
- (NSDate*)dateForQuery:(NSString*)query, ... | ||
{ | ||
RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSDate *, dateForColumnIndex); | ||
} | ||
|
||
- (BOOL)tableExists:(NSString*)tableName | ||
{ | ||
__block BOOL exists; | ||
[self inDatabase:^(FMDatabase *db) { | ||
exists = [db tableExists:tableName]; | ||
}]; | ||
return exists; | ||
} | ||
|
||
- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName | ||
{ | ||
__block BOOL exists; | ||
[self inDatabase:^(FMDatabase *db) { | ||
exists = [db columnExists:columnName inTableWithName:tableName]; | ||
}]; | ||
return exists; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters