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 8570179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:30:00+00:00 2026-06-11T18:30:00+00:00

I have following code (modified code from this tutorial ): -(NSMutableArray *) getChampionDatabase {

  • 0

I have following code (modified code from this tutorial):

    -(NSMutableArray *) getChampionDatabase
{
    NSMutableArray *championsArray = [[NSMutableArray alloc] init];

    @try {

    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *databasePath = [[NSBundle mainBundle]pathForResource: @"Champions Database" ofType:@"sqlite"];
    BOOL success = [fileManager fileExistsAtPath:databasePath];

    if (!success)
    {
        NSLog(@"cannot connect to Database! at filepath %@",databasePath);
    }

    if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK)
    {
    const char *sql = "SELECT CHAMPION_ID,CHAMPION_NAME,CHAMPION_IMG FROM CHAMPIONS";
    sqlite3_stmt *sqlStatement;

    if(sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) == SQLITE_OK)
    {
        while (sqlite3_step(sqlStatement)==SQLITE_ROW) {
            championList *ChampionList = [[championList alloc]init];
            ChampionList.championId = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,0)];
            ChampionList.championName = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,1)];
            ChampionList.championImage = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 2)];
            [championsArray addObject:ChampionList];
    }
    }
        else
        {
            NSLog(@"problem with database prepare");
        }
    }
        else
        {
            NSLog(@"problem with database openning");
        }
    }

@catch (NSException *exception)
    {
    NSLog(@"An exception occured: %@", [exception reason]);
    }
@finally
    {
    return championsArray;
    }
}

After running this code i always have output : “problem with database prepare”

Then i tried to check error number of sqlite3_prepare by following code:

int ret = sqlite3_prepare(database, sql, -1, &sqlStatement, NULL);
            if (ret != SQLITE_OK) {
                NSLog(@"Error calling sqlite3_prepare: %d", ret);
            }

output: “Error calling sqlite3_prepare: 26”

error 26 – /*File opened that is not a database file */


File have sqlite 3 version

how is this possible? file extension is .sqlite and i can modify it in sqlite manager

  • 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-06-11T18:30:02+00:00Added an answer on June 11, 2026 at 6:30 pm

    Make sure you added your DB to the ressource bundle of your project and don’t put any space in your name of your DB. For example use a name like champion_db.sqlite.

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

Sidebar

Related Questions

I have the following javascript code, which is modified from the SimpleUpload demo in
I have the following code slightly modified from the Visual Studio 2010 css template.
I have the following modified code from google that displays a map with polygons
Given the following code below, how can I have it modified such that it
I have following code for loading image from url in xml parsing endElement method
I'm javascript newbie...please bear with me. Modified some jQuery animation code from w3c tutorial.
I have the following code: ServiceSoapClient service = new ServiceSoapClient(); var dataSource = (from
EDIT: Optimization results at end of this question! hi, i have a following code
I have the following code: try { OnInitialize(); } catch (PageObjectLifecycleException exception) { exception.OldLifecycleState
I'm using HttpClient 0.6.0 from NuGet. I have the following C# code: var client

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.