class ExportCodegen extends ExportPlugin

Handles the export for the CodeGen class

Properties

protected ExportPluginProperties $properties PhpMyAdmin\Properties\Plugins\ExportPluginProperties object containing the specific export plugin type properties from ExportPlugin
Relation $relation from ExportPlugin
protected Export $export from ExportPlugin
protected Transformations $transformations from ExportPlugin

Methods

__construct()

Constructor

bool
exportHeader()

Outputs export header

bool
exportFooter()

Outputs export footer

bool
exportDBHeader(string $db, string $db_alias = '')

Outputs database header

bool
exportDBFooter(string $db)

Outputs database footer

bool
exportDBCreate(string $db, string $export_type, string $db_alias = '')

Outputs CREATE DATABASE statement

bool
exportData(string $db, string $table, string $crlf, string $error_url, string $sql_query, array $aliases = [])

Outputs the content of a table in NHibernate format

bool
exportRoutines(string $db, array $aliases = [])

Exports routines (procedures and functions)

bool
exportEvents(string $db)

Exports events

bool
exportStructure(string $db, string $table, string $crlf, string $error_url, string $export_mode, string $export_type, bool $relation = false, bool $comments = false, bool $mime = false, bool $dates = false, array $aliases = [])

Outputs table's structure

bool
exportMetadata(string $db, string|array $tables, array $metadataTypes)

Exports metadata from Configuration Storage

string
getTableDefStandIn(string $db, string $view, string $crlf, array $aliases = [])

Returns a stand-in CREATE definition to resolve view dependencies

string
getTriggers(string $db, string $table)

Outputs triggers

void
initSpecificVariables()

Initialize the local variables that are used for export CodeGen

getProperties()

Gets the export specific format plugin properties

void
setProperties()

Sets the export CodeGen properties

void
initAlias(array $aliases, string $db, string $table = null)

Initialize aliases

string
getAlias(array $aliases, string $id, string $type = 'dbtblcol', string $db = '', string $tbl = '')

Search for alias of a identifier.

string
getRelationString(array $res_rel, string $field_name, string $db, array $aliases = [])

Gives the relation string and also substitutes with alias if required in this format: [Foreign Table] ([Foreign Field])

static string
cgMakeIdentifier(string $str, bool $ucfirst = true)

Used to make identifiers (from table or database names)

Details

at line 46
__construct()

Constructor

at line 120
bool exportHeader()

Outputs export header

Return Value

bool Whether it succeeded

at line 130
bool exportFooter()

Outputs export footer

Return Value

bool Whether it succeeded

at line 143
bool exportDBHeader(string $db, string $db_alias = '')

Outputs database header

Parameters

string $db Database name
string $db_alias Aliases of db

Return Value

bool Whether it succeeded

at line 155
bool exportDBFooter(string $db)

Outputs database footer

Parameters

string $db Database name

Return Value

bool Whether it succeeded

at line 169
bool exportDBCreate(string $db, string $export_type, string $db_alias = '')

Outputs CREATE DATABASE statement

Parameters

string $db Database name
string $export_type 'server', 'database', 'table'
string $db_alias Aliases of db

Return Value

bool Whether it succeeded

at line 186
bool exportData(string $db, string $table, string $crlf, string $error_url, string $sql_query, array $aliases = [])

Outputs the content of a table in NHibernate format

Parameters

string $db database name
string $table table name
string $crlf the end of line sequence
string $error_url the url to go back in case of error
string $sql_query SQL query for obtaining data
array $aliases Aliases of db/table/columns

Return Value

bool Whether it succeeded

in ExportPlugin at line 137
bool exportRoutines(string $db, array $aliases = [])

Exports routines (procedures and functions)

Parameters

string $db Database
array $aliases Aliases of db/table/columns

Return Value

bool Whether it succeeded

in ExportPlugin at line 148
bool exportEvents(string $db)

Exports events

Parameters

string $db Database

Return Value

bool Whether it succeeded

in ExportPlugin at line 174
bool exportStructure(string $db, string $table, string $crlf, string $error_url, string $export_mode, string $export_type, bool $relation = false, bool $comments = false, bool $mime = false, bool $dates = false, array $aliases = [])

Outputs table's structure

Parameters

string $db database name
string $table table name
string $crlf the end of line sequence
string $error_url the url to go back in case of error
string $export_mode 'create_table','triggers','create_view', 'stand_in'
string $export_type 'server', 'database', 'table'
bool $relation whether to include relation comments
bool $comments whether to include the pmadb-style column comments as comments in the structure; this is deprecated but the parameter is left here because /export calls exportStructure() also for other export types which use this parameter
bool $mime whether to include mime comments
bool $dates whether to include creation/update/check dates
array $aliases Aliases of db/table/columns

Return Value

bool Whether it succeeded

in ExportPlugin at line 198
bool exportMetadata(string $db, string|array $tables, array $metadataTypes)

Exports metadata from Configuration Storage

Parameters

string $db database being exported
string|array $tables table(s) being exported
array $metadataTypes types of metadata to export

Return Value

bool Whether it succeeded

in ExportPlugin at line 215
string getTableDefStandIn(string $db, string $view, string $crlf, array $aliases = [])

Returns a stand-in CREATE definition to resolve view dependencies

Parameters

string $db the database name
string $view the view name
string $crlf the end of line sequence
array $aliases Aliases of db/table/columns

Return Value

string resulting definition

in ExportPlugin at line 227
protected string getTriggers(string $db, string $table)

Outputs triggers

Parameters

string $db database name
string $table table name

Return Value

string Formatted triggers list

at line 59
protected void initSpecificVariables()

Initialize the local variables that are used for export CodeGen

Return Value

void

in ExportPlugin at line 247
ExportPluginProperties getProperties()

Gets the export specific format plugin properties

Return Value

ExportPluginProperties

at line 81
protected void setProperties()

Sets the export CodeGen properties

Return Value

void

in ExportPlugin at line 276
void initAlias(array $aliases, string $db, string $table = null)

Initialize aliases

Parameters

array $aliases Alias information for db/table/column
string $db the database
string $table the table

Return Value

void

in ExportPlugin at line 298
string getAlias(array $aliases, string $id, string $type = 'dbtblcol', string $db = '', string $tbl = '')

Search for alias of a identifier.

Parameters

array $aliases Alias information for db/table/column
string $id the identifier to be searched
string $type db/tbl/col or any combination of them representing what to be searched
string $db the database in which search is to be done
string $tbl the table in which search is to be done

Return Value

string alias of the identifier if found or ''

in ExportPlugin at line 363
string getRelationString(array $res_rel, string $field_name, string $db, array $aliases = [])

Gives the relation string and also substitutes with alias if required in this format: [Foreign Table] ([Foreign Field])

Parameters

array $res_rel the foreigners array
string $field_name the field name
string $db the field name
array $aliases Alias information for db/table/column

Return Value

string the Relation string

at line 217
static string cgMakeIdentifier(string $str, bool $ucfirst = true)

Used to make identifiers (from table or database names)

Parameters

string $str name to be converted
bool $ucfirst whether to make the first character uppercase

Return Value

string identifier