Skip to content
This repository
Browse code

Added support for unsigned long long int values.

  • Loading branch information...
commit 87748d1d66183a5fa12d2b39a37f9b325f6c642c 1 parent ba22f34
August "Gus" Mueller authored
3  src/FMDatabase.m
@@ -350,6 +350,9 @@ - (void)bindObject:(id)obj toColumn:(int)idx inStatement:(sqlite3_stmt*)pStmt {
350 350 else if (strcmp([obj objCType], @encode(long long)) == 0) {
351 351 sqlite3_bind_int64(pStmt, idx, [obj longLongValue]);
352 352 }
  353 + else if (strcmp([obj objCType], @encode(unsigned long long)) == 0) {
  354 + sqlite3_bind_int64(pStmt, idx, [obj unsignedLongLongValue]);
  355 + }
353 356 else if (strcmp([obj objCType], @encode(float)) == 0) {
354 357 sqlite3_bind_double(pStmt, idx, [obj floatValue]);
355 358 }
3  src/FMResultSet.h
@@ -52,6 +52,9 @@
52 52 - (long long int)longLongIntForColumn:(NSString*)columnName;
53 53 - (long long int)longLongIntForColumnIndex:(int)columnIdx;
54 54
  55 +- (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName;
  56 +- (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx;
  57 +
55 58 - (BOOL)boolForColumn:(NSString*)columnName;
56 59 - (BOOL)boolForColumnIndex:(int)columnIdx;
57 60
8 src/FMResultSet.m
@@ -228,6 +228,14 @@ - (long long int)longLongIntForColumnIndex:(int)columnIdx {
228 228 return sqlite3_column_int64([_statement statement], columnIdx);
229 229 }
230 230
  231 +- (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName {
  232 + return [self unsignedLongLongIntForColumnIndex:[self columnIndexForName:columnName]];
  233 +}
  234 +
  235 +- (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx {
  236 + return (unsigned long long int)[self longLongIntForColumnIndex:columnIdx];
  237 +}
  238 +
231 239 - (BOOL)boolForColumn:(NSString*)columnName {
232 240 return [self boolForColumnIndex:[self columnIndexForName:columnName]];
233 241 }
15 src/fmdb.m
@@ -117,6 +117,21 @@ int main (int argc, const char * argv[]) {
117 117 // the autorelease pool closes, so sqlite will complain about it.
118 118 [rs close];
119 119
  120 +
  121 + [db executeUpdate:@"create table ull (a integer)"];
  122 +
  123 + [db executeUpdate:@"insert into ull (a) values (?)" , [NSNumber numberWithUnsignedLongLong:ULLONG_MAX]];
  124 +
  125 + rs = [db executeQuery:@"select a from ull"];
  126 + while ([rs next]) {
  127 + unsigned long long a = [rs unsignedLongLongIntForColumnIndex:0];
  128 + unsigned long long b = [rs unsignedLongLongIntForColumn:@"a"];
  129 +
  130 + FMDBQuickCheck(a == ULLONG_MAX);
  131 + FMDBQuickCheck(b == ULLONG_MAX);
  132 + }
  133 +
  134 +
120 135 // ----------------------------------------------------------------------------------------
121 136 // blob support.
122 137 [db executeUpdate:@"create table blobTable (a text, b blob)"];

0 comments on commit 87748d1

Please sign in to comment.
Something went wrong with that request. Please try again.