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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:17:40+00:00 2026-06-02T00:17:40+00:00

I’m planning to use the objective-c-sql-query builder from ziminji on an iPhone and iPad

  • 0

I’m planning to use the objective-c-sql-query builder from ziminji on an iPhone and iPad project. This library supports multi-threading, like I need. I’ve initially done my project using Core Data, but the performance is bad when the amount of data grows a lot. For example, when I have to delete everything (hundred-thousands of rows), it takes a long time, which makes sense due to the object-oriented layer. Accessing the database directly is a lot faster.

I looked at the library’s code and I noticed that every time I query the database, it opens a connection to the database. Isn’t this slow? Wouldn’t it be faster to keep the database connection opened while the app is active? Or would it be a problem to implement it like that with multi-threading support?

  • 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-02T00:17:42+00:00Added an answer on June 2, 2026 at 12:17 am

    The Objective-C SQL Query Builder library for SQLite offers three way to open a connection as noted on its Wiki:

    // (Alternative #1)
    ZIMDbConnection *connection = [[ZIMDbConnectionPool sharedInstance] connection: @"live"];
    NSArray *records = [connection query: @"SELECT * FROM Customer;"];
    
    // (Alternative #2)
    ZIMDbConnection *connection = [[ZIMDbConnection alloc] initWithDataSource: @"live"];
    NSArray *records = [connection query: @"SELECT * FROM Customer;"];
    [connection close];
    
    // (Alternative #3)
    NSArray *records = [ZIMDbConnection dataSource: @"live" query: @"SELECT * FROM Customer;"];
    

    The first two alternatives allow for the connection to remain open. In fact, that is the whole purpose of a database connection pool. With the database connection pool, you do not have to worry about opening and closing the connection because the class manages this for you; whereas, the second alternative you manage the connection. In the third alternative, this is just a quick way to open the connection, query, and then close the connection all in one line of code.

    If you are going to utilize multi-threading, you will need to use either the first or second alternative. If you chose the second alternative, create an instance variable in your class and open the connection, then start your threads. Once all of your threads have finished running, close the connection…otherwise just leave it open.

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

Sidebar

Related Questions

I am planning to use libcurl in my project. I had downloaded the library
I am planning to use Django for a multi-site project, where each site is
I am planning to use SCTP for a embedded Linux project. Anybody has some
I am planning to use PIC18F6*** serial microntroller for my project serial-ethernet converter. Once
I'm planning to use Mustache templates along with Kohana in my next project. So
This question is related to a iOS project written in ObjectiveC that makes use
I`m planning to use the titles in a PSMultiValueSpecifier from settings.bundle in a pickerview.
I'm planning to use the Multiple apk approach to my current project, since it
I am planning to use Locomotive for a project...But as the official website says
I am planning to use NHibernate for my next project with mapping through FluentNHibernate.

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.