Skip to content

Commit

Permalink
Added an attach database test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccgus committed Apr 5, 2012
1 parent ceef9e7 commit ccee9b6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/fmdb.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];

}



{
// -------------------------------------------------------------------------------
Expand Down

0 comments on commit ccee9b6

Please sign in to comment.