TYPO3
7.6
|
Public Member Functions | |
setDeletedPrefixKey ($prefix) | |
getDeletedPrefixKey () | |
getFieldDefinitions_fileContent ($fileContent) | |
getCollationForCharset ($charset) | |
getFieldDefinitions_database () | |
getDatabaseExtra ($FDsrc, $FDcomp, $onlyTableList= '', $ignoreNotNullWhenComparing=false) | |
getUpdateSuggestions ($diffArr, $keyList= 'extra, diff') | |
assembleFieldDefinition ($row) | |
getStatementArray ($sqlcode, $removeNonSQL=false, $query_regex= '') | |
getCreateTables ($statements, $insertCountFlag=false) | |
getTableInsertStatements ($statements, $table) | |
performUpdateQueries ($arr, $keyArr) | |
getListOfTables () | |
Public Attributes | |
const | MYSQL_MAXIMUM_FIELD_WIDTH = 64 |
Protected Member Functions | |
isDbalEnabled () | |
getDatabaseConnection () | |
Protected Attributes | |
$deletedPrefixKey = 'zzz_deleted_' | |
$character_sets = array() | |
Verify TYPO3 DB table structure. Mainly used in install tool compare wizard and extension manager.
Definition at line 21 of file SqlSchemaMigrationService.php.
assembleFieldDefinition | ( | $row | ) |
Converts a result row with field information into the SQL field definition string
array | $row | MySQL result row |
Definition at line 509 of file SqlSchemaMigrationService.php.
Referenced by SqlSchemaMigrationService\getFieldDefinitions_database().
getCollationForCharset | ( | $charset | ) |
Look up the default collation for specified character set based on "SHOW CHARACTER SET" output
string | $charset | Character set |
Definition at line 156 of file SqlSchemaMigrationService.php.
References SqlSchemaMigrationService\getDatabaseConnection().
Referenced by SqlSchemaMigrationService\getFieldDefinitions_fileContent().
getCreateTables | ( | $statements, | |
$insertCountFlag = false |
|||
) |
Returns tables to create and how many records in each
array | $statements | Array of SQL statements to analyse. |
bool | $insertCountFlag | If set, will count number of INSERT INTO statements following that table definition |
Definition at line 581 of file SqlSchemaMigrationService.php.
References elseif.
|
protected |
Definition at line 692 of file SqlSchemaMigrationService.php.
References $GLOBALS.
Referenced by SqlSchemaMigrationService\getCollationForCharset(), SqlSchemaMigrationService\getDatabaseExtra(), SqlSchemaMigrationService\getFieldDefinitions_database(), SqlSchemaMigrationService\getFieldDefinitions_fileContent(), SqlSchemaMigrationService\getListOfTables(), SqlSchemaMigrationService\getUpdateSuggestions(), and SqlSchemaMigrationService\performUpdateQueries().
getDatabaseExtra | ( | $FDsrc, | |
$FDcomp, | |||
$onlyTableList = '' , |
|||
$ignoreNotNullWhenComparing = false |
|||
) |
Compares two arrays with field information and returns information about fields that are MISSING and fields that have CHANGED. FDsrc and FDcomp can be switched if you want the list of stuff to remove rather than update.
array | $FDsrc | Field definitions, source (from getFieldDefinitions_fileContent()) |
array | $FDcomp | Field definitions, comparison. (from getFieldDefinitions_database()) |
string | $onlyTableList | Table names (in list) which is the ONLY one observed. |
bool | $ignoreNotNullWhenComparing | If set, this function ignores NOT NULL statements of the SQL file field definition when comparing current field definition from database with field definition from SQL file. This way, NOT NULL statements will be executed when the field is initially created, but the SQL parser will never complain about missing NOT NULL statements afterwards. |
Definition at line 255 of file SqlSchemaMigrationService.php.
References SqlSchemaMigrationService\getDatabaseConnection(), GeneralUtility\inList(), and SqlSchemaMigrationService\isDbalEnabled().
getDeletedPrefixKey | ( | ) |
Get prefix of deleted tables
Definition at line 53 of file SqlSchemaMigrationService.php.
References SqlSchemaMigrationService\$deletedPrefixKey.
getFieldDefinitions_database | ( | ) |
Reads the field definitions for the current database
Definition at line 180 of file SqlSchemaMigrationService.php.
References SqlSchemaMigrationService\assembleFieldDefinition(), elseif, and SqlSchemaMigrationService\getDatabaseConnection().
getFieldDefinitions_fileContent | ( | $fileContent | ) |
Reads the field definitions for the input SQL-file string
string | $fileContent | Should be a string read from an SQL-file made with 'mysqldump [database_name] -d' |
Definition at line 64 of file SqlSchemaMigrationService.php.
References SqlSchemaMigrationService\getCollationForCharset(), and SqlSchemaMigrationService\getDatabaseConnection().
getListOfTables | ( | ) |
Returns list of tables in the database
Definition at line 669 of file SqlSchemaMigrationService.php.
References SqlSchemaMigrationService\getDatabaseConnection().
getStatementArray | ( | $sqlcode, | |
$removeNonSQL = false , |
|||
$query_regex = '' |
|||
) |
Returns an array where every entry is a single SQL-statement. Input must be formatted like an ordinary MySQL-dump files.
string | $sqlcode | The SQL-file content. Provided that 1) every query in the input is ended with ';' and that a line in the file contains only one query or a part of a query. |
bool | $removeNonSQL | If set, non-SQL content (like comments and blank lines) is not included in the final output |
string | $query_regex | Regex to filter SQL lines to include |
Definition at line 542 of file SqlSchemaMigrationService.php.
References elseif.
getTableInsertStatements | ( | $statements, | |
$table | |||
) |
Extracts all insert statements from $statement array where content is inserted into $table
array | $statements | Array of SQL statements |
string | $table | Table name |
Definition at line 618 of file SqlSchemaMigrationService.php.
getUpdateSuggestions | ( | $diffArr, | |
$keyList = 'extra , |
|||
diff' | |||
) |
Returns an array with SQL-statements that is needed to update according to the diff-array
array | $diffArr | Array with differences of current and needed DB settings. (from getDatabaseExtra()) |
string | $keyList | List of fields in diff array to take notice of. |
Definition at line 345 of file SqlSchemaMigrationService.php.
References SqlSchemaMigrationService\$deletedPrefixKey, elseif, SqlSchemaMigrationService\getDatabaseConnection(), and SqlSchemaMigrationService\isDbalEnabled().
|
protected |
Checks if DBAL is enabled for the database connection
Definition at line 684 of file SqlSchemaMigrationService.php.
Referenced by SqlSchemaMigrationService\getDatabaseExtra(), and SqlSchemaMigrationService\getUpdateSuggestions().
performUpdateQueries | ( | $arr, | |
$keyArr | |||
) |
Performs the queries passed from the input array.
array | $arr | Array of SQL queries to execute. |
array | $keyArr | Array with keys that must match keys in $arr. Only where a key in this array is set and TRUE will the query be executed (meant to be passed from a form checkbox) |
Definition at line 640 of file SqlSchemaMigrationService.php.
References elseif, and SqlSchemaMigrationService\getDatabaseConnection().
setDeletedPrefixKey | ( | $prefix | ) |
Set prefix of deleted tables
string | $prefix | Prefix string |
Definition at line 43 of file SqlSchemaMigrationService.php.
|
protected |
Definition at line 36 of file SqlSchemaMigrationService.php.
|
protected |
Definition at line 31 of file SqlSchemaMigrationService.php.
Referenced by SqlSchemaMigrationService\getDeletedPrefixKey(), and SqlSchemaMigrationService\getUpdateSuggestions().
const MYSQL_MAXIMUM_FIELD_WIDTH = 64 |
Maximum field width of MySQL
Definition at line 26 of file SqlSchemaMigrationService.php.