SchemaUpgradeWizard Class Reference

Provides UI and helper functions for DB Schema updates. More...

#include <schemawizard.h>

Inheritance diagram for SchemaUpgradeWizard:
DBUtil

List of all members.

Public Member Functions

 SchemaUpgradeWizard (const QString &DBSchemaSetting, const QString &appName, const QString &upgradeSchemaVal)
 ~SchemaUpgradeWizard ()
MythDBBackupStatus BackupDB (void)
 Call DBUtil::BackupDB(), and store results.
int Compare (void)
 How many schema versions old is the DB?
enum MythSchemaUpgrade PromptForUpgrade (const char *name, const bool upgradeAllowed, const bool upgradeIfNoUI, const int minDMBSmajor=0, const int minDBMSminor=0, const int minDBMSpoint=0)
 Query user, to prevent silent, automatic database upgrades.

Static Public Member Functions

static SchemaUpgradeWizardGet (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.

Public Attributes

QString DBver
 Schema version in the database.
bool emptyDB
 Is the database currently empty?
int versionsBehind
 How many schema versions old is the DB?
MythDBBackupStatus backupStatus
 BackupDB() status.

Private Member Functions

void BusyPopup (const QString &message)
 Delete any current "busy" popup, create new one.
MythSchemaUpgrade GuiPrompt (const QString &message, bool upgradable, bool expert)

Private Attributes

bool m_autoUpgrade
 If no UI, always upgrade.
QString m_backupResult
 File path, or __FAILED__.
MythUIBusyDialogm_busyPopup
 Displayed during long pauses.
bool m_expertMode
 Also allow newer DB schema.
QString m_schemaSetting
 To lookup the schema version.
QString m_schemaName
 Shown to user in logs.
QString m_newSchemaVer
 What we need to upgrade to.

Detailed Description

Provides UI and helper functions for DB Schema updates.

See dbcheck.cpp's UpgradeTVDatabaseSchema() for usage.

Definition at line 25 of file schemawizard.h.


Constructor & Destructor Documentation

SchemaUpgradeWizard::SchemaUpgradeWizard ( const QString &  DBSchemaSetting,
const QString &  appName,
const QString &  upgradeSchemaVal 
)

Definition at line 19 of file schemawizard.cpp.

Referenced by Get().

SchemaUpgradeWizard::~SchemaUpgradeWizard (  ) 

Definition at line 47 of file schemawizard.cpp.


Member Function Documentation

MythDBBackupStatus SchemaUpgradeWizard::BackupDB ( void   ) 

Call DBUtil::BackupDB(), and store results.

Definition at line 85 of file schemawizard.cpp.

Referenced by PromptForUpgrade().

int SchemaUpgradeWizard::Compare ( void   ) 

How many schema versions old is the DB?

Definition at line 99 of file schemawizard.cpp.

Referenced by PromptForUpgrade(), UpgradeMusicDatabaseSchema(), and UpgradeTVDatabaseSchema().

SchemaUpgradeWizard * SchemaUpgradeWizard::Get ( const QString &  DBSchemaSetting,
const QString &  appName,
const QString &  upgradeSchemaVal 
) [static]

Instead of creating a new wizard, use the existing one for its DB backup file & results and expert settings.

Definition at line 53 of file schemawizard.cpp.

Referenced by UpgradeMusicDatabaseSchema(), and UpgradeTVDatabaseSchema().

enum MythSchemaUpgrade SchemaUpgradeWizard::PromptForUpgrade ( const char *  name,
const bool  upgradeAllowed,
const bool  upgradeIfNoUI,
const int  minDBMSmajor = 0,
const int  minDBMSminor = 0,
const 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".

Parameters:
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
Todo:
Clarify whether the minDBMS stuff is just for upgrading, or if it is a runtime requirement too. If the latter, then this possibly should be called even if the schema match, to ensure the user is informed of the MySQL upgrade requirement.
Todo:
This uses GetMythUI()->IsScreenSetup() to work out if this program's context is a GUI, but GetMythUI() might create a MythUIHelper. Having a static bool MythUIHelper::ValidMythUI() would be much tidier?

Definition at line 197 of file schemawizard.cpp.

Referenced by UpgradeMusicDatabaseSchema(), and UpgradeTVDatabaseSchema().

void SchemaUpgradeWizard::BusyPopup ( const QString &  message  )  [private]

Delete any current "busy" popup, create new one.

Wish there was a way to change the message on existing popup.

Definition at line 77 of file schemawizard.cpp.

MythSchemaUpgrade SchemaUpgradeWizard::GuiPrompt ( const QString &  message,
bool  upgradable,
bool  expert 
) [private]

Definition at line 143 of file schemawizard.cpp.

Referenced by PromptForUpgrade().


Member Data Documentation

Schema version in the database.

Definition at line 55 of file schemawizard.h.

Referenced by Compare(), Get(), PromptForUpgrade(), and UpgradeMusicDatabaseSchema().

Is the database currently empty?

Definition at line 56 of file schemawizard.h.

Referenced by BackupDB(), Compare(), and PromptForUpgrade().

How many schema versions old is the DB?

Definition at line 57 of file schemawizard.h.

Referenced by Compare(), Get(), and PromptForUpgrade().

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().

File path, or __FAILED__.

Definition at line 67 of file schemawizard.h.

Referenced by BackupDB(), and PromptForUpgrade().

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().

To lookup the schema version.

Definition at line 70 of file schemawizard.h.

Referenced by Compare(), and Get().

Shown to user in logs.

Definition at line 71 of file schemawizard.h.

Referenced by Compare(), and Get().

What we need to upgrade to.

Definition at line 72 of file schemawizard.h.

Referenced by Compare(), Get(), and PromptForUpgrade().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Fri May 25 06:42:22 2012 for MythTV by  doxygen 1.6.3