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


PHP unknown_type::columnCount方法代码示例

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


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

示例1: resultSet

 /**
  * Enter description here...
  *
  * @param unknown_type $results
  */
 function resultSet(&$results)
 {
     $this->map = array();
     $numFields = $results->columnCount();
     $index = 0;
     $j = 0;
     while ($j < $numFields) {
         $column = $results->getColumnMeta($j);
         if (strpos($column['name'], '__')) {
             list($table, $name) = explode('__', $column['name']);
             $this->map[$index++] = array($table, $name, $column['native_type']);
         } else {
             $this->map[$index++] = array(0, $column['name'], $column['native_type']);
         }
         $j++;
     }
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:22,代码来源:dbo_postgres.php

示例2: resultSet

 /**
  * Enter description here...
  *
  * @param unknown_type $results
  */
 function resultSet(&$results)
 {
     $this->results =& $results;
     #echo "resultSet:results ";
     #pr($results);
     $this->map = array();
     $num_fields = $results->columnCount();
     $index = 0;
     $j = 0;
     //PDO::getColumnMeta is experimental and does not work with sqlite3,
     //	so try to figure it out based on the querystring
     $querystring = $results->queryString;
     if (strpos($querystring, "SELECT") === 0) {
         $last = strpos($querystring, "FROM");
         if ($last !== false) {
             $selectpart = substr($querystring, 7, $last - 8);
             $selects = explode(",", $selectpart);
         }
     } elseif (strpos($querystring, "PRAGMA table_info") === 0) {
         $selects = array("cid", "name", "type", "notnull", "dflt_value", "pk");
     }
     while ($j < $num_fields) {
         #echo "resultSet:columnmeta ";
         #			$columnName = str_replace('"', '', sqlite3_field_name($results, $j));
         if (strpos($selects[$j], "COUNT(*) AS") === 0) {
             $columnName = "count";
         } else {
             $columnName = trim(str_replace('"', '', $selects[$j]));
         }
         if (strpos($columnName, '.')) {
             $parts = explode('.', $columnName);
             $this->map[$index++] = array(trim($parts[0]), trim($parts[1]));
         } else {
             $this->map[$index++] = array(0, $columnName);
         }
         $j++;
     }
 }
开发者ID:JCVI-Cloud,项目名称:METAREP,代码行数:43,代码来源:dbo_sqlite3.php

示例3: resultSet

 /**
  * Enter description here...
  *
  * @param unknown_type $results
  * @return string
  * @access public
  */
 public function resultSet($results)
 {
     $this->results = $results;
     $this->map = array();
     $numFields = $results->columnCount();
     $index = 0;
     $j = 0;
     //PDO::getColumnMeta is experimental and does not work with sqlite3,
     //	so try to figure it out based on the querystring
     $querystring = $results->queryString;
     if (stripos($querystring, 'SELECT') === 0) {
         $last = strripos($querystring, 'FROM');
         if ($last !== false) {
             $selectpart = substr($querystring, 7, $last - 8);
             $selects = String::tokenize($selectpart, ',', '(', ')');
         }
     } elseif (strpos($querystring, 'PRAGMA table_info') === 0) {
         $selects = array('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk');
     } elseif (strpos($querystring, 'PRAGMA index_list') === 0) {
         $selects = array('seq', 'name', 'unique');
     } elseif (strpos($querystring, 'PRAGMA index_info') === 0) {
         $selects = array('seqno', 'cid', 'name');
     }
     while ($j < $numFields) {
         if (!isset($selects[$j])) {
             $j++;
             continue;
         }
         if (preg_match('/\\bAS\\s+(.*)/i', $selects[$j], $matches)) {
             $columnName = trim($matches[1], '"');
         } else {
             $columnName = trim(str_replace('"', '', $selects[$j]));
         }
         if (strpos($selects[$j], 'DISTINCT') === 0) {
             $columnName = str_ireplace('DISTINCT', '', $columnName);
         }
         $metaType = false;
         try {
             $metaData = (array) $results->getColumnMeta($j);
             if (!empty($metaData['sqlite:decl_type'])) {
                 $metaType = trim($metaData['sqlite:decl_type']);
             }
         } catch (Exception $e) {
         }
         if (strpos($columnName, '.')) {
             $parts = explode('.', $columnName);
             $this->map[$index++] = array(trim($parts[0]), trim($parts[1]), $metaType);
         } else {
             $this->map[$index++] = array(0, $columnName, $metaType);
         }
         $j++;
     }
 }
开发者ID:naow9y,项目名称:basercms,代码行数:60,代码来源:BcSqlite.php


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