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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:17:54+00:00 2026-06-10T22:17:54+00:00

I am new in sqlite in ios. Thus, what I have to do first

  • 0

I am new in sqlite in ios. Thus, what I have to do first and next in order to save data to different tables of database?

  • 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-10T22:17:55+00:00Added an answer on June 10, 2026 at 10:17 pm

    I have used Sqlite database in my various application, it works fine for me. You have to follow these steps for inserting the data in the tables of Sqlite database …

    1.First of all you need to create your database… I hope you have created and inserted in your project and also added linked framework libsqlite3.0.dylib and import these in your classes.
    2. Replace your insertion method write this code …

    +(void)insertRecord:(NSString *)dbPath record:(NSMutableArray*)dataArray{
        @try{
            sqlite3_stmt *insertStmnt;
            if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK){
    
                for(int i=0; i<[dataArray count]; i++){
                    id record=[dataArray objectAtIndex:i];
                    NSString *insertQuery = [NSString stringWithFormat:@"INSERT INTO Table_Name (\"Column1\",\"Column2\",\"Column3\",\"Column4\",) VALUES('%@','%@','%@','%@')",[[record objectForKey:@"col1"]  stringByReplacingOccurrencesOfString:@"'" withString:@"''"],[[record objectForKey:@"col2"] stringByReplacingOccurrencesOfString:@"'" withString:@"''"],[[record objectForKey:@"col3"]  stringByReplacingOccurrencesOfString:@"'" withString:@"''"],[[record objectForKey:@"col4"]  stringByReplacingOccurrencesOfString:@"'" withString:@"''"]];
    
                    const char *sql = [insertQuery cStringUsingEncoding:NSUTF8StringEncoding];
    
                    if(sqlite3_prepare_v2(database, sql, -1, &insertStmnt, NULL) == SQLITE_OK){
    
                    }else{
    
                    }
                    if(SQLITE_DONE != sqlite3_step(insertStmnt)){
    
                    }
    
    
                }
            }
        }@catch (NSException *r) {
            NSLog(@"UU %@",r);
        } 
    }
    

    Where record is the array of dictionary, which contains the values which you want to insert in the table or values get from the user.
    stringByReplacingOccurrencesOfString:
    The above method is necessary because if any user enters the data with single cote, then it will lead to your application crash.(you may remove this if you does not take input from the user)

    Yes, You can also follow these links for better understanding..
    1.http://www.techotopia.com/index.php/IOS_4_iPhone_Database_Implementation_using_SQLite
    2.SQLite Tutorial

    Hope it will work for you, if you have any query then may reply..

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

Sidebar

Related Questions

I have an iPhone (iOS) app that keeps data in a local SQLite database
I am new to using the SQLite database in iphone apps. I have created
I am working on iOS5.I am new for SQLite. I have created database named
I have an iOS app that uses a SQLite DB to store its data
I am working on making a new SQLite database. Obviously for a number of
I'm new to android apps development and I have a basic sqlite question. What
my app has a sqlite database which is already preloaded with data. the database
I'm using Core data in an iOS project. I have the data model setup
I have a mutablearray that is populated from sqlite db in ios. I have
I am updating an old iOS app which used sqlite database. I changed the

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.