PHP Class PMA\libraries\Tracker

Afficher le fichier Open project: phpmyadmin/phpmyadmin Class Usage Examples

Protected Properties

Свойство Type Description
$enabled Whether tracking is ready.

Méthodes publiques

Méthode Description
activateTracking ( string $dbname, string $tablename, string $version ) : integer Activates tracking of a table.
changeTrackingData ( string $dbname, string $tablename, string $version, string $type, string | array $new_data ) : boolean Changes tracking data of a table.
createDatabaseVersion ( string $dbname, string $version, string $query, string $tracking_set = 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE' ) : integer Creates tracking version of a database (in other words: create a job to track future changes on the database).
createVersion ( string $dbname, string $tablename, string $version, string $tracking_set = '', boolean $is_view = false ) : integer Creates tracking version of a table / view (in other words: create a job to track future changes on the table).
deactivateTracking ( string $dbname, string $tablename, string $version ) : integer Deactivates tracking of a table.
deleteTracking ( string $dbname, string $tablename, string $version = '' ) : integer Removes all tracking data for a table or a version of a table
enable ( ) : void Actually enables tracking. This needs to be done after all underlaying code is initialized.
getLogComment ( ) : string Returns the comment line for the log.
getTrackedData ( string $dbname, string $tablename, string $version ) : mixed Gets the record of a tracking job.
getVersion ( string $dbname, string $tablename, string $statement = null ) : integer Gets the newest version of a tracking job (in other words: gets the HEAD version).
handleQuery ( string $query ) : void Analyzes a given SQL statement and saves tracking data.
isActive ( ) : boolean Gets the on/off value of the Tracker module, starts initialization.
isTracked ( string $dbname, string $tablename ) : boolean Gets the tracking status of a table, is it active or deactive ?
parseQuery ( string $query ) : mixed Parses a query. Gets - statement identifier (UPDATE, ALTER TABLE, .

Méthodes protégées

Méthode Description
getTableName ( string $string ) : string Parses the name of a table from a SQL statement substring.

Private Methods

Méthode Description
_changeTracking ( string $dbname, string $tablename, string $version, integer $new_state ) : integer Changes tracking of a table.
_getTrackingTable ( ) : string Returns the tracking table

Method Details

activateTracking() public static méthode

Activates tracking of a table.
public static activateTracking ( string $dbname, string $tablename, string $version ) : integer
$dbname string name of database
$tablename string name of table
$version string version
Résultat integer result of SQL query

changeTrackingData() public static méthode

Changes tracking data of a table.
public static changeTrackingData ( string $dbname, string $tablename, string $version, string $type, string | array $new_data ) : boolean
$dbname string name of database
$tablename string name of table
$version string version
$type string type of data(DDL || DML)
$new_data string | array the new tracking data
Résultat boolean result of change

createDatabaseVersion() public static méthode

Creates tracking version of a database (in other words: create a job to track future changes on the database).
public static createDatabaseVersion ( string $dbname, string $version, string $query, string $tracking_set = 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE' ) : integer
$dbname string name of database
$version string version
$query string query
$tracking_set string set of tracking statements
Résultat integer result of version insertion

createVersion() public static méthode

Creates tracking version of a table / view (in other words: create a job to track future changes on the table).
public static createVersion ( string $dbname, string $tablename, string $version, string $tracking_set = '', boolean $is_view = false ) : integer
$dbname string name of database
$tablename string name of table
$version string version
$tracking_set string set of tracking statements
$is_view boolean if table is a view
Résultat integer result of version insertion

deactivateTracking() public static méthode

Deactivates tracking of a table.
public static deactivateTracking ( string $dbname, string $tablename, string $version ) : integer
$dbname string name of database
$tablename string name of table
$version string version
Résultat integer result of SQL query

deleteTracking() public static méthode

Removes all tracking data for a table or a version of a table
public static deleteTracking ( string $dbname, string $tablename, string $version = '' ) : integer
$dbname string name of database
$tablename string name of table
$version string version
Résultat integer result of version insertion

enable() public static méthode

Actually enables tracking. This needs to be done after all underlaying code is initialized.
public static enable ( ) : void
Résultat void

getLogComment() public static méthode

Returns the comment line for the log.
public static getLogComment ( ) : string
Résultat string Comment, contains date and username

getTableName() protected static méthode

Parses the name of a table from a SQL statement substring.
protected static getTableName ( string $string ) : string
$string string part of SQL statement
Résultat string the name of table

getTrackedData() public static méthode

Gets the record of a tracking job.
public static getTrackedData ( string $dbname, string $tablename, string $version ) : mixed
$dbname string name of database
$tablename string name of table
$version string version number
Résultat mixed record DDM log, DDL log, structure snapshot, tracked statements.

getVersion() public static méthode

Gets the newest version of a tracking job (in other words: gets the HEAD version).
public static getVersion ( string $dbname, string $tablename, string $statement = null ) : integer
$dbname string name of database
$tablename string name of table
$statement string tracked statement
Résultat integer (-1 if no version exists | > 0 if a version exists)

handleQuery() public static méthode

Analyzes a given SQL statement and saves tracking data.
public static handleQuery ( string $query ) : void
$query string a SQL query
Résultat void

isActive() public static méthode

Gets the on/off value of the Tracker module, starts initialization.
public static isActive ( ) : boolean
Résultat boolean (true=on|false=off)

isTracked() public static méthode

Gets the tracking status of a table, is it active or deactive ?
public static isTracked ( string $dbname, string $tablename ) : boolean
$dbname string name of database
$tablename string name of table
Résultat boolean true or false

parseQuery() public static méthode

..) - type of statement, is it part of DDL or DML ? - tablename
public static parseQuery ( string $query ) : mixed
$query string query
Résultat mixed Array containing identifier, type and tablename.

Property Details

$enabled protected_oe static_oe property

Whether tracking is ready.
protected static $enabled