Instruments is telling me that mutable array courseNames is leaking, but I can't seem to fix it. Any tips would be greatly appreciated.
code:
and this line of code also:
code:
Code:
+(NSMutableArray *)selectNamesAndID{
NSString *query = [[NSString alloc] initWithFormat: @"SELECT Name, ID FROM Courses"];
sqlite3_stmt *statement;
NSMutableArray *courseNames = [[NSMutableArray alloc] init];
int result = (sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, NULL));
NSString *nameString;
NSString *iDString;
NSArray *tempData;
while(sqlite3_step(statement) == SQLITE_ROW){
char *nameChar = (char *)sqlite3_column_text(statement, 0);
nameString = [NSString stringWithUTF8String:nameChar];
int iDInt = sqlite3_column_int(statement, 1);
iDString = [NSString stringWithFormat:@"%d", iDInt];
tempData = [NSArray arrayWithObjects:nameString, iDString, nil];
[courseNames addObject:tempData];
}
sqlite3_finalize(statement);
[query release];
[courseNames autorelease];
return courseNames;
}
and this line of code also:
Code:
currentElementValue = (NSMutableString *)[currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];