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


PHP db2_columns函数代码示例

本文整理汇总了PHP中db2_columns函数的典型用法代码示例。如果您正苦于以下问题:PHP db2_columns函数的具体用法?PHP db2_columns怎么用?PHP db2_columns使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: db_getfieldslist

 /**
  * @param String strSQL
  * @return Array
  */
 public function db_getfieldslist($table)
 {
     $res = array();
     $arr = implode(".", $table);
     $stmt = db2_columns($this->connectionObj->conn, null, $arr[0], $arr[1], '%');
     if ($stmt) {
         while ($rowC = db2_fetch_assoc($stmt)) {
             $ntype = $this->getFieldTypeNumber($rowC["TYPE_NAME"]);
             $res[$i] = array("fieldname" => $rowC["COLUMN_NAME"], "type" => $ntype, "is_nullable" => 0);
         }
     }
     return $res;
 }
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:17,代码来源:DB2Info.php

示例2: strtoupper

 function &MetaColumns($table)
 {
     global $ADODB_FETCH_MODE;
     $false = false;
     if ($this->uCaseTables) {
         $table = strtoupper($table);
     }
     $schema = '';
     $this->_findschema($table, $schema);
     $savem = $ADODB_FETCH_MODE;
     $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
     $colname = "%";
     $qid = db2_columns($this->_connectionID, "", $schema, $table, $colname);
     if (empty($qid)) {
         return $false;
     }
     $rs =& new ADORecordSet_db2($qid);
     $ADODB_FETCH_MODE = $savem;
     if (!$rs) {
         return $false;
     }
     $rs->_fetch();
     $retarr = array();
     /*
     $rs->fields indices
     0 TABLE_QUALIFIER
     1 TABLE_SCHEM
     2 TABLE_NAME
     3 COLUMN_NAME
     4 DATA_TYPE
     5 TYPE_NAME
     6 PRECISION
     7 LENGTH
     8 SCALE
     9 RADIX
     10 NULLABLE
     11 REMARKS
     */
     while (!$rs->EOF) {
         if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
             $fld = new ADOFieldObject();
             $fld->name = $rs->fields[3];
             $fld->type = $this->DB2Types($rs->fields[4]);
             // ref: http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraccgen/html/msdn_odk.asp
             // access uses precision to store length for char/varchar
             if ($fld->type == 'C' or $fld->type == 'X') {
                 if ($rs->fields[4] <= -95) {
                     // UNICODE
                     $fld->max_length = $rs->fields[7] / 2;
                 } else {
                     $fld->max_length = $rs->fields[7];
                 }
             } else {
                 $fld->max_length = $rs->fields[7];
             }
             $fld->not_null = !empty($rs->fields[10]);
             $fld->scale = $rs->fields[8];
             $fld->primary_key = false;
             $retarr[strtoupper($fld->name)] = $fld;
         } else {
             if (sizeof($retarr) > 0) {
                 break;
             }
         }
         $rs->MoveNext();
     }
     $rs->Close();
     if (empty($retarr)) {
         $retarr = false;
     }
     $qid = db2_primary_keys($this->_connectionID, "", $schema, $table);
     if (empty($qid)) {
         return $false;
     }
     $rs =& new ADORecordSet_db2($qid);
     $ADODB_FETCH_MODE = $savem;
     if (!$rs) {
         return $retarr;
     }
     $rs->_fetch();
     /*
     $rs->fields indices
     0 TABLE_CAT
     1 TABLE_SCHEM
     2 TABLE_NAME
     3 COLUMN_NAME
     4 KEY_SEQ
     5 PK_NAME
     */
     while (!$rs->EOF) {
         if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
             $retarr[strtoupper($rs->fields[3])]->primary_key = true;
         } else {
             if (sizeof($retarr) > 0) {
                 break;
             }
         }
         $rs->MoveNext();
     }
     $rs->Close();
//.........这里部分代码省略.........
开发者ID:rowlandm,项目名称:uiexperiment,代码行数:101,代码来源:adodb-db2.inc.php

示例3: array

 /**
  * Returns an array of the fields in given table name.
  *
  * @param Model $model Model object to describe
  * @return array Fields in table. Keys are name and type
  */
 function &describe(&$model)
 {
     $cache = parent::describe($model);
     if ($cache != null) {
         return $cache;
     }
     $fields = array();
     $result = db2_columns($this->connection, '', '', strtoupper($this->fullTableName($model)));
     while (db2_fetch_row($result)) {
         $fields[strtolower(db2_result($result, 'COLUMN_NAME'))] = array('type' => $this->column(strtolower(db2_result($result, 'TYPE_NAME'))), 'null' => db2_result($result, 'NULLABLE'), 'default' => db2_result($result, 'COLUMN_DEF'), 'length' => db2_result($result, 'COLUMN_SIZE'));
     }
     $this->__cacheDescription($model->tablePrefix . $model->table, $fields);
     return $fields;
 }
开发者ID:christianallred,项目名称:fluent_univ,代码行数:20,代码来源:dbo_db2.php


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