コード例 #1
0
ファイル: Schema.php プロジェクト: df-arif/df-core
 /**
  * @param ColumnSchema $field_info
  * @param bool         $as_quoted_string
  * @param string       $out_as
  *
  * @return string
  */
 public function parseFieldForSelect($field_info, $as_quoted_string = false, $out_as = null)
 {
     $field = $as_quoted_string ? $this->quoteColumnName($field_info->name) : $field_info->name;
     $alias = $as_quoted_string ? $this->quoteColumnName($field_info->getName(true)) : $field_info->getName(true);
     switch ($field_info->dbType) {
         case 'datetime':
         case 'timestamp':
             return "(CONVERT(nvarchar(30), {$field}, 127)) AS {$alias}";
         case 'geometry':
         case 'geography':
         case 'hierarchyid':
             return "({$field}.ToString()) AS {$alias}";
         default:
             return parent::parseFieldForSelect($field_info, $as_quoted_string, $out_as);
     }
 }
コード例 #2
0
ファイル: Schema.php プロジェクト: pkdevboxy/df-core
 /**
  * Creates a table column.
  *
  * @param array $column column metadata
  *
  * @return ColumnSchema normalized column metadata
  */
 protected function createColumn($column)
 {
     $c = new ColumnSchema(['name' => $column['cname']]);
     $c->rawName = $this->quoteColumnName($c->name);
     $c->allowNull = $column['nulls'] == 'Y';
     $c->isPrimaryKey = $column['in_primary_key'] == 'Y';
     $c->dbType = $column['coltype'];
     $c->scale = intval($column['syslength']);
     $c->precision = $c->size = intval($column['length']);
     $c->comment = $column['remarks'];
     $c->extractFixedLength($column['coltype']);
     $c->extractMultiByteSupport($column['coltype']);
     $c->extractType($column['coltype']);
     if (isset($column['default_value'])) {
         $c->extractDefault($column['default_value']);
     }
     return $c;
 }