SqlReader
Helper methods to handle raw SQL input and transform it into individual statements for further processing.
not part of public core API.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Properties
- $eventDispatcher : EventDispatcherInterface
- $packageManager : PackageManager
Methods
- __construct() : mixed
- getCreateTableStatementArray() : array<string|int, mixed>
- Extract only CREATE TABLE statements from SQL dump
- getInsertStatementArray() : array<string|int, mixed>
- Extract only INSERT statements from SQL dump
- getStatementArray() : array<string|int, mixed>
- Returns an array where every entry is a single SQL-statement.
- getTablesDefinitionString() : string
- Cycle through all loaded extensions and get full table definitions as concatenated string
Properties
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$packageManager
protected
PackageManager
$packageManager
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher, PackageManager $packageManager) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $packageManager : PackageManager
Tags
getCreateTableStatementArray()
Extract only CREATE TABLE statements from SQL dump
public
getCreateTableStatementArray(string $dumpContent) : array<string|int, mixed>
Parameters
- $dumpContent : string
Return values
array<string|int, mixed>getInsertStatementArray()
Extract only INSERT statements from SQL dump
public
getInsertStatementArray(string $dumpContent) : array<string|int, mixed>
Parameters
- $dumpContent : string
Return values
array<string|int, mixed>getStatementArray()
Returns an array where every entry is a single SQL-statement.
public
getStatementArray(string $dumpContent[, string|null $queryRegex = null ]) : array<string|int, mixed>
Input must be formatted like an ordinary MySQL dump file. Every statements needs to be terminated by a ';' and there may only be one statement (or partial statement) per line.
Parameters
- $dumpContent : string
-
The SQL dump content.
- $queryRegex : string|null = null
-
Regex to select which statements to return.
Return values
array<string|int, mixed> —Array of SQL statements
getTablesDefinitionString()
Cycle through all loaded extensions and get full table definitions as concatenated string
public
getTablesDefinitionString([bool $withStatic = false ]) : string
Parameters
- $withStatic : bool = false
-
TRUE if sql from ext_tables_static+adt.sql should be loaded, too.
Return values
string —Concatenated SQL of loaded extensions ext_tables.sql