Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for unsigned long long int values.

  • Loading branch information...
commit 87748d1d66183a5fa12d2b39a37f9b325f6c642c 1 parent ba22f34
@ccgus authored
View
3  src/FMDatabase.m
@@ -350,6 +350,9 @@ - (void)bindObject:(id)obj toColumn:(int)idx inStatement:(sqlite3_stmt*)pStmt {
else if (strcmp([obj objCType], @encode(long long)) == 0) {
sqlite3_bind_int64(pStmt, idx, [obj longLongValue]);
}
+ else if (strcmp([obj objCType], @encode(unsigned long long)) == 0) {
+ sqlite3_bind_int64(pStmt, idx, [obj unsignedLongLongValue]);
+ }
else if (strcmp([obj objCType], @encode(float)) == 0) {
sqlite3_bind_double(pStmt, idx, [obj floatValue]);
}
View
3  src/FMResultSet.h
@@ -52,6 +52,9 @@
- (long long int)longLongIntForColumn:(NSString*)columnName;
- (long long int)longLongIntForColumnIndex:(int)columnIdx;
+- (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName;
+- (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx;
+
- (BOOL)boolForColumn:(NSString*)columnName;
- (BOOL)boolForColumnIndex:(int)columnIdx;
View
8 src/FMResultSet.m
@@ -228,6 +228,14 @@ - (long long int)longLongIntForColumnIndex:(int)columnIdx {
return sqlite3_column_int64([_statement statement], columnIdx);
}
+- (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName {
+ return [self unsignedLongLongIntForColumnIndex:[self columnIndexForName:columnName]];
+}
+
+- (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx {
+ return (unsigned long long int)[self longLongIntForColumnIndex:columnIdx];
+}
+
- (BOOL)boolForColumn:(NSString*)columnName {
return [self boolForColumnIndex:[self columnIndexForName:columnName]];
}
View
15 src/fmdb.m
@@ -117,6 +117,21 @@ int main (int argc, const char * argv[]) {
// the autorelease pool closes, so sqlite will complain about it.
[rs close];
+
+ [db executeUpdate:@"create table ull (a integer)"];
+
+ [db executeUpdate:@"insert into ull (a) values (?)" , [NSNumber numberWithUnsignedLongLong:ULLONG_MAX]];
+
+ rs = [db executeQuery:@"select a from ull"];
+ while ([rs next]) {
+ unsigned long long a = [rs unsignedLongLongIntForColumnIndex:0];
+ unsigned long long b = [rs unsignedLongLongIntForColumn:@"a"];
+
+ FMDBQuickCheck(a == ULLONG_MAX);
+ FMDBQuickCheck(b == ULLONG_MAX);
+ }
+
+
// ----------------------------------------------------------------------------------------
// blob support.
[db executeUpdate:@"create table blobTable (a text, b blob)"];
Please sign in to comment.
Something went wrong with that request. Please try again.