|
Objective-C++ Preprocessor
5.0 with ARC & GC
C++ classes to enhance syntax and manage reference counting.
|
#import <objsql.h>
Instance Methods | |
| (id) | - initPath: |
| (OOStringArray) | - registerSubclassesOf: |
| (void) | - registerTableClassesNamed: |
| (OOArray< OOMetaData * >) | - tablesRelatedByNaturalJoinFrom: |
| (OOMetaData *) | - tableMetaDataForClass: |
| (BOOL) | - exec: |
| (OOString) | - stringForSql: |
| (id) | - copyJoinKeysFrom:to: |
| (OOArray< id >) | - select:intoClass:joinFrom: |
| (OOArray< id >) | - select:intoClass: |
| (OOArray< id >) | - select: |
| (long long) | - rowIDForRecord: |
| (long long) | - lastInsertRowID |
| (int) | - insertArray: |
| (int) | - deleteArray: |
| (int) | - insert: |
| (int) | - delete: |
| (int) | - update: |
| (int) | - indate: |
| (int) | - upsert: |
| (int) | - commit |
| (int) | - commitTransaction |
| (int) | - rollback |
| (OOString) | - whereClauseFor:values:qualifyNulls: [implementation] |
| (BOOL) | - prepareSql:joinFrom:toTable: [implementation] |
Class Methods | |
| (OODatabase *) | + sharedInstance |
| (OODatabase *) | + sharedInstanceForPath: |
| (BOOL) | + exec: |
| (OOArray< id >) | + select:intoClass:joinFrom: |
| (OOArray< id >) | + select:intoClass: |
| (OOArray< id >) | + select: |
| (int) | + insertArray: |
| (int) | + deleteArray: |
| (int) | + insert: |
| (int) | + delete: |
| (int) | + update: |
| (int) | + indate: |
| (int) | + upsert: |
| (int) | + commit |
| (int) | + rollback |
| (int) | + commitTransaction |
Public Attributes | |
| OOArray< OOValueDictionary > | transaction |
| OOArray< OOValueDictionary > | results |
| int | errcode |
| int | updateCount |
| char * | errmsg |
| OOString | lastSQL |
Protected Attributes | |
| OODictionary< OOMetaData * > | tableMetaDataByClassName |
| OOReference< OOAdaptor * > | adaptor |
Simple persistence class for Objective-C objects using a "sqlite" database. Instances a class are automatically bound to a table with the class name for insert, update and delete.
A table with the same name as the class is created automatically when you perform any operation on instances of that class with columns corresponding to the instance variables of the class except those which begin with the character "_". If an instance variable starts with an upper case letter it will be indexed.
To update a record, fetch it and call the update: method passing it in as the argument to save it's preious values. You can then modify it and call commit to update it's record. Delete operations on objects also accumulate and need to be commited to take effect.
| + (int) commit |
| - (int) commit |
| + (int) commitTransaction |
| - (int) commitTransaction |
| - (id) copyJoinKeysFrom: | (id) | parent | |
| to: | (id) | newChild | |
| + (int) delete: | (id) | record |
| - (int) delete: | (id) | object |
| + (int) deleteArray: | (const OOArray<id> &) | objects |
| - (int) deleteArray: | (const OOArray< id > &) | objects |
| + (BOOL) exec: | (cOOString) | fmt | |
| , | ... | ||
| - (BOOL) exec: | (cOOString) | sql | |
| , | ... | ||
| + (int) indate: | (id) | record |
| - (int) indate: | (id) | object |
| - (id) initPath: | (cOOString) | path |
Designated initialiser for OODatabase instances. Generally only the shared instance is used and the OODatabase class object is messaged instead.
| + (int) insert: | (id) | record |
| - (int) insert: | (id) | object |
| + (int) insertArray: | (const OOArray<id> &) | objects |
| - (int) insertArray: | (const OOArray< id > &) | objects |
| - (long long) lastInsertRowID |
|
implementation |
| - (OOStringArray) registerSubclassesOf: | (Class) | recordSuperClass |
| - (void) registerTableClassesNamed: | (cOOStringArray) | classes |
Register a list of classes before using them so OODatabase can determine the relationships between them.
| + (int) rollback |
| - (int) rollback |
| - (long long) rowIDForRecord: | (id) | record |
| + (OODatabase *) sharedInstance |
By default database file is "objsql.db" in the user/application's "Documents" directory and a single shared OODatabase instance used for all db operations.
| + (OODatabase *) sharedInstanceForPath: | (cOOString) | path |
| - (OOMetaData *) tableMetaDataForClass: | (Class) | recordClass |
Find/create an instance of the OOMetaData class which describes a record class and its associated table. If the table does not exist it will be created along with indexes for columns/ivars which have upper case names for use in joins. Details of the tables parameters can be controlled by using methods in the OOTableCustomisation protool. If it does not exist a meta table class which prepresents OOMetaData records themselves is also created from which the list of all registered tables can be selected.
| - (OOArray< OOMetaData * >) tablesRelatedByNaturalJoinFrom: | (id) | record |
| + (int) update: | (id) | record |
Call this method if you intend to make changes to the record object and save them to the database. This takes a snapshot of the previous values to use as a key for the update operation when "commit" is called. Returns the total number of outstanding inserts/updates/deletes.
| - (int) update: | (id) | object |
| + (int) upsert: | (id) | record |
| - (int) upsert: | (id) | object |
|
implementation |
|
protected |
| - (OOArray<OOValueDictionary >) results |
|
protected |
| - (OOArray<OOValueDictionary >) transaction |
1.8.2