JDDatabaseManager Class Reference
Provides a manager for interacting with the database safely.
More...
List of all members.
Detailed Description
Provides a manager for interacting with the database safely.
Member Function Documentation
- (BOOL) addAppCoreEntry: |
|
(NSString *) |
opt |
withValue: |
|
(NSString *) |
value |
andEnable: |
|
(BOOL) |
enabled | |
|
|
| | |
Use to adds a row to the AppCore database which is used to provide application settings/state information for the rest of the app
- Parameters:
-
| opt | the name of the option to add |
| value | the value to give the option |
| enabled | detirmine of the option is enabled or not |
- Returns:
- true on success false on failure
- (BOOL) addEntries: |
|
(JDFieldArray *) |
opts |
inTable: |
|
(NSString *) |
table | |
|
|
| | |
Add values to the database
- Parameters:
-
| opt | the name of the option to add |
| table | name of table to access |
| enabled | detirmine of the option is enabled or not |
- Returns:
- true on success false on failure
- (BOOL) createTable: |
|
(NSString *) |
tableName |
withFields: |
|
(NSArray *) |
fields | |
|
|
| | |
Creates a table with the field values provided, id field provided by default, do not add on own.
- Parameters:
-
| tableName | the name of the table to create in the databse |
| fields | should be an array of strings with the name and type of fields to add; example: @"NAME TEXT", @"VALUE INTEGER" |
- Returns:
- true on successful creation, false otherwise
- (sqlite3 *) getAppCoreDB |
|
|
|
|
Gets the app core sqlite 3 database object
- Returns:
- sqlite3* database struct if found or NULL on failure
- (NSString *) getAppCoreEntry: |
|
(NSString *) |
opt |
|
|
Gets an option entry from the AppCore table
- Parameters:
-
| opt | string containing the name of the option to get |
- Returns:
- returns value of option if found or NULL if doesn't exist
- (sqlite3 *) getDatabase: |
|
(NSString *) |
databaseName |
|
|
Gets an sqlite 3 database object
- Parameters:
-
| databaseName | the name of the database.db to look up |
- Returns:
- database struct if found or NULL on failure
- (NSMutableArray *) getEntries: |
|
(JDFieldArray *) |
opts |
inTable: |
|
(NSString *) |
table | |
|
|
| | |
Gets an option entry from the AppCore table
- Parameters:
-
| opts | JDFIELDS containing the name of the fields to get |
| table | name of table to access |
- Returns:
- returns value of fields if found or NULL if doesn't exist Complete this implementation
- (NSMutableArray *) getEntries: |
|
(JDFieldArray *) |
opts |
inTable: |
|
(NSString *) |
table |
whereField: |
|
(NSString *) |
field |
isEqualTo: |
|
(NSObject *) |
testObj |
ofType: |
|
(enum JDDATATYPE) |
dataType | |
|
|
| | |
Gets an option entry from the database table
- Parameters:
-
| opts | the fields to update with values |
| table | name of table to access |
| field | field to test for updating |
| testObj | object to test where against |
| dataType | of this type of data |
- Returns:
- Results of the select, or null if failed
- (NSMutableArray *) getEntries: |
|
(JDFieldArray *) |
opts |
inTable: |
|
(NSString *) |
table |
whereField: |
|
(NSString *) |
field |
isEqualTo: |
|
(NSObject *) |
testObj |
ofType: |
|
(enum JDDATATYPE) |
dataType |
withLimit: |
|
(int) |
limit | |
|
|
| | |
Gets an option entry from the database table
- Parameters:
-
| opts | the fields to update with values |
| table | name of table to access |
| field | field to test for updating, null for no condition |
| testObj | object to test where against, null for no condition |
| dataType | of this type of data, 0 for no condition |
| limit | number of items to return, -1 for unlimited |
- Returns:
- Results of the select, or null if failed
- (NSMutableArray *) getEntries: |
|
(JDFieldArray *) |
opts |
inTable: |
|
(NSString *) |
table |
whereField: |
|
(NSString *) |
field |
isEqualTo: |
|
(NSObject *) |
testObj |
ofType: |
|
(enum JDDATATYPE) |
dataType |
withLimit: |
|
(int) |
limit |
withOrder: |
|
(enum JDATAORDER) |
orderType |
orderColumn: |
|
(NSString *) |
orderColumn |
groupColumn: |
|
(NSString *) |
groupColumn | |
|
|
| | |
Gets an option entry from the database table
- Parameters:
-
| opts | the fields to update with values |
| table | name of table to access |
| field | field to test for updating, null for no condition |
| testObj | object to test where against, null for no condition |
| dataType | of this type of data, 0 for no condition |
| limit | number of items to return, -1 for unlimited |
| orderType | the type of ordering to apply to the columns |
| orderColumn,the | column to order by |
| distinctColumn | column to force to be distince |
- Returns:
- Results of the select, or null if failed
Initialises the database.
- (instancetype) initWithDatabaseFilename: |
|
(NSString *) |
dbFilename |
|
|
Initialize a new database manager interacting with the provided database filename.
- Parameters:
-
| dbFilename | Name of the sqlite database file to use. |
- (BOOL) removeAppCoreDatabase |
|
|
|
|
Very sensitive method that should only be called if you want to completely delete the AppCore.db sqlite database file.
- (BOOL) removeDatabase: |
|
(NSString *) |
databaseName |
|
|
Very sensitive method that should only be called if you want to completely delete an sqlite database file. ONLY THEN!
- (BOOL) setAppCoreEntry: |
|
(NSString *) |
opt |
withValue: |
|
(NSString *) |
value |
andEnable: |
|
(BOOL) |
enabled | |
|
|
| | |
Set an entry in the app core data table or create one if not there already
- Parameters:
-
| opt | the name of the option to add |
| value | the value to give the option |
| enabled | detirmine of the option is enabled or not |
- Returns:
- true on success false on failure
- (BOOL) setEntries: |
|
(JDFieldArray *) |
opts |
inTable: |
|
(NSString *) |
table |
whereField: |
|
(NSString *) |
field |
isEqualTo: |
|
(NSObject *) |
testObj |
ofType: |
|
(enum JDDATATYPE) |
dataType | |
|
|
| | |
Set an entry in a database table or create one if not there already
- Parameters:
-
| opts | the fields to update with values |
| table | name of table to access |
| field | field to test for updating |
| testObj | object to test where against |
| dataType | of this type of data |
- Returns:
- true on success false on failure
- (BOOL) setEntries: |
|
(JDFieldArray *) |
opts |
inTable: |
|
(NSString *) |
table |
whereField: |
|
(NSString *) |
field |
isEqualTo: |
|
(NSObject *) |
testObj |
ofType: |
|
(enum JDDATATYPE) |
dataType |
withID: |
|
(NSNumber *) |
entryID | |
|
|
| | |
Set an entry in a database table or create one if not there already
- Parameters:
-
| opts | the fields to update with values |
| table | name of table to access |
| field | field to test for updating |
| testObj | object to test where against |
| dataType | of this type of data |
| entryID | contains unsigned long value of the id or null if no id to use |
- Returns:
- true on success false on failure
The documentation for this class was generated from the following files: