Exemple #1
0
 /**
  * @see DBHelper::oneColumnSQLRep()
  */
 protected function oneColumnSQLRep($fieldDef, $ignoreRequired = false, $table = '', $return_as_array = false)
 {
     $ref = parent::oneColumnSQLRep($fieldDef, $ignoreRequired, $table, true);
     if ($ref['colType'] == 'int' && !empty($fieldDef['len'])) {
         $ref['colType'] .= "(" . $fieldDef['len'] . ")";
     }
     // bug 22338 - don't set a default value on text or blob fields
     if (isset($ref['default']) && ($ref['colType'] == 'text' || $ref['colType'] == 'blob' || $ref['colType'] == 'longtext' || $ref['colType'] == 'longblob')) {
         $ref['default'] = '';
     }
     if ($return_as_array) {
         return $ref;
     } else {
         return "{$ref['name']} {$ref['colType']} {$ref['default']} {$ref['required']} {$ref['auto_increment']}";
     }
 }
 /**
  * @see DBHelper::oneColumnSQLRep()
  */
 protected function oneColumnSQLRep($fieldDef, $ignoreRequired = false, $table = '', $return_as_array = false)
 {
     //Bug 25814
     if (isset($fieldDef['name'])) {
         $name = $fieldDef['name'];
         $type = $this->getFieldType($fieldDef);
         $colType = $this->getColumnType($type, $name, $table);
         if (stristr($colType, 'decimal')) {
             $fieldDef['len'] = isset($fieldDef['len']) ? min($fieldDef['len'], 38) : 38;
         }
         //bug: 39690 float(8) is interpreted as real and this generates a diff when doing repair
         if (stristr($colType, 'float')) {
             if (isset($fieldDef['len']) && $fieldDef['len'] == 8) {
                 unset($fieldDef['len']);
             }
         }
     }
     $ref = parent::oneColumnSQLRep($fieldDef, $ignoreRequired, $table, true);
     // Bug 24307 - Don't add precision for float fields.
     if (stristr($ref['colType'], 'float')) {
         $ref['colType'] = preg_replace('/(,\\d+)/', '', $ref['colType']);
     }
     if ($return_as_array) {
         return $ref;
     } else {
         return "{$ref['name']} {$ref['colType']} {$ref['default']} {$ref['required']} {$ref['auto_increment']}";
     }
 }
 /** private function to get sql for a column
  */
 function oneColumnSQLRep($fieldDef, $ignoreRequired = false)
 {
     $rep = parent::oneColumnSQLRep($fieldDef, $ignoreRequired);
     return $rep;
 }