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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:40:15+00:00 2026-05-24T23:40:15+00:00

sqlite is able to create in-memory database, but is it possible done in iPhone?

  • 0

sqlite is able to create in-memory database, but is it possible done in iPhone?

This is the document state that in sqlite
http://www.sqlite.org/inmemorydb.html

I tried, but fail. It successful create the database, but fail to create table.
Below is my code:

-(BOOL) open{

    NSString *path = @"";
    if(sqlite3_open([path UTF8String], &database_) == SQLITE_OK) {
        //bFirstCreate_ = YES;
        NSLog(@"open == YES");
        [self createChannelsTable:database_];
        return YES;
    } else {
        sqlite3_close(database_);
        NSLog(@"Error: open database file.");
        return NO;
    }
    return NO;
}


- (BOOL) createChannelsTable:(sqlite3*)db{

    NSString *comment = [[NSString alloc] init];
    comment = @"CREATE TABLE Temp(Name text, Address text}";
    sqlite3_stmt *statement;
    if(sqlite3_prepare_v2(db, [comment UTF8String], -1, &statement, nil) != SQLITE_OK) {
        NSLog(@"Error: failed to prepare statement:create channels table");
        return NO;
    }
    int success = sqlite3_step(statement);
    sqlite3_finalize(statement);
    if ( success != SQLITE_DONE) {
        NSLog(@"Error: failed to dehydrate:CREATE TABLE channels");
        return NO;
    }
    NSLog(@"Create table 'channels' successed.");

    return YES;
}
  • 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-24T23:40:16+00:00Added an answer on May 24, 2026 at 11:40 pm

    Are you possibly missing a semicolon in your SQL command string and wrong ending ‘}’ instead of ‘)’ ?

    comment = @"CREATE TABLE Temp(Name text, Address text}";
    

    Needs a semicolon after “Address text}” so it becomes:

    comment = @"CREATE TABLE Temp(Name text, Address text);";
    

    I think you also go a memory leak when you create the NSString “comment”. You init it then you told the comment pointer to store another string when you used the assign statement.

    You can do those two step in 1 like so:

    NSString *comment = [[NSString alloc] initWithString:@"CREATE TABLE Temp(Name text, Address text}";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need my PHP app to be able to create an SQLite table but
I really like this approach for handling sqlite database when developing for Android but
I am following this tutorial: http://www.codeproject.com/KB/android/AndroidSQLite.aspx I must be overthinking this SQLite stuff (in
I am able to create a connection to a local sqlite3 database ( Using
I'm trying to create an sqlite database by importing a csv file with urls.
I’m hoping somebody will be able to help with my SQLite database problem. I’m
I have a SQLite database with cyrillic rows in it. For example: CREATE TABLE
I would like to create a table in a SQLite database using the Server
I am running a SQLite database in memory and I am attempting to drop
I am creating a SQLite database for my iPhone projects. I have table called

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.