In My current ios application I have to add tables and insert data to the added table for new version. By taking Upgrade into consideration I did it through the code itself Like below
-(void)lessThan100TableQuery
{
NSString *query=[NSString stringWithFormat:@"CREATE TABLE 'Table_Name' ('item_id' INTEGER PRIMARY KEY NOT NULL , 'item_section' INTEGER, 'item_no' INTEGER, 'bullet_no' VARCHAR, 'heading' INTEGER, 'hide_controls' INTEGER, 'description' VARCHAR);INSERT INTO 'Table_Name' VALUES(1,1,0,'',1,1,'Condition/adequacy of distributor''s/supply intake equipment');"
sqlite3_stmt *statement;
if(sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, nil) == SQLITE_OK) {
if(sqlite3_step(statement) != SQLITE_DONE) {
return NO;
}
sqlite3_finalize(statement);
}
}
(like above I add 100 rows I skipped them here)
But by calling the above method only the table get added without the values
I cross checked it by running the above query in sqlitemanager and working fine without any issue. It is not working in code.
Help me out folks
Aucun commentaire:
Enregistrer un commentaire