Permalink
Browse files

Added an attach database test.

  • Loading branch information...
1 parent ceef9e7 commit ccee9b6272cb6b56221e3545fe1c9bb1905e2085 @ccgus committed Apr 5, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/fmdb.m
View
@@ -588,6 +588,26 @@ int main (int argc, const char * argv[]) {
}
+ // test attach for the heck of it.
+ {
+
+ //FMDatabase *dbA = [FMDatabase databaseWithPath:dbPath];
+ [fileManager removeItemAtPath:@"/tmp/attachme.db" error:nil];
+ FMDatabase *dbB = [FMDatabase databaseWithPath:@"/tmp/attachme.db"];
+ FMDBQuickCheck([dbB open]);
+ FMDBQuickCheck([dbB executeUpdate:@"create table attached (a text)"]);
+ FMDBQuickCheck(([dbB executeUpdate:@"insert into attached values (?)", @"test"]));
+ FMDBQuickCheck([dbB close]);
+
+ [db executeUpdate:@"attach database '/tmp/attachme.db' as attack"];
+
+ rs = [db executeQuery:@"select * from attack.attached"];
+ FMDBQuickCheck([rs next]);
+ [rs close];
+
+ }
+
+
{
// -------------------------------------------------------------------------------

0 comments on commit ccee9b6

Please sign in to comment.