PHP Класс PMA\libraries\Tracker

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$enabled Whether tracking is ready.

Открытые методы

Метод Описание
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, .

Защищенные методы

Метод Описание
getTableName ( string $string ) : string Parses the name of a table from a SQL statement substring.

Приватные методы

Метод Описание
_changeTracking ( string $dbname, string $tablename, string $version, integer $new_state ) : integer Changes tracking of a table.
_getTrackingTable ( ) : string Returns the tracking table

Описание методов

activateTracking() публичный статический Метод

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
Результат integer result of SQL query

changeTrackingData() публичный статический Метод

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
Результат boolean result of change

createDatabaseVersion() публичный статический Метод

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
Результат integer result of version insertion

createVersion() публичный статический Метод

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
Результат integer result of version insertion

deactivateTracking() публичный статический Метод

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
Результат integer result of SQL query

deleteTracking() публичный статический Метод

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
Результат integer result of version insertion

enable() публичный статический Метод

Actually enables tracking. This needs to be done after all underlaying code is initialized.
public static enable ( ) : void
Результат void

getLogComment() публичный статический Метод

Returns the comment line for the log.
public static getLogComment ( ) : string
Результат string Comment, contains date and username

getTableName() защищенный статический Метод

Parses the name of a table from a SQL statement substring.
protected static getTableName ( string $string ) : string
$string string part of SQL statement
Результат string the name of table

getTrackedData() публичный статический Метод

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
Результат mixed record DDM log, DDL log, structure snapshot, tracked statements.

getVersion() публичный статический Метод

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
Результат integer (-1 if no version exists | > 0 if a version exists)

handleQuery() публичный статический Метод

Analyzes a given SQL statement and saves tracking data.
public static handleQuery ( string $query ) : void
$query string a SQL query
Результат void

isActive() публичный статический Метод

Gets the on/off value of the Tracker module, starts initialization.
public static isActive ( ) : boolean
Результат boolean (true=on|false=off)

isTracked() публичный статический Метод

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
Результат boolean true or false

parseQuery() публичный статический Метод

..) - type of statement, is it part of DDL or DML ? - tablename
public static parseQuery ( string $query ) : mixed
$query string query
Результат mixed Array containing identifier, type and tablename.

Описание свойств

$enabled защищенное статическое свойство

Whether tracking is ready.
protected static $enabled