Browse Source

Fixing some conflicts.

August Mueller 13 years ago
parent
commit
5160fc0566
5 changed files with 28 additions and 1 deletions
  1. 1 1
      README.markdown
  2. 3 0
      src/FMDatabase.m
  3. 3 0
      src/FMResultSet.h
  4. 8 0
      src/FMResultSet.m
  5. 13 0
      src/fmdb.m

+ 1 - 1
README.markdown

@@ -109,7 +109,7 @@ Alternatively, you may use named parameters syntax:
 The parameters *must* start with a colon. SQLite itself supports other characters, but internally the Dictionary keys are prefixed with a colon, do **not** include the colon in your dictionary keys.
 
     NSDictionary *argsDict = [NSDictionary dictionaryWithObjectsAndKeys:@"My Name", @"name", nil];
-    [db executeUpdate:@"INSERT INTO myTable (name) VALUES (:name)" withArgumentsInDictionary:argsDict];
+    [db executeUpdate:@"INSERT INTO myTable (name) VALUES (:name)" withParameterDictionary:argsDict];
 
 Thus, you SHOULD NOT do this (or anything like this):
 

+ 3 - 0
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]);
         }

+ 3 - 0
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;
 

+ 8 - 0
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]];
 }

+ 13 - 0
src/fmdb.m

@@ -119,6 +119,19 @@ int main (int argc, const char * argv[]) {
     
     FMDBQuickCheck(![db hasOpenResultSets]);
     
+    [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)"];