LDAP Account Manager

MySQLConnector extends DatabaseConnector
in package

MySQL database connector.

Table of Contents

NAME_SYSTEM  = 'lam_system'
name for system schema
SCHEMA_VERSIONS  = 'lam_schema_versions'
table name for schema versions
getAlias()  : string
Returns the connector alias.
getName()  : string
Returns the connector name.
getPDOURL()  : string
Returns the PDO URL to connect to database.
initPDO()  : mixed
Initializes the PDO object.
isSupported()  : bool
Returns if this connector is supported on the current system.
needsDatabaseName()  : bool
Returns if a database name is required to connect.
needsHostName()  : bool
Returns if a host name is required to connect.
needsPassword()  : bool
Returns if a password is required to connect.
needsUser()  : bool
Returns if a user name is required to connect.
updateDBSchema()  : void
Updates the database schema if any updates are missing.
getSchemaVersionsTableName()  : string
Returns the name of the cron schema versions table.
createInitialSchema()  : void
Creates the initial system schema.
getSchemaVersion()  : int|null
Returns the schema version for $name or null if not yet installed.
setSchemaVersion()  : void
Sets the schema version for $name.
tableExists()  : bool
Checks if the given table name exists.
upgradeSystemTo2()  : void
Upgrades the system schema to version 2. Reduce message to 30000 chars because of MySQL limitation.
upgradeSystemTo3()  : void
Upgrades the system schema to version 3. Change primary key of job run table as it is not unique for job runs < 1s duration.

Constants

NAME_SYSTEM

name for system schema

public mixed NAME_SYSTEM = 'lam_system'

SCHEMA_VERSIONS

table name for schema versions

public mixed SCHEMA_VERSIONS = 'lam_schema_versions'

Methods

getAlias()

Returns the connector alias.

public getAlias() : string
Return values
string

name

getName()

Returns the connector name.

public getName() : string
Return values
string

name

getPDOURL()

Returns the PDO URL to connect to database.

public getPDOURL(string $configName, string $host, int $port, string $database) : string
Parameters
$configName : string

server profile name

$host : string

host name

$port : int

port number (optional)

$database : string

database name

Return values
string

PDO connection URL

initPDO()

Initializes the PDO object.

public initPDO(PDO &$pdo) : mixed
Parameters
$pdo : PDO

PDO object

Return values
mixed

isSupported()

Returns if this connector is supported on the current system.

public isSupported() : bool
Return values
bool

is supported

needsDatabaseName()

Returns if a database name is required to connect.

public needsDatabaseName() : bool
Return values
bool

database name is required

needsHostName()

Returns if a host name is required to connect.

public needsHostName() : bool
Return values
bool

host name is required

needsPassword()

Returns if a password is required to connect.

public needsPassword() : bool
Return values
bool

password is required

needsUser()

Returns if a user name is required to connect.

public needsUser() : bool
Return values
bool

user is required

updateDBSchema()

Updates the database schema if any updates are missing.

public updateDBSchema(array<string|int, Job$jobs, PDO $pdo) : void
Parameters
$jobs : array<string|int, Job>

jobs

$pdo : PDO
Return values
void

getSchemaVersionsTableName()

Returns the name of the cron schema versions table.

protected getSchemaVersionsTableName() : string
Return values
string

name of system table

createInitialSchema()

Creates the initial system schema.

private createInitialSchema(PDO $pdo) : void
Parameters
$pdo : PDO

PDO

Return values
void

getSchemaVersion()

Returns the schema version for $name or null if not yet installed.

private getSchemaVersion(PDO $pdo, string $name) : int|null
Parameters
$pdo : PDO

PDO

$name : string

job name

Return values
int|null

schema version or null

setSchemaVersion()

Sets the schema version for $name.

private setSchemaVersion(PDO $pdo, string $name, int $version) : void
Parameters
$pdo : PDO

PDO

$name : string

job name

$version : int

new schema version

Return values
void

tableExists()

Checks if the given table name exists.

private tableExists(PDO $pdo, string $tableName) : bool
Parameters
$pdo : PDO

PDO object

$tableName : string

table name to check

Return values
bool

table exists

upgradeSystemTo2()

Upgrades the system schema to version 2. Reduce message to 30000 chars because of MySQL limitation.

private upgradeSystemTo2(PDO $pdo) : void

Requires data copy because SQLite supports no change of column type.

Parameters
$pdo : PDO

PDO

Return values
void

upgradeSystemTo3()

Upgrades the system schema to version 3. Change primary key of job run table as it is not unique for job runs < 1s duration.

private upgradeSystemTo3(PDO $pdo) : void

Requires data copy because SQLite supports no change of column type.

Parameters
$pdo : PDO

PDO

Return values
void

Search results