PLDatabaseMigrationManager Class Reference

The PLDatabaseMigrationManager implements transactional, versioned migration/initialization of database schema and data. More...

List of all members.

Public Member Functions

(id) - initWithConnectionProvider:transactionManager:versionManager:delegate:
 Manages database migration and initialization.
(BOOL) - migrateAndReturnError:
 Open a new database connection and allow the PLDatabaseMigrationDelegate to perform any pending migrations.


Detailed Description

The PLDatabaseMigrationManager implements transactional, versioned migration/initialization of database schema and data.

Arbitrary migrations may be supplied via a PLDatabaseMigrationDelegate. The database versioning meta-data is maintained by a supplied PLDatabaseMigrationVersionManager. This class makes no assumptions about the migrations applied or the methods used to retrieve or update database schema versions.

Thread Safety
PLDatabaseMigrationManager instances are not required to implement any locking and must not be shared between threads.

Member Function Documentation

- (id) initWithConnectionProvider: (id<PLDatabaseConnectionProvider>)  connectionProvider
transactionManager: (id<PLDatabaseMigrationTransactionManager>)  lockManager
versionManager: (id<PLDatabaseMigrationVersionManager>)  versionManager
delegate: (id<PLDatabaseMigrationDelegate>)  delegate 

Manages database migration and initialization.

Parameters:
connectionProvider Database conection provider.
lockManager An object implementing the PLDatabaseMigrationTransactionManager protocol.
versionManager An object implementing the PLDatabaseMigrationVersionManager protocol.
delegate An object implementing the formal PLDatabaseMigrationDelegate protocol.

- (BOOL) migrateAndReturnError: (NSError **)  outError  

Open a new database connection and allow the PLDatabaseMigrationDelegate to perform any pending migrations.

If the migration delegate returns success (YES), the PLDatabaseMigrationVersionManager will be used to set the provided version number.

If the delegate returns failure (NO), the database will not be modified in any way (including the addition of a database version number).

A transaction will be opened prior to the delegate being called. The transaction will be committed upon the return of a success value (YES). If this method returns NO, the entire transaction will be aborted.

Failure to open the database, or returning NO from the delegate, will cause database initialization to fail, and this method will return NO.

Parameters:
outError A pointer to an NSError object variable. If an error occurs, this pointer will contain an error object indicating why the migration could not be completed. If no error occurs, this parameter will be left unmodified. You may specify NULL for this parameter, and no error information will be provided.
Returns:
YES on successful migration, or NO if migration failed. If NO is returned, all modifications will be rolled back.


The documentation for this class was generated from the following files:

Generated on Mon Aug 31 21:35:04 2009 for PlausibleDatabase by  doxygen 1.5.9