class Tracker (View source)

This class tracks changes on databases, tables and views.

Properties

static protected array $trackingCache

Cache to avoid quering tracking status multiple times.

Methods

static void
enable()

Actually enables tracking. This needs to be done after all underlaying code is initialized.

static void
disable()

No description

static bool
isEnabled()

No description

static bool
isActive()

Gets the on/off value of the Tracker module, starts initialization.

static bool
isTracked(string $dbName, string $tableName)

Gets the tracking status of a table, is it active or disabled ?

static string
getLogComment()

Returns the comment line for the log.

static bool
createVersion(string $dbName, string $tableName, string $version, string $trackingSet = '', bool $isView = false)

Creates tracking version of a table / view (in other words: create a job to track future changes on the table).

static bool
createDatabaseVersion(string $dbName, string $version, string $query, string $trackingSet = 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE')

Creates tracking version of a database (in other words: create a job to track future changes on the database).

static bool
activateTracking(string $dbname, string $tablename, string $version)

Activates tracking of a table.

static bool
deactivateTracking(string $dbname, string $tablename, string $version)

Deactivates tracking of a table.

static array
parseQuery(string $query)

Parses a query. Gets

  • statement identifier (UPDATE, ALTER TABLE, ...)
  • type of statement, is it part of DDL or DML ?
  • tablename

static void
handleQuery(string $query)

Analyzes a given SQL statement and saves tracking data.

Details

static void enable()

Actually enables tracking. This needs to be done after all underlaying code is initialized.

Return Value

void

static void disable()

No description

Return Value

void

static bool isEnabled()

No description

Return Value

bool

static bool isActive()

Gets the on/off value of the Tracker module, starts initialization.

Return Value

bool

static bool isTracked(string $dbName, string $tableName)

Gets the tracking status of a table, is it active or disabled ?

Parameters

string $dbName

name of database

string $tableName

name of table

Return Value

bool

static string getLogComment()

Returns the comment line for the log.

Return Value

string

Comment, contains date and username

static bool createVersion(string $dbName, string $tableName, string $version, string $trackingSet = '', bool $isView = false)

Creates tracking version of a table / view (in other words: create a job to track future changes on the table).

Parameters

string $dbName

name of database

string $tableName

name of table

string $version version
string $trackingSet

set of tracking statements

bool $isView

if table is a view

Return Value

bool

static bool createDatabaseVersion(string $dbName, string $version, string $query, string $trackingSet = 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE')

Creates tracking version of a database (in other words: create a job to track future changes on the database).

Parameters

string $dbName

name of database

string $version version
string $query query
string $trackingSet

set of tracking statements

Return Value

bool

static bool activateTracking(string $dbname, string $tablename, string $version)

Activates tracking of a table.

Parameters

string $dbname

name of database

string $tablename

name of table

string $version version

Return Value

bool

static bool deactivateTracking(string $dbname, string $tablename, string $version)

Deactivates tracking of a table.

Parameters

string $dbname

name of database

string $tablename

name of table

string $version version

Return Value

bool

static array parseQuery(string $query)

Parses a query. Gets

  • statement identifier (UPDATE, ALTER TABLE, ...)
  • type of statement, is it part of DDL or DML ?
  • tablename

Parameters

string $query query

Return Value

array

containing identifier, type and tablename.

static void handleQuery(string $query)

Analyzes a given SQL statement and saves tracking data.

Parameters

string $query

a SQL query

Return Value

void