1
, 내가 하나의 함수에서 여러 쿼리를로드하려고하지만 난 어떤 문제FMDB - 오류 호출 sqlite3_step (21 : 메모리 부족)가 가능 내 코드에서 FMDB 라이브러리를 통합했다 RS
* Error calling sqlite3_step (21: out of memory) rs
* FMDB not open
* FMDB is in use
을받은 단일 함수에서 여러 쿼리를 실행하려면?, 내 의견을 알려주십시오.
사전
에서덕분에 나는 참고로이 시도 :
-(NSMutableArray *)getMyInfo
{
NSMutableArray *contactList = [NSMutableArray array];
if(![instance.database open])
{
DLog(@"Could not open DB");
return nil;
}
********** QUERY 1 **************
FMResultSet *resultSet=[instance.database executeQuery:@"SELECT * FROM mycontacts WHERE cont_hidden = 0 and cont_recent_chat_time IS NOT NULL ORDER BY strftime(cont_recent_chat_time) DESC"];
if(resultSet)
{
while([resultSet next])
{
@autoreleasepool
{
int type = [resultSet intForColumn:@"contact_type"];
Contactbean *contactObj = [[Contactbean alloc]init];
[contactObj setPhoneNo:[resultSet stringForColumn:@"cont_phonenumber"]];
********** QUERY 2 **************
을 FMResultSet *getCountResult=[instance.database executeQuery:@"SELECT count(kchatid) FROM mychat WHERE kisread = 0 and kchatnumber = ?",[resultSet stringForColumn:@"cont_phonenumber"]];
if ([getCountResult next]) {
if([getCountResult intForColumnIndex:0] > 0)
{
[contactObj setCount:[getCountResult intForColumnIndex:0]];
}
}
[getCountResult close];
********** QUERY 3 **************
FMResultSet *getRecentResult=[instance.database executeQuery:@"SELECT * from mychat where kchatnumber =? AND kchattime =?",[resultSet stringForColumn:@"cont_phonenumber"],[resultSet stringForColumn:@"status"]];
if([getRecentResult next])
{
[contactObj setStatus:[getRecentResult intForColumn:@"status"]];
}
[getRecentResult close];
// Adding contact to the list
[contactList addObject:contactObj];
}
}
}
[resultSet close];
[instance.database close];
return contactList;
}
들으 브로! 나를 위해 작동 – Jerome