Sqlite3失败,除非我编译没有优化但仅在iOS 3.1.3上

时间:2011-11-03 01:04:04

标签: iphone ios sqlite compilation

我有一个非常奇怪的问题。我的项目中的sqlite使用已经工作了一段时间,现在已停止使用Xcode 4编译代码,但仅限于使用iOS3.1.3的设备。它无法返回记录,但如果我关闭代码优化它就能完美运行。

有谁知道这可能是什么原因或遇到类似问题。

由于 雷尔

// get word from database
NSString *query = [[NSString alloc] initWithFormat:@"select kana_word, kanji_word, word_type_name, word_subtype_name, custom_category_name, kana_index, dictionary_id from dictionary join word_type on word_type.word_type_id=dictionary.word_type_id join word_subtype on word_subtype.word_subtype_id=dictionary.word_subtype_id join custom_category on custom_category.custom_category_id=dictionary.custom_category_id where kana_index=%d", inKanaIndex];
sqlite3_stmt *statement;
NSLog(@"%@", query);
const char *cQuery = [query UTF8String];
if (sqlite3_prepare_v2(jmwDb, cQuery, -1, &statement, nil) != SQLITE_OK) {
    char *errMessage;
    errMessage = (char*)sqlite3_errmsg(jmwDb);
    sqlite3_finalize(statement);
    [query release];
    return nil;
}

// build a word object
int kanji_key;
if (sqlite3_step(statement) == SQLITE_ROW) {
    // create new word
    self.kana = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 0)];
    self.kanji = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 1)];
    self.wordType = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 2)];
    self.wordSubType = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 3)];
    self.customCategory = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 4)];
    self.kanaIndex = sqlite3_column_int(statement, 5);
    kanji_key = sqlite3_column_int(statement, 6);
    self.dictionaryId = kanji_key;
}
else {
    sqlite3_finalize(statement);
    [query release];
    return nil;
}

0 个答案:

没有答案