MythTV
master
|
Provides UI and helper functions for DB Schema updates. More...
#include <libmyth/schemawizard.h>
Public Member Functions | |
SchemaUpgradeWizard (QString DBSchemaSetting, QString appName, QString upgradeSchemaVal) | |
~SchemaUpgradeWizard () override | |
MythDBBackupStatus | BackupDB (void) |
Call DBUtil::BackupDB(), and store results. More... | |
int | Compare (void) |
How many schema versions old is the DB? More... | |
enum MythSchemaUpgrade | PromptForUpgrade (const char *name, bool upgradeAllowed, bool upgradeIfNoUI, int minDBMSmajor=0, int minDBMSminor=0, int minDBMSpoint=0) |
Query user, to prevent silent, automatic database upgrades. More... | |
Public Member Functions inherited from DBUtil | |
DBUtil ()=default | |
Constructs the DBUtil object. More... | |
~DBUtil ()=default | |
QString | GetDBMSVersion (void) |
Returns the QString version name of the DBMS or QString() in the event of an error. More... | |
int | CompareDBMSVersion (int major, int minor=0, int point=0) |
Compares the version of the active DBMS with the provided version. More... | |
Static Public Member Functions | |
static SchemaUpgradeWizard * | Get (const QString &DBSchemaSetting, const QString &appName, const QString &upgradeSchemaVal) |
Instead of creating a new wizard, use the existing one for its DB backup file & results and expert settings. More... | |
Static Public Member Functions inherited from DBUtil | |
static MythDBBackupStatus | BackupDB (QString &filename, bool disableRotation=false) |
Requests a backup of the database. More... | |
static bool | CheckTables (bool repair=false, const QString &options="QUICK") |
Checks database tables. More... | |
static bool | RepairTables (const QStringList &tables) |
Repairs database tables. More... | |
static bool | IsNewDatabase (void) |
Returns true for a new (empty) database. More... | |
static bool | IsBackupInProgress (void) |
Test to see if a DB backup is in progress. More... | |
static int | CountClients (void) |
Estimate the number of MythTV programs using the database. More... | |
static bool | TryLockSchema (MSqlQuery &query, uint timeout_secs) |
Try to get a lock on the table schemalock. More... | |
static void | UnlockSchema (MSqlQuery &query) |
static bool | CheckTimeZoneSupport (void) |
Check if MySQL has working timz zone support. More... | |
static bool | CheckTableColumnExists (const QString &tableName, const QString &columnName) |
Checks for the presence of a column in a table in the current database. More... | |
Public Attributes | |
QString | m_DBver |
Schema version in the database. More... | |
bool | m_emptyDB {false} |
Is the database currently empty? More... | |
int | m_versionsBehind {-1} |
How many schema versions old is the DB? More... | |
MythDBBackupStatus | m_backupStatus {kDB_Backup_Unknown} |
BackupDB() status. More... | |
Private Member Functions | |
void | BusyPopup (const QString &message) |
Delete any current "busy" popup, create new one. More... | |
Static Private Member Functions | |
static MythSchemaUpgrade | GuiPrompt (const QString &message, bool upgradable, bool expert) |
Private Attributes | |
bool | m_autoUpgrade {false} |
If no UI, always upgrade. More... | |
QString | m_backupResult |
File path, or FAILED More... | |
MythUIBusyDialog * | m_busyPopup {nullptr} |
Displayed during long pauses. More... | |
bool | m_expertMode {false} |
Also allow newer DB schema. More... | |
QString | m_schemaSetting |
To lookup the schema version. More... | |
QString | m_schemaName |
Shown to user in logs. More... | |
QString | m_newSchemaVer |
What we need to upgrade to. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from DBUtil | |
static const int | kUnknownVersionNumber = INT_MIN |
Static Protected Member Functions inherited from DBUtil | |
static bool | CreateTemporaryDBConf (const QString &privateinfo, QString &filename) |
Creates temporary file containing sensitive DB info. More... | |
Provides UI and helper functions for DB Schema updates.
See dbcheck.cpp's UpgradeTVDatabaseSchema() for usage.
Definition at line 25 of file schemawizard.h.
SchemaUpgradeWizard::SchemaUpgradeWizard | ( | QString | DBSchemaSetting, |
QString | appName, | ||
QString | upgradeSchemaVal | ||
) |
Definition at line 26 of file schemawizard.cpp.
Referenced by Get().
|
override |
Definition at line 48 of file schemawizard.cpp.
MythDBBackupStatus SchemaUpgradeWizard::BackupDB | ( | void | ) |
Call DBUtil::BackupDB(), and store results.
Definition at line 86 of file schemawizard.cpp.
Referenced by PromptForUpgrade().
int SchemaUpgradeWizard::Compare | ( | void | ) |
How many schema versions old is the DB?
Definition at line 100 of file schemawizard.cpp.
Referenced by PromptForUpgrade(), tryUpgradeMusicDatabaseSchema(), and tryUpgradeTVDatabaseSchema().
|
static |
Instead of creating a new wizard, use the existing one for its DB backup file & results and expert settings.
Definition at line 54 of file schemawizard.cpp.
Referenced by tryUpgradeMusicDatabaseSchema(), and tryUpgradeTVDatabaseSchema().
enum MythSchemaUpgrade SchemaUpgradeWizard::PromptForUpgrade | ( | const char * | name, |
bool | upgradeAllowed, | ||
bool | upgradeIfNoUI, | ||
int | minDBMSmajor = 0 , |
||
int | minDBMSminor = 0 , |
||
int | minDBMSpoint = 0 |
||
) |
Query user, to prevent silent, automatic database upgrades.
Tell the user that a schema needs to be upgraded, ask if that's OK, remind them about backups, et c.
The GUI buttons default to Exit. The shell command prompting requires an explicit "yes".
name | What schema are we planning to upgrade? (TV? Music?) |
upgradeAllowed | In not true, and DBSchemaAutoUpgrade isn't set for expert mode, this is just a few information messages |
upgradeIfNoUI | Default for non-interactive shells |
minDBMSmajor | Required minimum major version of mysql/mariadb. |
minDBMSminor | Required minimum minor version of mysql/mariadb. |
minDBMSpoint | Required minimum point version of mysql/mariadb. |
Definition at line 224 of file schemawizard.cpp.
Referenced by tryUpgradeMusicDatabaseSchema(), and tryUpgradeTVDatabaseSchema().
|
private |
Delete any current "busy" popup, create new one.
Definition at line 78 of file schemawizard.cpp.
|
staticprivate |
Definition at line 147 of file schemawizard.cpp.
Referenced by PromptForUpgrade().
QString SchemaUpgradeWizard::m_DBver |
Schema version in the database.
Definition at line 55 of file schemawizard.h.
Referenced by Compare(), Get(), PromptForUpgrade(), and tryUpgradeMusicDatabaseSchema().
Is the database currently empty?
Definition at line 56 of file schemawizard.h.
Referenced by BackupDB(), Compare(), and PromptForUpgrade().
int SchemaUpgradeWizard::m_versionsBehind {-1} |
How many schema versions old is the DB?
Definition at line 57 of file schemawizard.h.
Referenced by Compare(), Get(), and PromptForUpgrade().
MythDBBackupStatus SchemaUpgradeWizard::m_backupStatus {kDB_Backup_Unknown} |
BackupDB() status.
Definition at line 59 of file schemawizard.h.
Referenced by BackupDB(), and PromptForUpgrade().
If no UI, always upgrade.
Definition at line 66 of file schemawizard.h.
Referenced by PromptForUpgrade(), and SchemaUpgradeWizard().
|
private |
File path, or FAILED
Definition at line 67 of file schemawizard.h.
Referenced by BackupDB(), and PromptForUpgrade().
|
private |
Displayed during long pauses.
Definition at line 68 of file schemawizard.h.
Referenced by BusyPopup().
Also allow newer DB schema.
Definition at line 69 of file schemawizard.h.
Referenced by PromptForUpgrade(), and SchemaUpgradeWizard().
|
private |
To lookup the schema version.
Definition at line 70 of file schemawizard.h.
|
private |
Shown to user in logs.
Definition at line 71 of file schemawizard.h.
|
private |
What we need to upgrade to.
Definition at line 72 of file schemawizard.h.
Referenced by Compare(), Get(), and PromptForUpgrade().