/**
  * Convert the native MySQL Field type to the closest matching equivalent field type supported by the DBMS.
  * INTEGER and TINYTEXT colums need to be further processed due to MySQL limitations / non-standard features.
  *
  * @param string $fieldSQL
  * @return string
  */
 public function getEquivalentFieldDefinition($fieldSQL)
 {
     if (!preg_match('/^([a-z0-9]+)(\\(([^\\)]+)\\))?(.*)/', $fieldSQL, $components)) {
         return $fieldSQL;
     }
     $metaType = $this->dbmsSpecifics->getMetaFieldType($components[1]);
     $replacementType = $this->dbmsSpecifics->getNativeFieldType($metaType);
     $replacementLength = $components[2];
     $replacementExtra = '';
     // MySQL INT types support a display length that has no effect on the
     // actual range of values that can be stored, normalize to the default
     // display length returned by DBAL.
     if (substr($metaType, 0, 1) === 'I') {
         $replacementLength = $this->dbmsSpecifics->getNativeFieldLength($replacementType, $components[3]);
     }
     // MySQL TINYTEXT is equivalent to VARCHAR(255) DEFAULT NULL. MySQL TEXT
     // columns can not have a default value in contrast to VARCHAR, so the
     // `default NULL` gets appended to avoid false-positive schema changes.
     if ($components[1] === 'tinytext') {
         $replacementLength = '(255)';
         if (false !== stripos($components[0], ' NOT NULL')) {
             $replacementExtra = ' default \'\'';
         } else {
             $replacementExtra = ' default NULL';
         }
     }
     return str_replace($components[1] . $components[2], strtolower($replacementType) . $replacementLength, $components[0]) . $replacementExtra;
 }
 /**
  * Return actual MySQL type for meta field type
  *
  * @param string $meta Meta type (currenly ADOdb syntax only, http://phplens.com/lens/adodb/docs-adodb.htm#metatype)
  * @return string Native type as reported as in mysqldump files, uppercase
  * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
  */
 public function MySQLActualType($meta)
 {
     GeneralUtility::logDeprecatedFunction();
     return $this->dbmsSpecifics->getNativeFieldType($meta);
 }
 /**
  * @test
  * @param string $metaType
  * @param string $expected
  * @dataProvider determineNativeTypeProvider
  */
 public function determineNativeTypeFromMetaType($metaType, $expected)
 {
     $result = $this->subject->getNativeFieldType($metaType);
     $this->assertSame($expected, $result);
 }