Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS Error Trying to Attach 2 SQLite databases
    primarykey
    data
    text
    <p>I'm a Ios developer and i'm having a problem with attaching 2 SQLite db's . We are getting this error when running: </p> <pre><code>Error calling sqlite3_step (1: SQL logic error or missing database) SQLITE_ERROR 2012-06-19 11:10:19.658 °°°°°°°[453:707] DB Query: ATTACH DATABASE '/var/mobile/Applications/A05034A8-F5AF-45AA-B520-DF2BBEBB800B/Documents/Meals.db' AS mealDB 2012-06-19 11:10:19.672 °°°°°°°[453:707] Err 1: no such table: Meal 2012-06-19 11:10:19.680 °°°°°°°[453:707] Error calling sqlite3_step (1: SQL logic error or missing database) SQLITE_ERROR 2012-06-19 11:10:19.684 °°°°°°°[453:707] DB Query: ATTACH DATABASE '/var/mobile/Applications/A05034A8-F5AF-45AA-B520-DF2BBEBB800B/Documents/Meals.db' AS mealDB 2012-06-19 11:10:19.693 °°°°°°°[453:707] Err 1: no such table: MealItem 2012-06-19 11:10:19.698 °°°°°°°[453:707] ERREUR </code></pre> <p>After attaching, we are trying to collect data . He is not finding the table we are searching in: Err 1: no such table: MealItem or Err 1: no such table: Meal.</p> <p>It gets even stranger! When we test the same code in Sim with iOS 5.0 it works ! Data is returning from the request! Still getting this error a few times though :</p> <pre><code>Error calling sqlite3_step (1: SQL logic error or missing database) SQLITE_ERROR 2012-06-19 11:10:19.684 °°°°°°°[453:707] DB Query: ATTACH DATABASE '/var/mobile/Applications/A05034A8-F5AF-45AA-B520-DF2BBEBB800B/Documents/Meals.db' AS mealDB </code></pre> <p>We tried attaching the 2 databases in sqlight manager, and this was successful. This result database also worked in the application . It seems like iOS has a problem attaching databases . Or we made an error somewhere .</p> <p>We are searching for a solution without any luck so far.</p> <p>Here some code : (Using FMDatabase api)</p> <pre><code>- (FMDatabase *) attachMealDatabase:(FMDatabase *) db { if (![db open]) { NSLog(@"Could not open db."); return nil; }else { } NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentDirectory = [paths objectAtIndex:0]; //const char * mainDBPath = [[documentDirectory stringByAppendingPathComponent:@"Main.db"] UTF8String]; const char * mealDBPath = [[documentDirectory stringByAppendingPathComponent:@"Meals.db"] UTF8String]; NSString *attachSQL = [NSString stringWithFormat: @"ATTACH DATABASE \'%s\' AS mealDB", mealDBPath]; [db beginTransaction]; [db executeUpdate:attachSQL]; [db commit]; //[db close]; return db; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload