ePages 6.10 - DE_EPAGES/Database/API/DatabaseInstaller.pm

Package DE_EPAGES::Database::API::DatabaseInstaller

install/patch/uninstall with the database directory, the directory is defined by functions databaseDirectory, EPAGES_CARTRIDGES/DE_EPAGES::Core::API::BaseInstaller::cartridgeDirectory/Database/DE_EPAGES::Database::API::DBI::driverName

Base
DE_EPAGES::XML::API::XMLInstaller

Functions

databaseDirectory
doPatchDBStructure
finishPatchDBStructure
getDBStructureVersion
hasDBSchema
install
new
onPatchProcessSingleFile
patchDBStructure
setDBStructureVersion
startPatchDBStructure
uninstall

databaseDirectory

Returns sql install/uninstall directory, for example /epages/Cartridges/COMPANY/CARTRIDGE/Database/Sybase.

Syntax
$Directory = $Installer->databaseDirectory;
Return
$Directory (string)
directory where the sql files stored

doPatchDBStructure

Patches cartridge db structure in the active database. Calls methods named "patchDBStructure_$DBStructureVersion", where $DBStructureVersion is the actual db structure version of the cartridge ('.' are replaced with '_') until the current cartridge version is reached. Calls DE_EPAGES::XML::API::XMLInstaller::importPatchDir("Patch_$DBStructureVersion") if the function patchDBStructure_$DBStructureVersion does not exist.

Syntax
$Installer->doPatchDBStructure;

finishPatchDBStructure

Writes a log entry when the database structure is up to date.

Syntax
$Installer->finishPatchDBStructure;

getDBStructureVersion

Returns the current database structure version. Actually returns $self->installedVersion. This method is overloaded by DE_EPAGES::Cartridge::API::CartridgeInstaller.

Syntax
$DBStructureVersion = $Installer->getDBStructureVersion;

hasDBSchema

Gets information if the cartridge has additional tables or not.

Syntax
$hasShema = $Installer->hasDBSchema;
Return
$hasShema (boolean)
cartridge database driver directory will be processed

install

Calls DE_EPAGES::Core::API::FileInstaller::install and process the database directory of the current driver if the database directory exists and hasDBSchema returns true.

Syntax
$Installer->install;

new

Creates a new database installer object.

Syntax
DE_EPAGES::Database::API::DatabaseInstaller->new(%Options);
Input
%Options (hash)
option
  • CartridgeDirectory - cartridge base directory (DE_EPAGES/Database) - string
  • HasDbSchema - database driver directory will be processed (optional default=1) - boolean

onPatchProcessSingleFile

Called by PatchImportHandler by Method onPatchProcessSingleFile. Process sql at file $File if file includes $dbi->driverName.

Syntax
$Installer->onPatchProcessSingleFile($File, $hParams);
Example
$Installer->onPatchProcessSingleFile(
          'Database/Sybase/Procedures/i_Cartridge.sql',
          {'CVS' => 'Changed',
          });
Input
$File (string)
cartridgefilename without cartridge directory
$hParams (ref.hash.*)
patch file parameters, keys are
  • CVS - could be Deleted, New or Changed - string
  • Force - process is forced (not stops) (optional default 0)- boolean

patchDBStructure

Patches the database structure of the cartridge in the current dataabase to the newest level. The default implementation calls startPatchDBStructure, doPatchDBStructure and finishPatchDBStructure if the cartridge is installed.

Syntax
$Installer->patchDBStructure;

setDBStructureVersion

Sets the current database structure version. Actually does nothing. This method is overloaded by DE_EPAGES::Cartridge::API::CartridgeInstaller.

Syntax
$Installer->setDBStructureVersion( $Version );

startPatchDBStructure

Writes a log entry when the database structure update starts.

Syntax
$Installer->startPatchDBStructure;

uninstall

Calls DE_EPAGES::Core::API::FileInstaller::uninstall and cleanc the database with the database directory of the current driver.

Syntax
$Installer->uninstall;