Client Database APIs

The generated package database class provides methods for managing the client database.

+ (void) createDatabase;
+ (void) deleteDatabase;
+ (BOOL) databaseExists;

Typically, createDatabase does not need to be called since it is called internally when necessary. An application may use deleteDatabase when uninstalling the application.

Use the transaction API to group several transactions together for better performance.

SUP101Customer *customer1 = [SUP101Customer findByPrimaryKey:101];
SUP101Customer *customer2 = [SUP101Customer findByPrimaryKey:102];

// Use one transaction for better performance with multiple changes
SUPLocalTransaction *tx = [SUP101SUP101DB beginTransaction];
[customer1 save];
[customer2 save];
// Commit the transaction
[tx commit];
// Submit the changes to the server
[customer1 submitPending];
[customer2 submitPending];