Go to the source code of this file.
Functions | |
| static bool | UpdateDBVersionNumber (const QString &newnumber) |
| Updates the schema version stored in the database. | |
| static bool | performActualUpdate (const QString updates[], QString version, QString &dbver) |
| Runs a number of SQL commands, and updates the schema version. | |
| static bool | InitializeDatabase (void) |
| static bool | doUpgradeTVDatabaseSchema (void) |
| This is called by UpgradeTVDatabaseSchema() to actually upgrade the schema to what MythTV expects. | |
| bool | convert_diseqc_db (void) |
| bool | lockSchema (MSqlQuery &query) |
| Get a lock on the schemalock table. | |
| void | unlockSchema (MSqlQuery &query) |
| Release the lock on the schemalock table. | |
| int | CompareTVDatabaseSchemaVersion (void) |
| Called from outside dbcheck.cpp to compare the database schema version with the expected version. | |
| bool | UpgradeTVDatabaseSchema (void) |
| Called from outside dbcheck.cpp to update the schema. | |
Variables | |
| const QString | currentDatabaseVersion = "1214" |
| This is the DB schema version expected by the running MythTV instance. | |
| static bool UpdateDBVersionNumber | ( | const QString & | newnumber | ) | [static] |
Updates the schema version stored in the database.
Updates "DBSchemaVer" property in the settings table.
| newnumber | New schema version. |
Definition at line 351 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by doUpgradeTVDatabaseSchema(), and performActualUpdate().
| static bool performActualUpdate | ( | const QString | updates[], | |
| QString | version, | |||
| QString & | dbver | |||
| ) | [static] |
Runs a number of SQL commands, and updates the schema version.
| updates | array of SQL commands to issue, terminated by a "" string. | |
| version | version we are updating db to. | |
| dbver | the database version at the end of the function is returned in this parameter, if things go well this will be 'version'. |
Definition at line 402 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by DoOldDVDDatabaseSchemaUpgrage(), DoOldVideoDatabaseSchemaUpgrade(), doUpgradeTVDatabaseSchema(), DoVideoDatabaseSchemaUpgrade(), InitializeDatabase(), InitializeDVDDatabase(), InitializeVideoDatabase(), performActualUpdate(), UpgradeArchiveDatabaseSchema(), UpgradeFlixDatabaseSchema(), UpgradeGalleryDatabaseSchema(), UpgradeGameDatabaseSchema(), UpgradeMusicDatabaseSchema(), and UpgradePhoneDatabaseSchema().
| bool InitializeDatabase | ( | void | ) | [static] |
Definition at line 3645 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by doUpgradeTVDatabaseSchema(), mythplugin_init(), and UpgradeGameDatabaseSchema().
| static bool doUpgradeTVDatabaseSchema | ( | void | ) | [static] |
This is called by UpgradeTVDatabaseSchema() to actually upgrade the schema to what MythTV expects.
This function Initializes the database if the "DBSchemaVer" property does not exist in the database. Otherwise it upgrades the schema from the one in that property to the currentDatabaseVersion, by running the SQL commands needed for each upgrade between the two versions. This will only upgrade the schema, so bad things may happen if you upgrade and then downgrade MythTV across DB Schema versions.
Definition at line 611 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by UpgradeTVDatabaseSchema().
| bool convert_diseqc_db | ( | void | ) |
| lockSchema | ( | MSqlQuery & | query | ) |
Get a lock on the schemalock table.
Definition at line 444 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by CompareTVDatabaseSchemaVersion(), and UpgradeTVDatabaseSchema().
| unlockSchema | ( | MSqlQuery & | query | ) |
Release the lock on the schemalock table.
Definition at line 472 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by CompareTVDatabaseSchemaVersion(), and UpgradeTVDatabaseSchema().
| 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.
Definition at line 494 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by CheckSchemaVersion(), and main().
| 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.
Definition at line 526 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by CheckSchemaVersion(), and main().
| const QString currentDatabaseVersion = "1214" |
This is the DB schema version expected by the running MythTV instance.
Definition at line 18 of file mythtv/libs/libmythtv/dbcheck.cpp.
Referenced by CompareTVDatabaseSchemaVersion(), doUpgradeTVDatabaseSchema(), InitializeDatabase(), UpgradeArchiveDatabaseSchema(), UpgradeFlixDatabaseSchema(), UpgradeGalleryDatabaseSchema(), UpgradeGameDatabaseSchema(), UpgradeMusicDatabaseSchema(), UpgradePhoneDatabaseSchema(), and UpgradeTVDatabaseSchema().
1.5.5