Sfoglia il codice sorgente

add unit test case for -[FMDatabase executeStatements:withResultBlock:], SELECT records with blob fields

jam.chenjun 7 anni fa
parent
commit
06e97b996b
1 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 13 1
      Tests/FMDatabaseTests.m

+ 13 - 1
Tests/FMDatabaseTests.m

@@ -1151,12 +1151,24 @@ - (void)testExecuteStatements {
         XCTAssertEqual(count, 1, @"expected one record for dictionary %@", dictionary);
         return 0;
     }];
+    
+    XCTAssertTrue(success, @"bulk select");
+
+    // select blob type records
+    [self.db executeUpdate:@"create table bulktest4 (id integer primary key autoincrement, b blob);"];
+    NSData *blobData = [[NSData alloc] initWithContentsOfFile:@"/bin/bash"];
+    [self.db executeUpdate:@"insert into bulktest4 (b) values (?)" values:@[blobData] error:nil];
 
+    sql = @"select * from bulktest4";
+    success = [self.db executeStatements:sql withResultBlock:^int(NSDictionary * _Nonnull resultsDictionary) {
+        return 0;
+    }];
     XCTAssertTrue(success, @"bulk select");
 
     sql = @"drop table bulktest1;"
            "drop table bulktest2;"
-           "drop table bulktest3;";
+           "drop table bulktest3;"
+           "drop table bulktest4";
 
     success = [self.db executeStatements:sql];