SqlクエリがIOS 8.0 8.1で動作しておらず、IOS 8.2で動作しています 以下のsqliteクエリを見つけてください。sqlite iOS 8.0 - 8.1で動作していないクエリがIOS 8.2で動作しています。
-(BOOL)insertRecordsFromlastDateToCurrentDate{
NSString *resultString = @"";
if(database == nil)
{
NSString *dbPath = [DatabaseHandler getDBPath];
if (sqlite3_open([dbPath UTF8String], &database) != SQLITE_OK) {
NSAssert1(0, @"Error while opening Database. '%s'", sqlite3_errmsg(database));
return nil;
}
}
NSString *queryString = [NSString stringWithFormat:@"WITH RECURSIVE dates(category, points,diagonisePoints, date) AS (VALUES('Healthy Weight', '0','0', (select DATE(selectedDate, '+1 day') as selectedDate from glanceTable ORDER BY ROWID DESC LIMIT 1)),('Healthy Diet', '0','0',(select DATE(selectedDate, '+1 day') as selectedDate from glanceTable ORDER BY ROWID DESC LIMIT 1)),('Exercise', '0','0',(select DATE(selectedDate, '+1 day') as selectedDate from glanceTable ORDER BY ROWID DESC LIMIT 1)),('Smoking Cessation', '0','0',(select DATE(selectedDate, '+1 day') as selectedDate from glanceTable ORDER BY ROWID DESC LIMIT 1)) UNION ALL SELECT category, points,diagonisePoints, date(date, '+1 day') FROM dates WHERE date < date('now')) insert into glanceTable SELECT category, points,diagonisePoints, date as selectDate FROM dates WHERE date <= date('now')"];
const char *sql = [queryString cStringUsingEncoding:NSASCIIStringEncoding];
sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {
while(sqlite3_step(selectstmt) == SQLITE_ROW) {
resultString = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 0)] ;
}
}
return YES;
}
フィードバックには高く評価されます。
エラー、警告? –
@ Mr.Bistaエラーメッセージ: "WITH"構文エラー。 – kiran