dbcheck.h File Reference

Go to the source code of this file.

Functions

MPUBLIC int CompareTVDatabaseSchemaVersion (void)
 Called from outside dbcheck.cpp to compare the database schema version with the expected version.
MPUBLIC bool UpgradeTVDatabaseSchema (void)
 Called from outside dbcheck.cpp to update the schema.


Function Documentation

MPUBLIC int CompareTVDatabaseSchemaVersion ( void   ) 

Called from outside dbcheck.cpp to compare the database schema version with the expected version.

If the "DBSchemaVer" property is not found (i.e. the schema has not been initialized, the function returns negative, as if the schema simply needed upgrading, so InitializeDatabase() can do its job.

We lock the schemalock table for write so that we block if there are any DB schema updates in progress. This will make sure that we get the correct schema version number after the updates are completed and the update process unlocks the schemalock table.

Returns:
negative, 0, or positive if the schema version is less than, equal to, or greater than the expected version

Definition at line 494 of file mythtv/libs/libmythtv/dbcheck.cpp.

Referenced by CheckSchemaVersion(), and main().

MPUBLIC bool UpgradeTVDatabaseSchema ( void   ) 

Called from outside dbcheck.cpp to update the schema.

If the "DBSchemaVer" property equals the currentDatabase version this returns true immediately. If not we lock the schemalock table. If this fails we return false. If it succeeds we call doUpgradeTVDatabaseSchema() to do the actual update, and then we unlock the schemalock table.

If the program running this function is killed while this is running then the schema may be corrupted.

Returns:
true on success, false on failure.

Definition at line 526 of file mythtv/libs/libmythtv/dbcheck.cpp.

Referenced by CheckSchemaVersion(), and main().


Generated on Sat Dec 18 05:15:51 2010 for MythTV by  doxygen 1.5.5