SQLConverterBase
abstract class SQLConverterBase
Base class for concrete classes that convert input files of a particular format into SQL database
Traits
Properties
protected array | $datatypes | from DatasourcesTrait | |
protected array | $parameters | ||
protected string | $databasesDir | ||
protected SimpleXMLElement | $datasources | ||
protected Database | $database |
Methods
Constructs a Database object
Returns informations about the columns of a table
Constructs a form fields with informations about the columns of a table
Retrieves the choice values of a data in the result list of a query on a data source
Executes the query from a source
Filters the result set of a query on the source return path
Filters the result set of a query on the source return path
Inserts a row into a table
Updates a table row
Deletes a row from a table
Checks the value of a column
Does the migration of data from a database to another.
Creates a database
Creates a database table
Drops a table
Edits a table structure
Emulates a 'ALTER TABLE' for columns of a SQLite database.
Constructor of class JSONToSQLConverter
Checks if a parameter exists.
Gets a parameter with its name.
Prepares a value according to its type for its insertion in a SQL database
Decodes a properties list from JSON schema
Connects to the database
Imports file(s) to a SQL database and returns an array descriptor of the database for the update of DataSources.xml
Details
in DatasourcesTrait at line 192
protected Database
getDatabase(int $dsid, SimpleXMLElement $datasources, string|null $databasesDir = null, bool $withDbName = true)
Constructs a Database object
in DatasourcesTrait at line 211
protected array|string|bool|null
tablesList(Database $database)
Returns the list of tables of a database
in DatasourcesTrait at line 249
protected array|string|bool|null
tableInfos(Database $database, string $table)
Returns informations about a table of a database
in DatasourcesTrait at line 302
protected array
infosColumns(SimpleXMLElement $datasources, Database $database, string $table)
Returns informations about the columns of a table
in DatasourcesTrait at line 361
protected array
infosColumnsToForm(string $table, array $infosColumns)
Constructs a form fields with informations about the columns of a table
in DatasourcesTrait at line 398
protected array
getChoicesFromSource(SimpleXMLElement $source, array|null $result)
Retrieves the choice values of a data in the result list of a query on a data source
in DatasourcesTrait at line 461
protected array|string|null
executeSource(SimpleXMLElement $source, SimpleXMLElement $datasources, string|null $databasesDir = null)
Executes the query from a source
in DatasourcesTrait at line 523
protected array|null
filterResult(array|string $result, SimpleXMLElement $source)
Filters the result set of a query on the source return path
in DatasourcesTrait at line 548
protected array
filterResultByLines(array $result, string $filter)
Filters the result set of a query on the source return path
in DatasourcesTrait at line 589
protected string|bool
insertRowIntoTable(array $row, string $table, array $infosColumns, Database $database, TranslatorInterface $translator = null, bool $restore = false, bool $fromOtherTable = false)
Inserts a row into a table
in DatasourcesTrait at line 638
protected bool|string
updateRowInTable(array $row, string $table, SimpleXMLElement $datasources, Database $database, TranslatorInterface $translator = null, bool $fromOtherTable = false)
Updates a table row
in DatasourcesTrait at line 685
protected string|true
deleteRowFromTable(array $row, string $table, Database $database, TranslatorInterface $translator = null)
Deletes a row from a table
in DatasourcesTrait at line 709
protected string|bool
checkColumnValue(array $info, string|null $value, TranslatorInterface $translator = null, bool $fromOtherTable = false)
Checks the value of a column
in DatasourcesTrait at line 847
protected string|true
migrateDatabase(int $dsid, string $dbtype, SimpleXMLElement $datasources, SimpleXMLElement $fromDatasources, Database $fromDatabase, string|null $databasesDir = null, TranslatorInterface $translator = null, callable|null $fprogress = null)
Does the migration of data from a database to another.
in DatasourcesTrait at line 895
protected string|true
createDatabase(int $dsid, string $dbtype, SimpleXMLElement $datasources, string|null $databasesDir = null, TranslatorInterface $translator = null)
Creates a database
in DatasourcesTrait at line 953
protected string|true
createDatabaseTable(array $form, Database $database, TranslatorInterface $translator = null)
Creates a database table
in DatasourcesTrait at line 1032
protected string|true
dropDatabaseTable(string $table, Database $database, TranslatorInterface $translator = null)
Drops a table
in DatasourcesTrait at line 1057
protected string|true
editTableStructure(array $form, string $table, Database $database, SimpleXMLElement $datasources, TranslatorInterface $translator = null)
Edits a table structure
in DatasourcesTrait at line 1277
protected bool
alterSQLiteTable(string $table, string $alterdefs, Database $database, TranslatorInterface $translator = null)
Emulates a 'ALTER TABLE' for columns of a SQLite database.
ALTER TABLE tbl_name alter_specification [, alter_specification] ...
alter_specification: ADD column_definition | DROP column_definition | CHANGE old_col_name column_definition
column_definition: same as for create table statements
at line 91
void
__construct(array $fparameters, string $databasesDir)
Constructor of class JSONToSQLConverter
at line 105
protected bool
hasConfigParameter(string $parameter)
Checks if a parameter exists.
at line 117
protected string|null
getConfigParameter(string $parameter)
Gets a parameter with its name.
at line 129
protected string
getType(stdClass $coldef)
Returns the data type of a database column
at line 156
protected string
getValue(string $type, string $value)
Prepares a value according to its type for its insertion in a SQL database
at line 175
protected stdClass
properties(string $arg)
Decodes a properties list from JSON schema
at line 193
protected void
connectDatabase(string $dbschema, string $dbtype)
Connects to the database
at line 221
abstract array
convert(array $inputs, TranslatorInterface|null $translator = null, callable|null $fprogress = null)
Imports file(s) to a SQL database and returns an array descriptor of the database for the update of DataSources.xml