dbcheck.cpp File Reference

Go to the source code of this file.

Functions

static bool UpdateDBVersionNumber (const QString &newnumber, QString &dbver)
 Updates the schema version stored in the database.
static bool performActualUpdate (const char **updates, const char *version, QString &dbver)
 Runs a number of SQL commands, and updates the schema version.
static bool InitializeDatabase (void)
 command to get the the initial database layout from an empty database:
static bool doUpgradeTVDatabaseSchema (void)
 This is called by UpgradeTVDatabaseSchema() to actually upgrade the schema to what MythTV expects.
bool UpgradeTVDatabaseSchema (const bool upgradeAllowed, const bool upgradeIfNoUI)
 Called from outside dbcheck.cpp to update the schema.

Variables

const QString currentDatabaseVersion = "1263"
 This is the DB schema version expected by the running MythTV instance.


Function Documentation

static bool UpdateDBVersionNumber ( const QString &  newnumber,
QString &  dbver 
) [static]

Updates the schema version stored in the database.

Updates "DBSchemaVer" property in the settings table.

Parameters:
newnumber New schema version.
dbver the database version at the end of the function is returned in this parameter, if things go well this will be 'newnumber'.

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

Referenced by doUpgradeTVDatabaseSchema(), DoVideoDatabaseSchemaUpgrade(), and performActualUpdate().

static bool performActualUpdate ( const char **  updates,
const char *  version,
QString &  dbver 
) [static]

Runs a number of SQL commands, and updates the schema version.

Parameters:
updates array of SQL commands to issue, terminated by a NULL 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'.
Returns:
true on success, false on failure

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

Referenced by DoOldDVDDatabaseSchemaUpgrage(), DoOldVideoDatabaseSchemaUpgrade(), doUpgradeMusicDatabaseSchema(), doUpgradeTVDatabaseSchema(), DoVideoDatabaseSchemaUpgrade(), InitializeDatabase(), InitializeDVDDatabase(), InitializeVideoDatabase(), performActualUpdate(), UpgradeArchiveDatabaseSchema(), UpgradeBrowserDatabaseSchema(), UpgradeGalleryDatabaseSchema(), UpgradeGameDatabaseSchema(), and UpgradeNewsDatabaseSchema().

bool InitializeDatabase ( void   )  [static]

command to get the the initial database layout from an empty database:

mysqldump --skip-comments --skip-opt --compact --skip-quote-names \ --ignore-table=schemalock mythconverg | \ sed '/^SET.*;$/d;s/^.*[^;]$/"&"/;s/^);$/");",/'

don't forget to add auto_increment annotations

command to get the initial data:

mysqldump --skip-comments --skip-opt --compact --skip-quote-names -t \ mythconverg | sed 's/^.*$/"&",/'

don't forget to delete host specific data

Definition at line 5524 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 536 of file mythtv/libs/libmythtv/dbcheck.cpp.

Referenced by UpgradeTVDatabaseSchema().

bool UpgradeTVDatabaseSchema ( const bool  upgradeAllowed,
const bool  upgradeIfNoUI 
)

Called from outside dbcheck.cpp to update the schema.

If the "DBSchemaVer" property equals the currentDatabase version this returns true immediately. If not, we try to do a database backup, prompt the user for permission to do the upgrade, lock the schemalock table, 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:
false on failure, error, or if the user selected "Exit."

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

Referenced by main(), and run_backend().


Variable Documentation

const QString currentDatabaseVersion = "1263"


Generated on Sat Sep 4 06:39:40 2010 for MythTV by  doxygen 1.5.5