objective-c-sql-query-builder
Public Member Functions | Static Public Member Functions | Protected Attributes
ZIMDbConnection Class Reference

#import <ZIMDbConnection.h>

List of all members.

Public Member Functions

(id) - initWithDataSource:withMultithreadingSupport:
(id) - initWithDataSource:
(void) - open
(NSNumber *) - beginTransaction
(NSNumber *) - execute:
(NSArray *) - query:
(NSArray *) - query:asObject:
(NSNumber *) - rollbackTransaction
(NSNumber *) - commitTransaction
(NSNumber *) - vacuum
(BOOL) - isConnected
(void) - close
(void) - dealloc
(SEL) - selectorForSettingColumnName: [implementation]
(int) - columnTypeAtIndex:inStatement: [implementation]
(id) - columnValueAtIndex:withColumnType:inStatement: [implementation]

Static Public Member Functions

(NSNumber *) + dataSource:execute:
(NSArray *) + dataSource:query:
(NSArray *) + dataSource:query:asObject:

Protected Attributes

NSString_dataSource
BOOL _readonly
NSMutableSet * _privileges
NSLock * _mutex
sqlite3 * _database
BOOL _isConnected

Detailed Description

Discussion:
This class represents an SQLite database connection.
Updated:
2012-03-23

Member Function Documentation

- (NSNumber *) beginTransaction
Signature:
beginTransaction
Discussion:
This method will begin a transaction.
Returns:
Whether the transaction has been started.
Updated:
2011-06-23
See also:
http://www.sqlite.org/lang_transaction.html
- (void) close
Signature:
close
Discussion:
This method will close an open database connection.
Updated:
2011-07-16
- (int) columnTypeAtIndex: (int)  column
inStatement: (sqlite3_stmt *)  statement 
[implementation]
- (id) columnValueAtIndex: (int)  column
withColumnType: (int)  columnType
inStatement: (sqlite3_stmt *)  statement 
[implementation]
- (NSNumber *) commitTransaction
Signature:
commitTransaction
Discussion:
This method will commit a transaction.
Returns:
Whether the transaction has been committed.
Updated:
2011-07-16
See also:
http://www.sqlite.org/lang_transaction.html
+ (NSNumber *) dataSource: (NSString *)  dataSource
execute: (NSString *)  sql 
Signature:
dataSource:execute:
Discussion:
This method will execute the specified SQL statement.
Parameters:
dataSourceThe file name of the database to be used.
sqlThe SQL statement to be used.
Returns:
Either the last insert row id or TRUE.
Updated:
2011-10-23
See also:
http://www.sqlite.org/c3ref/last_insert_rowid.html
+ (NSArray *) dataSource: (NSString *)  dataSource
query: (NSString *)  sql 
Signature:
dataSource:query:
Discussion:
This method will query with the specified SQL statement.
Parameters:
dataSourceThe file name of the database to be used.
sqlThe SQL statement to be used.
Returns:
The result set.
Updated:
2011-10-23
+ (NSArray *) dataSource: (NSString *)  dataSource
query: (NSString *)  sql
asObject: (Class)  model 
Signature:
dataSource:query:
Discussion:
This method will query with the specified SQL statement.
Parameters:
dataSourceThe file name of the database to be used.
sqlThe SQL statement to be used.
modelThe class to used to map each record. The class only needs to have accessible instance variables and does not necessarily have to conform to the Active Record design pattern.
Returns:
The result set.
Updated:
2011-10-23
- (void) dealloc
Signature:
dealloc
Discussion:
This method will free up the connection should it still remain open.
Updated:
2012-03-21
- (NSNumber *) execute: (NSString *)  sql
Signature:
execute:
Discussion:
This method will execute the specified SQL statement. (Note: It is possible to execute multiple SQL statements via this method.)
Parameters:
sqlThe SQL statement to be used.
Returns:
Either the last insert row id or TRUE.
Updated:
2012-03-23
See also:
http://www.sqlite.org/c3ref/last_insert_rowid.html
http://code.google.com/p/sqlite-manager/issues/detail?id=34
- (instancetype) initWithDataSource: (NSString *)  dataSource
Signature:
initWithDataSource:
Discussion:
This constructor creates an instance of this class with the specified data source and will attempt to open a database connection. If the data source does not already exist in the working directoy, an attempt will be made to copy the data source from the resource directory to the working directory; otherwise, the data source will be created in the working directory.
Parameters:
dataSourceThe file name of the database's PLIST to be used.
Returns:
An instance of this class.
Updated:
2011-07-16
- (instancetype) initWithDataSource: (NSString *)  dataSource
withMultithreadingSupport: (BOOL)  multithreading 
Signature:
initWithDataSource:withMultithreadingSupport:
Discussion:
This constructor creates an instance of this class with the specified data source and will attempt to open a database connection. If the data source does not already exist in the working directoy, an attempt will be made to copy the data source from the resource directory to the working directory; otherwise, the data source will be created in the working directory.
Parameters:
dataSourceThe file name of the database's PLIST to be used.
multithreadingThis determines whether locks should be used.
Returns:
An instance of this class.
Updated:
2012-03-23
- (BOOL) isConnected
Signature:
isConnected
Discussion:
This method checks whether a database connection currently exists.
Returns:
Indicates whether a database connection exists.
Updated:
2011-03-23
- (void) open
Signature:
open
Discussion:
This method will open a connection to the database.
Updated:
2011-07-16
- (NSArray *) query: (NSString *)  sql
Signature:
query:
Discussion:
This method will query with the specified SQL statement and will map each record to an NSDictionary.
Parameters:
sqlThe SQL statement to be used.
Returns:
The result set (i.e. an array of records).
Updated:
2011-04-02
- (NSArray *) query: (NSString *)  sql
asObject: (Class)  model 
Signature:
query:asObject:
Discussion:
This method will query with the specified SQL statement and will map each record to the specified object (i.e. model).
Parameters:
sqlThe SQL statement to be used.
modelThe class to used to map each record. The class only needs to have accessible instance variables and does not necessarily have to conform to the Active Record design pattern.
Returns:
The result set (i.e. an array of records).
Updated:
2011-10-19
- (NSNumber *) rollbackTransaction
Signature:
rollbackTransaction
Discussion:
This method will rollback a transaction.
Returns:
Whether the transaction was rollbacked.
Updated:
2011-07-16
See also:
http://www.sqlite.org/lang_transaction.html
- (SEL) selectorForSettingColumnName: (NSString *)  column [implementation]
- (NSNumber *) vacuum
Signature:
vacuum
Discussion:
The method will rebuild the entire database.
Returns:
Whether the command was successfully executed.
Updated:
2011-06-30
See also:
http://www.sqlite.org/lang_vacuum.html

Member Data Documentation

- (sqlite3*) _database [protected]
- (NSString*) _dataSource [protected]
- (BOOL) _isConnected [protected]
- (NSLock*) _mutex [protected]
- (NSMutableSet*) _privileges [protected]
- (BOOL) _readonly [protected]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Properties Defines