TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
SqlReader Class Reference

Public Member Functions

 __construct (Dispatcher $signalSlotDispatcher=null)
 
 getTablesDefinitionString (bool $withStatic=false)
 
 getStatementArray (string $dumpContent, string $queryRegex=null)
 
 getInsertStatementArray (string $dumpContent)
 
 getCreateTableStatementArray (string $dumpContent)
 

Protected Member Functions

 emitTablesDefinitionIsBeingBuiltSignal (array $sqlString)
 

Protected Attributes

 $signalSlotDispatcher
 

Detailed Description

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

Definition at line 28 of file SqlReader.php.

Constructor & Destructor Documentation

__construct ( Dispatcher  $signalSlotDispatcher = null)
Parameters
Dispatcher$signalSlotDispatcher
Exceptions
InvalidArgumentException

Definition at line 39 of file SqlReader.php.

References SqlReader\$signalSlotDispatcher, and GeneralUtility\makeInstance().

Member Function Documentation

emitTablesDefinitionIsBeingBuiltSignal ( array  $sqlString)
protected

Emits a signal to manipulate the tables definitions

Parameters
array$sqlString
Returns
array
Exceptions
TYPO3
TYPO3
TYPO3

Definition at line 143 of file SqlReader.php.

Referenced by SqlReader\getTablesDefinitionString().

getCreateTableStatementArray ( string  $dumpContent)

Extract only CREATE TABLE statements from SQL dump

Parameters
string$dumpContent
Returns
array

Definition at line 129 of file SqlReader.php.

References SqlReader\getStatementArray().

getInsertStatementArray ( string  $dumpContent)

Extract only INSERT statements from SQL dump

Parameters
string$dumpContent
Returns
array

Definition at line 118 of file SqlReader.php.

References SqlReader\getStatementArray().

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$dumpContentThe SQL dump content.
string$queryRegexRegex to select which statements to return.
Returns
array Array of SQL statements

Definition at line 84 of file SqlReader.php.

Referenced by SqlReader\getCreateTableStatementArray(), and SqlReader\getInsertStatementArray().

getTablesDefinitionString ( bool  $withStatic = false)

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

Parameters
bool$withStaticTRUE if sql from ext_tables_static+adt.sql should be loaded, too.
Returns
string Concatenated SQL of loaded extensions ext_tables.sql
Exceptions
TYPO3
TYPO3
TYPO3

Definition at line 53 of file SqlReader.php.

References $GLOBALS, and SqlReader\emitTablesDefinitionIsBeingBuiltSignal().

Member Data Documentation

$signalSlotDispatcher
protected

Definition at line 33 of file SqlReader.php.

Referenced by SqlReader\__construct().