ePages 6.10 - DE_EPAGES/Object/API/SQLCompare.pm

Package DE_EPAGES::Object::API::SQLCompare

This module compare sql files. There are two main functions to check if two sql are equal and to get information about missing or too much tables, columns, foreign keys, indices and changed values, etc. ... .

@EXPORT_OK
CompareSQL
GetDiff

Functions

CompareSQL
GetDiff

CompareSQL

Looks if all tables indices and constraints from reference file are placed in the control file. Print all missing and too much tables, foreign keys, columns etc. if printmessage is set in options.

Syntax
$SQLFilesEqual = CompareSQL( $ReferenceFileName, $ControlFileName, $$hOptions );
Example
$SQLFilesEqual = CompareSQL( 'test1.sql', 'test2.sql', {'printmessage'} => '1' );
Input
$ReferenceFileName (string)
SQL file name for the file that expect to be correct
$ControlFileName (string)
SQL file name to control
$hOptions (hash)

  • printmessage => '1'/'0'
Return
$SQLFilesEqual (boolean)
true if both sql files are equal

GetDiff

returns the diff informations that exists between two sql files return a list of all missing/ too much tables, columns, indices, foreign keys etc.

Syntax
$hDiff = GetDiff( $OldSQLFile, $NewSQLFile );
Example
$hDiff = GetDiff( 'test(old).sql', 'test(new).sql');
Input
$OldSQLFile (string)
SQL file name for the file that expect to be wright
$NewSQLFile (string)
SQL file name to control
Return
$hDiff (ref.hash)
list of all missing/ too much tables, columns, indices, foreign keys etc.