當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。