Ejemplo n.º 1
0
 /**
  * Analyzes fields and adds the extracted information to the field type, auto increment and primary key info caches.
  *
  * @param array $parsedExtSQL The output produced by t3lib_install::getFieldDefinitions_fileContent()
  * @return void
  * @see t3lib_install::getFieldDefinitions_fileContent()
  */
 protected function analyzeFields($parsedExtSQL)
 {
     foreach ($parsedExtSQL as $table => $tdef) {
         if (is_array($tdef['fields'])) {
             foreach ($tdef['fields'] as $field => $fdef) {
                 $fdef = $this->SQLparser->parseFieldDef($fdef);
                 $this->cache_fieldType[$table][$field]['type'] = $fdef['fieldType'];
                 $this->cache_fieldType[$table][$field]['metaType'] = $this->MySQLMetaType($fdef['fieldType']);
                 $this->cache_fieldType[$table][$field]['notnull'] = isset($fdef['featureIndex']['NOTNULL']) && !$this->SQLparser->checkEmptyDefaultValue($fdef['featureIndex']) ? 1 : 0;
                 if (isset($fdef['featureIndex']['DEFAULT'])) {
                     $default = $fdef['featureIndex']['DEFAULT']['value'][0];
                     if (isset($fdef['featureIndex']['DEFAULT']['value'][1])) {
                         $default = $fdef['featureIndex']['DEFAULT']['value'][1] . $default . $fdef['featureIndex']['DEFAULT']['value'][1];
                     }
                     $this->cache_fieldType[$table][$field]['default'] = $default;
                 }
                 if (isset($fdef['featureIndex']['AUTO_INCREMENT'])) {
                     $this->cache_autoIncFields[$table] = $field;
                 }
                 if (isset($tdef['keys']['PRIMARY'])) {
                     $this->cache_primaryKeys[$table] = substr($tdef['keys']['PRIMARY'], 13, -1);
                 }
             }
         }
     }
 }