Select sqlite 3_步骤在sqlite framework iOS 8.2中不起作用

Select sqlite 3_步骤在sqlite framework iOS 8.2中不起作用,select,sqlite,ios8.2,Select,Sqlite,Ios8.2,我正在使用FMDB执行下面的select查询,它在iOS 8.2之前工作。此查询在iOS 8.1及更早版本中返回了完美的结果集。但当我在Xcode 6.2和iOS 8.2中安装应用程序并调试相同的代码时,编译器在sqlite3_步骤上遇到了问题。任何人都知道为什么会这样。下面是查询和代码 resultset = [manager420 selectFromTable:[NSString stringWithFormat:@"select Call_HDR.*, Problem.Machine,

我正在使用FMDB执行下面的select查询,它在iOS 8.2之前工作。此查询在iOS 8.1及更早版本中返回了完美的结果集。但当我在Xcode 6.2和iOS 8.2中安装应用程序并调试相同的代码时,编译器在sqlite3_步骤上遇到了问题。任何人都知道为什么会这样。下面是查询和代码

resultset = [manager420 selectFromTable:[NSString stringWithFormat:@"select Call_HDR.*, Problem.Machine, Problem.ServiceStatusFlag, AssignTech.RepName AS AssignTechName, DefaultTech.RepName AS DefaultTechName, Problem.ProblemDescription AS ProblemDescription, Problem.SLAHours AS SLAHours, ARComment.CustARComments As CustARComments, SLAResponseCode.SLAResponse As SLAResponse, ( 'E(' || IFNULL(Call_Status.ESum,0) || ')  P(' || IFNULL(Call_Status.PSum,0) || ')  O/P(' || IFNULL(Call_OPCount.RecordCount,0) || ')') AS EPO, (IFNULL(Call_Status.ECSum,0) || '       ' || IFNULL(Call_Status.PCSum,0)) AS EPC from  CALL_HDR  LEFT JOIN  Branch_Reps as AssignTech  ON  CALL_HDR.RepID = AssignTech.RepID LEFT JOIN Branch_Reps as DefaultTech ON CALL_HDR.AssignedServiceRep = DefaultTech.RepID LEFT JOIN CALL_MACHINE as Problem ON CALL_HDR.CallNumber||'*001' = Problem.CallNumberWSeqnbr LEFT JOIN (Select Call_Machine.CallNumber, IFNULL(COUNT(CASE WHEN Call_Machine.EmergencyServicePerformed IN ('Y', 'C') THEN 1 END), 0) As ESum, IFNULL(COUNT(CASE WHEN Call_Machine.EmergencyServicePerformed = 'C' THEN 1 END), 0) As ECSum, IFNULL(COUNT(CASE WHEN Call_Machine.EmergencyServicePerformed NOT IN ('Y', 'C') THEN 1 END), 0) As PSum, IFNULL(COUNT(CASE WHEN Call_Machine.PMIAInspectionPerformed = 'Y' THEN 1 END), 0) As PCSum From Call_Machine Group By Call_Machine.CallNumber) As Call_Status ON CALL_HDR.CallNumber = Call_Status.CallNumber LEFT JOIN (SELECT COUNT(*) RecordCount,CC.CALLNumber FROM Machines M INNER JOIN Call_Hdr CC ON  M.Location_ID = CC.LocationID WHERE M.Next_insp_Due_Date <> '' AND NOT EXISTS (Select Call_Machine.SNID from Call_Machine where Call_Machine.CallNumber = CC.CallNumber AND Call_Machine.SNID = M.Snrrn) GROUP BY CC.CallNumber) As Call_OPCount ON CALL_HDR.CallNumber = Call_OPCount.CallNumber LEFT JOIN Customers as ARComment ON CALL_HDR.LocationID = ARComment.LocationID LEFT JOIN NA_Data as SLAResponseCode ON CALL_HDR.CustomerTypeCode = SLAResponseCode.NationalAccountCode where CALL_HDR.CallStatus <> '%@' AND CALL_HDR.CallStatus <> '%@' %@",STATUS_CLOSED,STATUS_CANCELLED,temp_Query]];
while ([resultset next]) {
NSLog(@"result returned !!");
}

提前感谢。

这是一个非常大的查询机会,您很幸运使用了autoindex,它在SQLite 3.7.13和SQLite 3.8.5之间变得更加保守

如果您有约塞米蒂系统或任何带有SQLite的系统≥3.8.5安装后,sqlite3命令行界面中的输出将告诉您正在使用哪些索引(如果有的话)来满足您的查询,并提供可以帮助您创建新索引的信息

- (BOOL) next {

int rc;
BOOL retry;
int numberOfRetries = 0;
do {
    retry = NO;

    rc = sqlite3_step(statement.statement);

    if (SQLITE_BUSY == rc) {
        // this will happen if the db is locked, like if we are doing an update or insert.
        // in that case, retry the step... and maybe wait just 10 milliseconds.
        retry = YES;
        usleep(20);

        if ([parentDB busyRetryTimeout] && (numberOfRetries++ > [parentDB busyRetryTimeout])) {

            NSLog(@"%s:%d Database busy (%@)", __FUNCTION__, __LINE__, [parentDB databasePath]);
            NSLog(@"Database busy");
            break;
        }
    }
    else if (SQLITE_DONE == rc || SQLITE_ROW == rc) {
        // all is well, let's return.
    }
    else if (SQLITE_ERROR == rc) {
        NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([parentDB sqliteHandle]));
        break;
    } 
    else if (SQLITE_MISUSE == rc) {
        // uh oh.
        NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([parentDB sqliteHandle]));
        break;
    }
    else {
        // wtf?
        NSLog(@"Unknown error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([parentDB sqliteHandle]));
        break;
    }

} while (retry);


if (rc != SQLITE_ROW) {
    [self close];
}

return (rc == SQLITE_ROW);
}