‪TYPO3CMS  11.5
TYPO3\CMS\Core\Database\Schema\SqlReader Class Reference

Public Member Functions

 __construct (EventDispatcherInterface $eventDispatcher, PackageManager $packageManager)
 
string getTablesDefinitionString (bool $withStatic=false)
 
array getStatementArray (string $dumpContent, ?string $queryRegex=null)
 
array getInsertStatementArray (string $dumpContent)
 
array getCreateTableStatementArray (string $dumpContent)
 

Protected Attributes

EventDispatcherInterface $eventDispatcher
 
PackageManager $packageManager
 

Detailed Description

Helper methods to handle raw SQL input and transform it into individual statements for further processing.

Definition at line 30 of file SqlReader.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Database\Schema\SqlReader::__construct ( EventDispatcherInterface  $eventDispatcher,
PackageManager  $packageManager 
)
Parameters
EventDispatcherInterface$eventDispatcher
PackageManager$packageManager
Exceptions

Definition at line 45 of file SqlReader.php.

References TYPO3\CMS\Core\Database\Schema\SqlReader\$eventDispatcher, and TYPO3\CMS\Core\Database\Schema\SqlReader\$packageManager.

Member Function Documentation

◆ getCreateTableStatementArray()

array TYPO3\CMS\Core\Database\Schema\SqlReader::getCreateTableStatementArray ( string  $dumpContent)

Extract only CREATE TABLE statements from SQL dump

Parameters
string$dumpContent
Returns
‪array

Definition at line 143 of file SqlReader.php.

References TYPO3\CMS\Core\Database\Schema\SqlReader\getStatementArray().

◆ getInsertStatementArray()

array TYPO3\CMS\Core\Database\Schema\SqlReader::getInsertStatementArray ( string  $dumpContent)

Extract only INSERT statements from SQL dump

Parameters
string$dumpContent
Returns
‪array

Definition at line 132 of file SqlReader.php.

References TYPO3\CMS\Core\Database\Schema\SqlReader\getStatementArray().

◆ getStatementArray()

array TYPO3\CMS\Core\Database\Schema\SqlReader::getStatementArray ( string  $dumpContent,
?string  $queryRegex = null 
)

Returns an array where every entry is a single SQL-statement. 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
string$dumpContent‪The SQL dump content.
string | null$queryRegex‪Regex to select which statements to return.
Returns
‪array Array of SQL statements

Definition at line 88 of file SqlReader.php.

Referenced by TYPO3\CMS\Core\Database\Schema\SqlReader\getCreateTableStatementArray(), and TYPO3\CMS\Core\Database\Schema\SqlReader\getInsertStatementArray().

◆ getTablesDefinitionString()

string TYPO3\CMS\Core\Database\Schema\SqlReader::getTablesDefinitionString ( bool  $withStatic = false)

Cycle through all loaded extensions and get full table definitions as concatenated string

Parameters
bool$withStatic‪TRUE if sql from ext_tables_static+adt.sql should be loaded, too.
Returns
‪string Concatenated SQL of loaded extensions ext_tables.sql

Definition at line 57 of file SqlReader.php.

Member Data Documentation

◆ $eventDispatcher

EventDispatcherInterface TYPO3\CMS\Core\Database\Schema\SqlReader::$eventDispatcher
protected

Definition at line 34 of file SqlReader.php.

Referenced by TYPO3\CMS\Core\Database\Schema\SqlReader\__construct().

◆ $packageManager

PackageManager TYPO3\CMS\Core\Database\Schema\SqlReader::$packageManager
protected

Definition at line 38 of file SqlReader.php.

Referenced by TYPO3\CMS\Core\Database\Schema\SqlReader\__construct().