Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6086015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:42:14+00:00 2026-05-23T11:42:14+00:00

While Executing SQLITE with SELECT statement and having COUNT (*) to count the total

  • 0

While Executing SQLITE with SELECT statement and having COUNT (*) to count the total number of that column, gives me EXC_BAD_ACCESS.
It sends me the error while adding an array from one array to other. No idea why it does that but has anybody come across such issues can help around ?

-(void) title{

self.array = [[[NSMutableArray alloc] init] autorelease];
const char *query_stmt = "SELECT DISTINCT ID, KEY, COUNT (*)  FROM TEST GROUP BY KEY";
if (sqlite3_prepare_v2(database, query_stmt, -1, &statement, NULL) == SQLITE_OK)
{
    while(sqlite3_step(statement) == SQLITE_ROW)
    {
        NSString *ID = [NSString stringWithUTF8String:(char *) sqlite3_column_text(exhProduct_statement, 0)];
        NSString *KEY = [NSString stringWithUTF8String:(char *) sqlite3_column_text(exhProduct_statement, 1)];
        NSUInteger taskCount=  sqlite3_column_int(exhProduct_statement, 2);
        NSMutableArray *taskArray=[[NSMutableArray alloc]initWithObjects:ID, KEY, taskCount,nil] ; <--- Error

        [self.array addObject:taskArray];
    }
    sqlite3_finalize(statement);        
}       
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:42:15+00:00Added an answer on May 23, 2026 at 11:42 am

    You need to change the NSUInteger into an NSNumber:

        NSMutableArray *taskArray=[[NSMutableArray alloc]initWithObjects:ID, KEY, [NSNumber numberWithUnsignedInteger:taskCount],nil] ;
    

    You can later retrieve the value using

        NSUInteger *retrievedTaskCount = [[taskArray objectAtIndex:2] unsignedIntegerValue];
    

    The reason for this is that an NSArray stores NSObjects, so any time that you have an int, float, NSInteger, NSUInteger, etc, that you wish to store in an NSArray or NSMutableArray, you will need to convert it into an object. NSNumber is a class build just for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

while executing the following query, i get an error that there's an error in
in DB2 while executing a query i got SqlException: DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016
What I want to do is while executing MySQL query, passing column data into
I am getting WatiN.Core.Exceptions.TimeoutException : Timeout while Internet Explorer busy error while executing my
Is there any tool that enables you to hot swap JavaScript contents while executing
qichunren@zhaobak:~> gem install hpricot ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write
I am executing this statement under while (($data=fgetcsv($this->fin,5000,;))!==FALSE) Now what I want in else
while executing $expect filename.exp user pwd ip I got the error could not execute
while executing a long script that uses Doctrine to access the db, I get
While executing the following code i gets this error Late bound operations cannot be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.