/**
  * Remove the index prefix length information from columns in an index definition.
  * Partial indexes based on a prefix are not supported by all databases.
  *
  * @param string $indexSQL
  * @return string
  */
 public function getEquivalentIndexDefinition($indexSQL)
 {
     if ($this->dbmsSpecifics->specificExists(Specifics\AbstractSpecifics::PARTIAL_STRING_INDEX) && (bool) $this->dbmsSpecifics->getSpecific(Specifics\AbstractSpecifics::PARTIAL_STRING_INDEX)) {
         return $indexSQL;
     }
     $strippedIndexSQL = preg_replace_callback('/\\A([^(]+)\\((.*)\\)\\Z/', function ($matches) {
         return $matches[1] . '(' . preg_replace('/\\((\\d+)\\)/', '', $matches[2]) . ')';
     }, $indexSQL);
     return $strippedIndexSQL === null ? $indexSQL : $strippedIndexSQL;
 }
 /**
  * Quotes field names in a SQL WHERE clause according to DB rules
  *
  * @param array $where_clause The parsed WHERE clause to quote
  * @return array
  * @see quoteWhereClause()
  */
 protected function _quoteWhereClause(array $where_clause)
 {
     foreach ($where_clause as $k => $v) {
         // Look for sublevel:
         if (is_array($where_clause[$k]['sub'])) {
             $where_clause[$k]['sub'] = $this->_quoteWhereClause($where_clause[$k]['sub']);
         } elseif (isset($v['func'])) {
             switch ($where_clause[$k]['func']['type']) {
                 case 'EXISTS':
                     $where_clause[$k]['func']['subquery'] = $this->quoteSELECTsubquery($v['func']['subquery']);
                     break;
                 case 'FIND_IN_SET':
                     // quoteStr that will be used for Oracle
                     $pattern = str_replace($where_clause[$k]['func']['str'][1], '\\' . $where_clause[$k]['func']['str'][1], $where_clause[$k]['func']['str'][0]);
                     // table is not really needed and may in fact be empty in real statements
                     // but it's not overridden from \TYPO3\CMS\Core\Database\DatabaseConnection at the moment...
                     $patternForLike = $this->escapeStrForLike($pattern, $where_clause[$k]['func']['table']);
                     $where_clause[$k]['func']['str_like'] = $patternForLike;
                     if ($where_clause[$k]['func']['table'] !== '') {
                         $where_clause[$k]['func']['table'] = $this->quoteName($v['func']['table']);
                     }
                     if ($where_clause[$k]['func']['field'] !== '') {
                         if (!empty($this->dbmsSpecifics) && $this->dbmsSpecifics->getSpecific(Specifics\AbstractSpecifics::CAST_FIND_IN_SET)) {
                             $where_clause[$k]['func']['field'] = 'CAST(' . $this->quoteName($v['func']['field']) . ' AS CHAR)';
                         } else {
                             $where_clause[$k]['func']['field'] = $this->quoteName($v['func']['field']);
                         }
                     }
                     break;
                 case 'IFNULL':
                     // Intentional fallthrough
                 // Intentional fallthrough
                 case 'LOCATE':
                     if ($where_clause[$k]['func']['table'] != '') {
                         $where_clause[$k]['func']['table'] = $this->quoteName($v['func']['table']);
                     }
                     if ($where_clause[$k]['func']['field'] != '') {
                         $where_clause[$k]['func']['field'] = $this->quoteName($v['func']['field']);
                     }
                     break;
             }
         } else {
             if ($where_clause[$k]['table'] != '') {
                 $where_clause[$k]['table'] = $this->quoteName($where_clause[$k]['table']);
             }
             if (!is_numeric($where_clause[$k]['field'])) {
                 $where_clause[$k]['field'] = $this->quoteName($where_clause[$k]['field']);
             }
             if (isset($where_clause[$k]['calc_table'])) {
                 if ($where_clause[$k]['calc_table'] != '') {
                     $where_clause[$k]['calc_table'] = $this->quoteName($where_clause[$k]['calc_table']);
                 }
                 if ($where_clause[$k]['calc_field'] != '') {
                     $where_clause[$k]['calc_field'] = $this->quoteName($where_clause[$k]['calc_field']);
                 }
             }
         }
         if ($where_clause[$k]['comparator']) {
             if (isset($v['value']['operator'])) {
                 foreach ($where_clause[$k]['value']['args'] as $argK => $fieldDef) {
                     $where_clause[$k]['value']['args'][$argK]['table'] = $this->quoteName($fieldDef['table']);
                     $where_clause[$k]['value']['args'][$argK]['field'] = $this->quoteName($fieldDef['field']);
                 }
             } else {
                 // Detecting value type; list or plain:
                 if (GeneralUtility::inList('NOTIN,IN', strtoupper(str_replace(array(' ', LF, CR, TAB), '', $where_clause[$k]['comparator'])))) {
                     if (isset($v['subquery'])) {
                         $where_clause[$k]['subquery'] = $this->quoteSELECTsubquery($v['subquery']);
                     }
                 } else {
                     if ((!isset($where_clause[$k]['value'][1]) || $where_clause[$k]['value'][1] == '') && is_string($where_clause[$k]['value'][0]) && strstr($where_clause[$k]['value'][0], '.')) {
                         $where_clause[$k]['value'][0] = $this->quoteFieldNames($where_clause[$k]['value'][0]);
                     } elseif ($this->runningADOdbDriver('mssql')) {
                         $where_clause[$k]['value'][0] = substr($this->handlerInstance[$this->lastHandlerKey]->qstr($where_clause[$k]['value'][0]), 1, -1);
                     }
                 }
             }
         }
     }
     return $where_clause;
 }