I want open a sqlite db but it is not in my mainBundle but in a server then I don't have this
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"info.sqlite"];
but I have
NSString *filePath = @"http://serverAddress/info.sqlite";
NSURL *url = [NSURL URLWithString:filePath];
NSData *myData = [NSData dataWithContentsOfURL:url];
and when I read this db what I can do? If my db is inside mainBundle I do this:
if (sqlite3_open([filePath UTF8String], &database) == SQLITE_OK) {
const char *sql = "select id, one, two from TABLE";
sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {
while(sqlite3_step(selectstmt) == SQLITE_ROW) {
idNum = [NSNumber numberWithInt:(int)sqlite3_column_int(selectstmt, 0)];
...
...
but if I have a NSData? Can you help me?