From 78d42e14845d511bc1e240b79e0ce4938f35b130 Mon Sep 17 00:00:00 2001 From: gusmueller Date: Mon, 15 Dec 2008 00:35:32 +0000 Subject: [PATCH] Added some new functions to FMResultSet to get out long long int's. git-svn-id: http://flycode.googlecode.com/svn/trunk/fmdb@55 abbd6b28-202a-0410-9014-d760cfba9e85 --- CHANGES_AND_TODO_LIST.txt | 7 +++++-- CONTRIBUTORS.txt | 6 +++++- src/FMResultSet.h | 3 +++ src/FMResultSet.m | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGES_AND_TODO_LIST.txt b/CHANGES_AND_TODO_LIST.txt index 2af5a1f..cbbc84c 100644 --- a/CHANGES_AND_TODO_LIST.txt +++ b/CHANGES_AND_TODO_LIST.txt @@ -1,7 +1,10 @@ TODO: -A connection manager, so you can checkout and hit the same db over different threads. Although I guess the latest versions of sqlite can be compiled as thread safe.. +Zip, nada, zilch. Got any ideas? -2008.20.02 +2008.12.14 +Added longLongIntForColumn: and longLongIntForColumnIndex: to FMResultSet. (patch provided by Will Cosgrove) + +2008.11.20 Added a check for NSNull in bindObject, which works just like passing nil does (patch provded by Robert Tolar Haining) 2008.11.02 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 8142584..51293a0 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -9,4 +9,8 @@ Daniel Pasco Bil Moorehead Sam Steele Brian Stern -Robert Tolar Haining \ No newline at end of file +Robert Tolar Haining +Will Cosgrove + + +Aaaaannnd, Gus Mueller (that's me!) \ No newline at end of file diff --git a/src/FMResultSet.h b/src/FMResultSet.h index e3f7e64..08e8dbf 100644 --- a/src/FMResultSet.h +++ b/src/FMResultSet.h @@ -34,6 +34,9 @@ - (long) longForColumn:(NSString*)columnName; - (long) longForColumnIndex:(int)columnIdx; +- (long long int) longLongIntForColumn:(NSString*)columnName; +- (long long int) longLongIntForColumnIndex:(int)columnIdx; + - (BOOL) boolForColumn:(NSString*)columnName; - (BOOL) boolForColumnIndex:(int)columnIdx; diff --git a/src/FMResultSet.m b/src/FMResultSet.m index ce6da77..8f37f79 100644 --- a/src/FMResultSet.m +++ b/src/FMResultSet.m @@ -186,6 +186,25 @@ return (long)sqlite3_column_int64(statement.statement, columnIdx); } +- (long long int) longLongIntForColumn:(NSString*)columnName { + + if (!columnNamesSetup) { + [self setupColumnNames]; + } + + int columnIdx = [self columnIndexForName:columnName]; + + if (columnIdx == -1) { + return 0; + } + + return sqlite3_column_int64(statement.statement, columnIdx); +} + +- (long long int) longLongIntForColumnIndex:(int)columnIdx { + return sqlite3_column_int64(statement.statement, columnIdx); +} + - (BOOL) boolForColumn:(NSString*)columnName { return ([self intForColumn:columnName] != 0); } -- 2.11.4.GIT