DatabaseImporter

Joomla Framework Database Importer Class

abstract
since

1.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct() : mixed

Sets up the default options for the importer.

since

1.0

Response

mixed

asXml

Set the output option for the importer to XML format.

asXml() : $this
since

1.0

Response

$this

check

Checks if all data and options are in order prior to importer.

check() : $this
abstract
since

1.0

throws

\RuntimeException

Response

$this

from

Specifies the data source to import.

from(\SimpleXMLElement|string from) : $this
since

1.0

Arguments

from

\SimpleXMLElement|stringThe data source to import, either as a SimpleXMLElement object or XML string.

Response

$this

getAddColumnSql

Get the SQL syntax to add a column.

getAddColumnSql(string table, \SimpleXMLElement field) : string
since

1.0

Arguments

table

stringThe table name.

field

\SimpleXMLElementThe XML field definition.

Response

string

getAlterTableSql

Get alters for table if there is a difference.

getAlterTableSql(\SimpleXMLElement structure) : array
abstract
since

2.0.0

Arguments

structure

\SimpleXMLElementThe XML structure of the table.

Response

array

getChangeColumnSql

Get the syntax to alter a column.

getChangeColumnSql(string table, \SimpleXMLElement field) : string
since

1.0

Arguments

table

stringThe name of the database table to alter.

field

\SimpleXMLElementThe XML definition for the field.

Response

string

getDropColumnSql

Get the SQL syntax to drop a column.

getDropColumnSql(string table, string name) : string
since

1.0

Arguments

table

stringThe table name.

name

stringThe name of the field to drop.

Response

string

getKeyLookup

Get the details list of keys for a table.

getKeyLookup(array keys) : array
since

1.0

Arguments

keys

arrayAn array of objects that comprise the keys for the table.

Response

arrayThe lookup array. array({key name} => array(object, ...))

getRealTableName

Get the real name of the table, converting the prefix wildcard string if present.

getRealTableName(string table) : string
since

1.0

Arguments

table

stringThe name of the table.

Response

stringThe real name of the table.

importData

Import the data from the source into the existing tables.

importData() : void
note

Currently only supports XML format.

since

2.0.0

throws

\RuntimeExceptionon error.

mergeStructure

Merges the incoming structure definition with the existing structure.

mergeStructure() : void
note

Currently only supports XML format.

since

1.0

throws

\RuntimeExceptionon error.

setDbo

Sets the database connector to use for exporting structure and/or data.

setDbo(\Joomla\Database\DatabaseInterface db) : $this
since

1.0

Arguments

db

\Joomla\Database\DatabaseInterfaceThe database connector.

Response

$this

withStructure

Sets an internal option to merge the structure based on the input data.

withStructure(bool setting = true) : $this
since

1.0

Arguments

setting

boolTrue to import the structure, false to not.

Response

$this

xmlToCreate

Get the SQL syntax to add a table.

xmlToCreate(\SimpleXMLElement table) : string
abstract
since

2.0.0

throws

\RuntimeException

Arguments

table

\SimpleXMLElementThe table information.

Response

string

Properties

cache

An array of cached data.

since

1.0

Type(s)

array

db

The database connector to use for exporting structure and/or data.

since

1.0

Type(s)

\Joomla\Database\DatabaseInterface

from

The input source.

since

1.0

Type(s)

mixed

asFormat

The type of input format.

since

1.0

Type(s)

string

options

An array of options for the exporter.

since

1.0

Type(s)

\stdClass