Is the ATTACH DATABASE statement supported

5 views
Skip to first unread message

yakbuttercandle

unread,
Nov 1, 2009, 8:01:16 PM11/1/09
to pldatabase
For the life of me, I am not able to get this attach statement to
work: ATTACH DATABASE '/Users/gr/Library/Application\ Support/iPhone\
Simulator/User/Applications/3A5985F2-A114-466E-A169-876B5F72B54A/
Documents/db/ABC.sqlite' as ABC

I suspect the problem may be in the way i'm escaping @" " in the path
to the db I'm trying to attach.

<code>
NSString *escapedPath = [pathToVDb
stringByReplacingOccurrencesOfString:@" " withString:@"\\ "];
attachStmt = [NSString stringWithFormat:@"ATTACH DATABASE '%@' as
%@",escapedPath, vCode];

NSObject<PLResultSet> *results = [dbase
executeQueryAndReturnError:anError statement:attachStmt];

NSString *pragmaStmt = @"pragma database_list";
results = [dbase executeQueryAndReturnError:anError
statement:pragmaStmt];
while ([results next]) {
NSLog(@"DATABASE LIST: \n");
NSLog(@" %@ at %@ \n",[results stringForColumn:@"name"],
[results stringForColumn:@"file"]);
}
</code>

No errors from executeQuery;
Database list only has the main database

The attach statement works (even without escaping spaces in the path)
when I use SQLite Manager Plugin for Firefox (where I issue SQL
statements as opposed to using the Attach Database menu option)

Help!
Reply all
Reply to author
Forward
0 new messages