Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving to database using FMDB crashes on interpreting NSInteger
    primarykey
    data
    text
    <p>When the below function is called, I get the EXC_BAD_ACCESS crash. It looks like FMDB is having a problem interpreting the subject_id NSInteger as it makes it through the two NStrings and bombs when it hits this subject_id column in the WHERE clause. </p> <pre><code>- (void) saveAllData { if(isDirty) { DrillDownAppAppDelegate *appDelegate = (DrillDownAppAppDelegate *)[[UIApplication sharedApplication] delegate]; FMDatabase *database = [FMDatabase databaseWithPath:appDelegate.getDBPath]; if ([database open]) { [database executeUpdate:@"update Subject Set subject = ?, category = ? where subject_id = ?", self.title, self.category_title, self.subject_id]; [database close]; } isDirty = NO; } //Reclaim all memory here. [title release]; title = nil; [category_title release]; category_title = nil; } </code></pre> <p>The problem is the same as I ran into in another post on FMDB insert problems and this boils down to something wrong with my subject_id member. I believe I am using a wrong declaration in the header. Here it is: </p> <pre><code>// // Subject.h // DrillDownApp #import &lt;UIKit/UIKit.h&gt; @interface Subject : NSObject { NSInteger subject_id; NSString *category_title; NSString *title; // NSMutableArray *quotes; BOOL isDirty; // BOOL isDetailViewHydrated; } - (id) initWithPrimaryKey:(NSInteger)pk; @property (nonatomic, readwrite) BOOL isDirty; //@property (nonatomic, readwrite) BOOL isDetailViewHydrated; - (void) addSubject; - (NSInteger)getNextSubjectId; @property (nonatomic, assign) NSInteger subject_id; @property (nonatomic, copy) NSString * title; @property (nonatomic, copy) NSString * category_title; //@property (nonatomic, retain) NSMutableArray *quotes; //- (void) saveAllData; @end </code></pre> <p>(Note: I edited this majorly as I figured out the rest of it.)</p>
    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.
 

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