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


PHP odbc_field_name函数代码示例

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


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

示例1: odbcAdapter

 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * The body of this method was provided by Mario Falomir... Thanks.
  * 
  * @param resource $d The datasource resource
  */
 function odbcAdapter($d)
 {
     parent::RecordSetAdapter($d);
     // count number of fields
     $fieldcount = odbc_num_fields($d);
     $ob = "";
     $be = $this->isBigEndian;
     $fc = pack('N', $fieldcount);
     if (odbc_num_rows($d) > 0) {
         $line = odbc_fetch_row($d, 0);
         do {
             // write all of the array elements
             $ob .= "\n" . $fc;
             for ($i = 1; $i <= $fieldcount; $i++) {
                 // write all of the array elements
                 $value = odbc_result($d, $i);
                 if (is_string($value)) {
                     // type as string
                     $os = $this->_directCharsetHandler->transliterate($value);
                     //string flag, string length, and string
                     $len = strlen($os);
                     if ($len < 65536) {
                         $ob .= "" . pack('n', $len) . $os;
                     } else {
                         $ob .= "\f" . pack('N', $len) . $os;
                     }
                 } elseif (is_float($value) || is_int($value)) {
                     // type as double
                     $b = pack('d', $value);
                     // pack the bytes
                     if ($be) {
                         // if we are a big-endian processor
                         $r = strrev($b);
                     } else {
                         // add the bytes to the output
                         $r = $b;
                     }
                     $ob .= "" . $r;
                 } elseif (is_bool($value)) {
                     //type as bool
                     $ob .= "";
                     $ob .= pack('c', $value);
                 } elseif (is_null($value)) {
                     // null
                     $ob .= "";
                 }
             }
         } while ($line = odbc_fetch_row($d));
     }
     $this->serializedData = $ob;
     // grab the number of fields
     // loop over all of the fields
     for ($i = 1; $i <= $fieldcount; $i++) {
         // decode each field name ready for encoding when it goes through serialization
         // and save each field name into the array
         $this->columnNames[$i - 1] = $this->_directCharsetHandler->transliterate(odbc_field_name($d, $i));
     }
     $this->numRows = odbc_num_rows($d);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:67,代码来源:odbcAdapter.php

示例2: fetchFields

 public function fetchFields()
 {
     $fields = array();
     for ($i = 0; $i < odbc_num_fields($this->result); ++$i) {
         $fields[] = odbc_field_name($this->result, $i);
     }
     return $fields;
 }
开发者ID:johsbk,项目名称:penguin,代码行数:8,代码来源:ODBCResultSet.php

示例3: list_fields

 /**
  * 表的字段列表
  *
  * 生成一个表字段列名称的数组,修复默认 CI_DB_odbc_result->list_fields()的错误
  *
  * @access	public
  * @return	array
  */
 function list_fields()
 {
     $field_names = array();
     for ($i = 1; $i <= $this->num_fields(); $i++) {
         $field_names[] = odbc_field_name($this->result_id, $i);
     }
     return $field_names;
 }
开发者ID:asonweb,项目名称:mycicms,代码行数:16,代码来源:MY_DB_odbc_result.php

示例4: _fetch_array

function _fetch_array($bdid)
{
    global $ODBC_ID, $last_odbc_result;
    if (odbc_fetch_into($bdid, $res_odbc_row)) {
        foreach ($res_odbc_row as $k => $v) {
            $data_odbc_row[odbc_field_name($bdid, $k + 1)] = $v;
        }
        return $data_odbc_row;
    } else {
        return False;
    }
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:12,代码来源:odbc.inc.php

示例5: ironhacker

 /**
 	Thanks to ironhacker (ironhacker at users.sourceforge.net) for this!
 */
 function odbc_fetch_array_hack($result, $rownumber = -1)
 {
     $rs_assoc = array();
     if (PHP_VERSION > "4.1") {
         if ($rownumber < 0) {
             odbc_fetch_into($result, &$rs);
         } else {
             odbc_fetch_into($result, &$rs, $rownumber);
         }
     } else {
         odbc_fetch_into($result, $rownumber, &$rs);
     }
     foreach ($rs as $key => $value) {
         $rs_assoc[odbc_field_name($result, $key + 1)] = $value;
     }
     return $rs_assoc;
 }
开发者ID:brustj,项目名称:tracmor,代码行数:20,代码来源:db_odbc.php

示例6: listeFourni

function listeFourni()
{
    global $cnx, $liste;
    $cnx = ouvresylob(1);
    //on selectionne tous les champs qui seront utiles
    $sQuery = "SELECT distinct (f.no_frn) as id, f.rais_soc as raison_sociale, a.nom as contact, f.telph as tel, telex as email, \r\n                        CONCAT(a.adr1,a.adr2) as adresse, CONCAT(a.cd_post,a.ville) as ville\r\n                FROM (informix.bas_frn f \r\n                INNER JOIN informix.bas_adrfrn a ON a.no_frn = f.no_frn) \r\n                LEFT JOIN informix.zz_materiel m ON m.frn_materiel = f.no_frn\r\n                WHERE f.no_frn is not null\r\n                AND a.no_adr = 1\r\n                ORDER BY f.rais_soc asc, a.nom asc";
    //echo $sQuery;
    $res = odbc_exec($cnx, $sQuery);
    $i = 0;
    while (odbc_fetch_row($res)) {
        for ($j = 1; $j <= odbc_num_fields($res); $j++) {
            $liste[$i][odbc_field_name($res, $j)] = odbc_result($res, $j);
        }
        $i++;
    }
    //odbc_close($cnx);
    return $liste;
}
开发者ID:enoram,项目名称:maintenance,代码行数:18,代码来源:fournisseur.class.php

示例7: odbcAdapter

 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * The body of this method was provided by Mario Falomir... Thanks.
  * 
  * @param resource $d The datasource resource
  */
 function odbcAdapter($d)
 {
     parent::RecordSetAdapter($d);
     // count number of fields
     $fieldcount = odbc_num_fields($d);
     // grab the number of fields
     // loop over all of the fields
     for ($i = 0; $i < $fieldcount; $i++) {
         // decode each field name ready for encoding when it goes through serialization
         // and save each field name into the array
         $this->columns[] = odbc_field_name($d, $i + 1);
     }
     if (odbc_num_rows($d) > 0) {
         $line = odbc_fetch_row($d, 0);
         do {
             $this->rows[] = $line;
         } while ($line = odbc_fetch_row($d));
     }
 }
开发者ID:nimigeanu,项目名称:hollow,代码行数:27,代码来源:odbcAdapter.php

示例8: _odbc_fetch_array

 /**
  * Result - array
  *
  * subsititutes the odbc_fetch_array function when
  * not available (odbc_fetch_array requires unixODBC)
  *
  * @access	private
  * @return	array
  */
 function _odbc_fetch_array(&$odbc_result)
 {
     $rs = array();
     $rs_assoc = FALSE;
     if (odbc_fetch_into($odbc_result, $rs)) {
         $rs_assoc = array();
         foreach ($rs as $k => $v) {
             $field_name = odbc_field_name($odbc_result, $k + 1);
             $rs_assoc[$field_name] = $v;
         }
     }
     return $rs_assoc;
 }
开发者ID:pmward,项目名称:Codeigniter-Braintree-v.zero-test-harness,代码行数:22,代码来源:odbc_result.php

示例9: getFieldNames

 /**
  * ODBC::getFieldNames()
  *
  * Return the field names of the table
  *
  * @param string $table: the table where we should fetch the field names from
  * @return array
  * @access public
  * @author Teye Heimans
  */
 function getFieldNames($table)
 {
     $sql = odbc_columns($this->_conn);
     $result = array();
     $num = odbc_num_fields($sql);
     for ($i = 1; $i <= $num; $i++) {
         $result[$i - 1] = odbc_field_name($sql, $i);
     }
     $num = odbc_num_rows($sql);
     echo "Aantal rows: {$num}<br />\n";
     for ($i = 0; $i <= $num; $i++) {
         echo odbc_result($sql, 4) . "<br >\n";
     }
     return $result;
 }
开发者ID:reshadf,项目名称:RMProject,代码行数:25,代码来源:class.ODBC.php

示例10: msaccess_data

 function msaccess_data()
 {
     if (($this->error = $this->checkCredentials()) != "") {
         return $this->error;
     }
     if (!($con = odbc_connect("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $this->database_name, $this->username, $this->password))) {
         return odbc_errormsg($conn);
     }
     if (!($res = odbc_exec($con, $this->query))) {
         return "Query Failed";
     }
     $i = 0;
     $this->data = array();
     $col = odbc_num_fields($res);
     for ($f = 1; $f <= $col; $f++) {
         $key_arr[] = odbc_field_name($res, $f);
     }
     while ($thisrow = odbc_fetch_array($res)) {
         $this->data[$i] = array();
         foreach ($key_arr as $key) {
             $this->data[$i][$key] = $thisrow[$key];
         }
         $i++;
     }
     odbc_close($con);
 }
开发者ID:BoulderOWASP,项目名称:SnowFROC_CTF_2013_Exercises,代码行数:26,代码来源:phpchart.class.php

示例11: field_data

 /**
  * Field data
  *
  * Generates an array of objects containing field meta-data
  *
  * @access	public
  * @return	array
  */
 function field_data()
 {
     $retval = array();
     for ($i = 0; $i < $this->num_fields(); $i++) {
         $F = new CI_DB_field();
         $F->name = odbc_field_name($this->result_id, $i);
         $F->type = odbc_field_type($this->result_id, $i);
         $F->max_length = odbc_field_len($this->result_id, $i);
         $F->primary_key = 0;
         $F->default = '';
         $retval[] = $F;
     }
     return $retval;
 }
开发者ID:Calico90,项目名称:codeigniter-version-scan,代码行数:22,代码来源:DB_odbc.php

示例12: db_get_query_rows

 /**
  * Get the rows returned from a SELECT query.
  *
  * @param  resource		The query result pointer
  * @param  ?integer		Whether to start reading from (NULL: irrelevant for this forum driver)
  * @return array			A list of row maps
  */
 function db_get_query_rows($results, $start = NULL)
 {
     $out = array();
     $i = 0;
     $num_fields = odbc_num_fields($results);
     $types = array();
     $names = array();
     for ($x = 1; $x <= $num_fields; $x++) {
         $types[$x] = odbc_field_type($results, $x);
         $names[$x] = odbc_field_name($results, $x);
     }
     while (odbc_fetch_row($results)) {
         if (is_null($start) || $i >= $start) {
             $newrow = array();
             for ($j = 1; $j <= $num_fields; $j++) {
                 $v = odbc_result($results, $j);
                 $type = $types[$j];
                 $name = strtolower($names[$j]);
                 if ($type == 'INTEGER' || $type == 'SMALLINT' || $type == 'UINTEGER') {
                     if (!is_null($v)) {
                         $newrow[$name] = intval($v);
                     } else {
                         $newrow[$name] = NULL;
                     }
                 } else {
                     $newrow[$name] = $v;
                 }
             }
             $out[] = $newrow;
         }
         $i++;
     }
     odbc_free_result($results);
     //	echo '<p>End '.microtime(false);
     return $out;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:43,代码来源:ibm.php

示例13: sql_field_name

 function sql_field_name($sqltype, $result, $i)
 {
     if ($sqltype == 'mysql') {
         if (class_exists('mysqli_result')) {
             $z = $result->fetch_field();
             return $z->name;
         } elseif (function_exists('mysql_field_name')) {
             return mysql_field_name($result, $i);
         }
     } elseif ($sqltype == 'mssql') {
         if (function_exists('sqlsrv_field_metadata')) {
             $metadata = sqlsrv_field_metadata($result);
             if (is_array($metadata)) {
                 $metadata = $metadata[$i];
             }
             if (is_array($metadata)) {
                 return $metadata['Name'];
             }
         } elseif (function_exists('mssql_field_name')) {
             return mssql_field_name($result, $i);
         }
     } elseif ($sqltype == 'pgsql') {
         return pg_field_name($result, $i);
     } elseif ($sqltype == 'oracle') {
         return oci_field_name($result, $i + 1);
     } elseif ($sqltype == 'sqlite3') {
         return $result->columnName($i);
     } elseif ($sqltype == 'sqlite') {
         return sqlite_field_name($result, $i);
     } elseif ($sqltype == 'odbc') {
         return odbc_field_name($result, $i + 1);
     } elseif ($sqltype == 'pdo') {
         $res = $result->getColumnMeta($i);
         return $res['name'];
     }
 }
开发者ID:retanoj,项目名称:webshellSample,代码行数:36,代码来源:7394316867fbf40088309b5150e77721.php

示例14: fetchInto

 function fetchInto($result, &$row, $fetchmode, $rownum = null)
 {
     $row = array();
     if ($rownum !== null) {
         $rownum++;
         // ODBC first row is 1
         if (version_compare(phpversion(), '4.2.0', 'ge')) {
             $cols = odbc_fetch_into($result, $row, $rownum);
         } else {
             $cols = odbc_fetch_into($result, $rownum, $row);
         }
     } else {
         $cols = odbc_fetch_into($result, $row);
     }
     if (!$cols) {
         /* XXX FIXME: doesn't work with unixODBC and easysoft
                          (get corrupted $errno values)
            if ($errno = odbc_error($this->connection)) {
                return $this->RaiseError($errno);
            }*/
         return null;
     }
     if ($fetchmode !== DB_FETCHMODE_ORDERED) {
         for ($i = 0; $i < count($row); $i++) {
             $colName = odbc_field_name($result, $i + 1);
             $a[$colName] = $row[$i];
         }
         if ($this->options['optimize'] == 'portability') {
             $a = array_change_key_case($a, CASE_LOWER);
         }
         $row = $a;
     }
     return DB_OK;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:34,代码来源:odbc.php

示例15: sql_fetch_object

function sql_fetch_object(&$res, $nr = 0)
{
    global $dbtype;
    switch ($dbtype) {
        case "MySQL":
            $row = mysql_fetch_object($res);
            if ($row) {
                return $row;
            } else {
                return false;
            }
            break;
        case "mSQL":
            $row = msql_fetch_object($res);
            if ($row) {
                return $row;
            } else {
                return false;
            }
            break;
        case "postgres":
        case "postgres_local":
            if ($res->get_total_rows() > $res->get_fetched_rows()) {
                $row = pg_fetch_object($res->get_result(), $res->get_fetched_rows());
                $res->increment_fetched_rows();
                if ($row) {
                    return $row;
                } else {
                    return false;
                }
            } else {
                return false;
            }
            break;
        case "ODBC":
            $result = odbc_fetch_row($res, $nr);
            if (!$result) {
                return false;
            }
            $nf = odbc_num_fields($res);
            /* Field numbering starts at 1 */
            for ($count = 1; $count < $nf + 1; $count++) {
                $field_name = odbc_field_name($res, $count);
                $field_value = odbc_result($res, $field_name);
                $row->{$field_name} = $field_value;
            }
            return $row;
            break;
        case "ODBC_Adabas":
            $result = odbc_fetch_row($res, $nr);
            if (!$result) {
                return false;
            }
            $nf = count($result) + 2;
            /* Field numbering starts at 1 */
            for ($count = 1; $count < $nf; $count++) {
                $field_name = odbc_field_name($res, $count);
                $field_value = odbc_result($res, $field_name);
                $row->{$field_name} = $field_value;
            }
            return $row;
            break;
        case "Interbase":
            $orow = ibase_fetch_object($res);
            if ($orow) {
                $arow = get_object_vars($orow);
                while (list($name, $key) = each($arow)) {
                    $name = strtolower($name);
                    $row->{$name} = $key;
                }
                return $row;
            } else {
                return false;
            }
            break;
        case "Sybase":
            $row = sybase_fetch_object($res);
            return $row;
            break;
    }
}
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:81,代码来源:sql_layer.php


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