class ExportJson extends ExportPlugin (View source)

Handles the export for the JSON format

Properties

protected ExportPluginProperties $properties

Object containing the specific export plugin type properties.

from  ExportPlugin
static ExportType $exportType from  ExportPlugin
static bool $singleTable from  ExportPlugin
protected StructureOrData $structureOrData from  ExportPlugin

Methods

__construct(Relation $relation, Export $export, Transformations $transformations)

No description

bool
exportHeader()

Outputs export header

bool
exportFooter()

Outputs export footer

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

Outputs database header

bool
exportDBFooter(string $db)

Outputs database footer

bool
exportDBCreate(string $db, string $dbAlias = '')

Outputs CREATE DATABASE statement

bool
exportData(string $db, string $table, string $sqlQuery, array $aliases = [])

Outputs the content of a table in JSON format

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

Exports routines (procedures and functions)

bool
exportEvents(string $db)

Exports events

bool
exportRawQuery(string|null $db, string $sqlQuery)

Outputs result raw query in JSON format

bool
exportStructure(string $db, string $table, string $exportMode, 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, array $aliases = [])

Returns a stand-in CREATE definition to resolve view dependencies

void
init()

Plugin specific initializations.

getProperties()

Gets the export specific format plugin properties

setProperties()

Sets the export plugins properties and is implemented by each export plugin.

void
initAlias(array $aliases, string $db, string|null $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 $foreigners, string $fieldName, string $db, array $aliases = [])

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

static bool
isAvailable()

No description

void
setExportOptions(ServerRequest $request, array $exportConfig)

No description

StructureOrData
getStructureOrData()

No description

StructureOrData
setStructureOrData(mixed $valueFromRequest, mixed $valueFromConfig, StructureOrData $defaultValue)

No description

string
getName()

No description

string|false
encode(mixed $data)

Encodes the data into JSON

bool
doExportForQuery(DatabaseInterface $dbi, string $sqlQuery, string $buffer, array|null $aliases, string|null $db, string|null $table)

Export to JSON

Details

final __construct(Relation $relation, Export $export, Transformations $transformations)

No description

Parameters

Relation $relation
Export $export
Transformations $transformations

bool exportHeader()

Outputs export header

Return Value

bool

bool exportFooter()

Outputs export footer

Return Value

bool

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

Outputs database header

Parameters

string $db

Database name

string $dbAlias

Aliases of db

Return Value

bool

bool exportDBFooter(string $db)

Outputs database footer

Parameters

string $db

Database name

Return Value

bool

bool exportDBCreate(string $db, string $dbAlias = '')

Outputs CREATE DATABASE statement

Parameters

string $db

Database name

string $dbAlias

Aliases of db

Return Value

bool

bool exportData(string $db, string $table, string $sqlQuery, array $aliases = [])

Outputs the content of a table in JSON format

Parameters

string $db

database name

string $table

table name

string $sqlQuery

SQL query for obtaining data

array $aliases

Aliases of db/table/columns

Return Value

bool

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

bool exportEvents(string $db)

Exports events

Parameters

string $db Database

Return Value

bool

bool exportRawQuery(string|null $db, string $sqlQuery)

Outputs result raw query in JSON format

Parameters

string|null $db

the database where the query is executed

string $sqlQuery

the rawquery to output

Return Value

bool

bool exportStructure(string $db, string $table, string $exportMode, array $aliases = [])

Outputs table's structure

Parameters

string $db

database name

string $table

table name

string $exportMode

'create_table', 'triggers', 'create_view', 'stand_in'

array $aliases

Aliases of db/table/columns

Return Value

bool

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

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

Returns a stand-in CREATE definition to resolve view dependencies

Parameters

string $db

the database name

string $view

the view name

array $aliases

Aliases of db/table/columns

Return Value

string

resulting definition

protected void init()

Plugin specific initializations.

Return Value

void

PluginPropertyItem getProperties()

Gets the export specific format plugin properties

Return Value

PluginPropertyItem

protected ExportPluginProperties setProperties()

Sets the export plugins properties and is implemented by each export plugin.

Return Value

ExportPluginProperties

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

Initialize aliases

Parameters

array $aliases

Alias information for db/table/column

string $db

the database

string|null $table

the table

Return Value

void

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 ''

string getRelationString(array $foreigners, string $fieldName, string $db, array $aliases = [])

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

Parameters

array $foreigners

the foreigners array

string $fieldName

the field name

string $db

the field name

array $aliases

Alias information for db/table/column

Return Value

string

the Relation string

static bool isAvailable()

No description

Return Value

bool

void setExportOptions(ServerRequest $request, array $exportConfig)

No description

Parameters

ServerRequest $request
array $exportConfig

Return Value

void

StructureOrData getStructureOrData()

No description

Return Value

StructureOrData

protected StructureOrData setStructureOrData(mixed $valueFromRequest, mixed $valueFromConfig, StructureOrData $defaultValue)

No description

Parameters

mixed $valueFromRequest
mixed $valueFromConfig
StructureOrData $defaultValue

Return Value

StructureOrData

string getName()

No description

Return Value

string

string|false encode(mixed $data)

Encodes the data into JSON

Parameters

mixed $data

Data to encode

Return Value

string|false

protected bool doExportForQuery(DatabaseInterface $dbi, string $sqlQuery, string $buffer, array|null $aliases, string|null $db, string|null $table)

Export to JSON

Parameters

DatabaseInterface $dbi
string $sqlQuery
string $buffer
array|null $aliases
string|null $db
string|null $table

Return Value

bool