Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="https://github.com/ziminji/objective-c-sql-query-builder" rel="nofollow">Objective-C SQL Query Builder library for SQLite</a> offers three way to open a connection as noted on its <a href="https://github.com/ziminji/objective-c-sql-query-builder/wiki/Establishing-a-Database-Connection" rel="nofollow">Wiki</a>:</p> <pre><code>// (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;"]; </code></pre> <p>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.</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload