当前位置: 首页>>代码示例>>PHP>>正文


PHP Helpers::detectType方法代码示例

本文整理汇总了PHP中Nette\Database\Helpers::detectType方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::detectType方法的具体用法?PHP Helpers::detectType怎么用?PHP Helpers::detectType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Database\Helpers的用法示例。


在下文中一共展示了Helpers::detectType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTables

 /**
  * @return array
  */
 protected function getTables()
 {
     $tables = [];
     foreach ($this->structure->getTables() as $table) {
         if ($table['view'] === FALSE) {
             foreach ($this->structure->getColumns($table['name']) as $column) {
                 $tables[$table['name']][$column['name']] = \Nette\Database\Helpers::detectType($column['nativetype']);
             }
         }
     }
     return $tables;
 }
开发者ID:filsedla,项目名称:hyperrow,代码行数:15,代码来源:Generator.php

示例2: getColumnTypes

 /**
  * Returns associative array of detected types (IReflection::FIELD_*) in result set.
  */
 public function getColumnTypes(\PDOStatement $statement)
 {
     $types = [];
     $count = $statement->columnCount();
     for ($col = 0; $col < $count; $col++) {
         $meta = $statement->getColumnMeta($col);
         if (isset($meta['native_type'])) {
             $types[$meta['name']] = $type = Nette\Database\Helpers::detectType($meta['native_type']);
             if ($type === Nette\Database\IStructure::FIELD_TIME) {
                 $types[$meta['name']] = Nette\Database\IStructure::FIELD_TIME_INTERVAL;
             }
         }
     }
     return $types;
 }
开发者ID:ricco24,项目名称:database,代码行数:18,代码来源:MySqlDriver.php

示例3: getColumnTypes

 /**
  * Returns associative array of detected types (IReflection::FIELD_*) in result set.
  */
 public function getColumnTypes(\PDOStatement $statement)
 {
     $types = [];
     $count = $statement->columnCount();
     for ($col = 0; $col < $count; $col++) {
         $meta = $statement->getColumnMeta($col);
         if (isset($meta['sqlite:decl_type'])) {
             if ($meta['sqlite:decl_type'] === 'DATE') {
                 $types[$meta['name']] = Nette\Database\IStructure::FIELD_UNIX_TIMESTAMP;
             } else {
                 $types[$meta['name']] = Nette\Database\Helpers::detectType($meta['sqlite:decl_type']);
             }
         } elseif (isset($meta['native_type'])) {
             $types[$meta['name']] = Nette\Database\Helpers::detectType($meta['native_type']);
         }
     }
     return $types;
 }
开发者ID:remicollet,项目名称:database,代码行数:21,代码来源:SqliteDriver.php

示例4: detectColumnTypes

 private function detectColumnTypes()
 {
     if ($this->types === NULL) {
         $this->types = array();
         if ($this->connection->getSupplementalDriver()->isSupported(ISupplementalDriver::SUPPORT_COLUMNS_META)) {
             $count = $this->columnCount();
             for ($col = 0; $col < $count; $col++) {
                 $meta = $this->getColumnMeta($col);
                 if (isset($meta['native_type'])) {
                     $this->types[$meta['name']] = Helpers::detectType($meta['native_type']);
                 }
             }
         }
     }
     return $this->types;
 }
开发者ID:rotten77,项目名称:xcv,代码行数:16,代码来源:nette.min.php

示例5: detectColumnTypes

 private function detectColumnTypes()
 {
     if ($this->types === null) {
         $this->types = array();
         if ($this->connection->getSupplementalDriver()->isSupported(ISupplementalDriver::META)) {
             // workaround for PHP bugs #53782, #54695
             $col = 0;
             while ($meta = $this->getColumnMeta($col++)) {
                 if (isset($meta['native_type'])) {
                     $this->types[$meta['name']] = Helpers::detectType($meta['native_type']);
                 }
             }
         }
     }
     return $this->types;
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:16,代码来源:Statement.php

示例6: determineFromColumns

 private function determineFromColumns(array $columns)
 {
     $out = [];
     foreach ($columns as $column) {
         $type = Nette\Database\Helpers::detectType($column['nativetype']);
         if ($column['nativetype'] === 'ENUM') {
             $out[$column['name']] = ['type' => IColumnStructure::ENUM];
             $enum = $column['vendor']['Type'];
             $options = str_getcsv(str_replace('enum(', '', substr($enum, 0, strlen($enum) - 1)), ',', "'");
             $out[$column['name']]['values'] = [];
             foreach ($options as $option) {
                 $out[$column['name']]['values'][] = $option;
             }
         } elseif ($column['nativetype'] === 'TINYINT' && $column['size'] === 1) {
             $out[$column['name']] = ['type' => IColumnStructure::BOOL];
         } else {
             switch ($type) {
                 case Nette\Database\IStructure::FIELD_TEXT:
                     $out[$column['name']] = ['type' => IColumnStructure::TEXT];
                     break;
                 case Nette\Database\IStructure::FIELD_INTEGER:
                 case Nette\Database\IStructure::FIELD_FLOAT:
                     $out[$column['name']] = ['type' => IColumnStructure::NUMBER];
                     break;
                 case Nette\Database\IStructure::FIELD_DATE:
                 case Nette\Database\IStructure::FIELD_TIME:
                 case Nette\Database\IStructure::FIELD_DATETIME:
                 case Nette\Database\IStructure::FIELD_UNIX_TIMESTAMP:
                     $out[$column['name']] = ['type' => IColumnStructure::DATE];
                     break;
                 case Nette\Database\IStructure::FIELD_BOOL:
                     $out[$column['name']] = ['type' => IColumnStructure::BOOL];
                     break;
             }
         }
         if (isset($out[$column['name']])) {
             $out[$column['name']]['nullable'] = $column['nullable'];
         }
     }
     return $out;
 }
开发者ID:mesour,项目名称:sources,代码行数:41,代码来源:NetteDbTableSource.php

示例7:

Nette\DateTime($value);}}return$this->connection->getSupplementalDriver()->normalizeRow($row,$this);}private
function
detectColumnTypes(){if($this->types===NULL){$this->types=array();if($this->connection->getSupplementalDriver()->isSupported(ISupplementalDriver::META)){$col=0;while($meta=$this->getColumnMeta($col++)){if(isset($meta['native_type'])){$this->types[$meta['name']]=Helpers::detectType($meta['native_type']);}}}}return$this->types;}function
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:3,代码来源:loader.php

示例8: getColumnTypes

 /**
  * Returns associative array of detected types (IReflection::FIELD_*) in result set.
  */
 public function getColumnTypes(\PDOStatement $statement)
 {
     $types = array();
     $count = $statement->columnCount();
     for ($col = 0; $col < $count; $col++) {
         $meta = $statement->getColumnMeta($col);
         if (isset($meta['sqlsrv:decl_type']) && $meta['sqlsrv:decl_type'] !== 'timestamp') {
             // timestamp does not mean time in sqlsrv
             $types[$meta['name']] = Nette\Database\Helpers::detectType($meta['sqlsrv:decl_type']);
         } elseif (isset($meta['native_type'])) {
             $types[$meta['name']] = Nette\Database\Helpers::detectType($meta['native_type']);
         }
     }
     return $types;
 }
开发者ID:Johnik010,项目名称:rezervace,代码行数:18,代码来源:SqlsrvDriver.php


注:本文中的Nette\Database\Helpers::detectType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。