• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP odbc_field_type函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: db_columnType

 function db_columnType($oStmt, $iPos)
 {
     $rval = odbc_field_type($oStmt, $iPos);
     if ($rval == "") {
         $rval = "UNDEFINED";
     }
     return $rval;
 }
开发者ID:brustj,项目名称:tracmor,代码行数:8,代码来源:db_odbc.php


示例2: GetFields

 function GetFields()
 {
     $_fields = array();
     $_result = odbc_exec($this->_Link, $this->SelectCommand);
     for ($i = 1; $i <= odbc_num_fields($_result); $i++) {
         $_field = array("Name" => odbc_field_name($_result, $i), "Type" => odbc_field_type($_result, $i), "Not_Null" => 0);
         array_push($_fields, $_field);
     }
     return $_fields;
 }
开发者ID:skydel,项目名称:universal-online-exam,代码行数:10,代码来源:ODBCDataSource.php


示例3: db_getfieldslist

 /**
  * @param String strSQL
  * @return Array
  */
 public function db_getfieldslist($strSQL)
 {
     $res = array();
     $qResult = $this->connectionObj->query($strSQL);
     $fieldsNumber = $qResult->numFields();
     for ($i = 0; $i < $fieldsNumber; $i++) {
         $stype = odbc_field_type($qResult->getQueryHandle(), $i + 1);
         $ntype = $this->getFieldTypeNumber($stype);
         $res[$i] = array("fieldname" => $qResult->fieldName($i), "type" => $ntype, "is_nullable" => 0);
     }
     return $res;
 }
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:16,代码来源:ODBCInfo.php


示例4: db_getfieldslist

function db_getfieldslist($strSQL)
{
	global $conn;
	$res=array();
	$rs=db_query($strSQL,$conn);
	for($i=0;$i<db_numfields($rs);$i++)
	{
		$stype=odbc_field_type($rs,$i+1);
		$ntype=db_fieldtypenum($stype);
		$res[$i]=array("fieldname"=>db_fieldname($rs,$i),"type"=>$ntype,"is_nullable"=>0);
	}
	return $res;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:13,代码来源:dbinfo.odbc.php


示例5: 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 stdClass();
         $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:pmward,项目名称:Codeigniter-Braintree-v.zero-test-harness,代码行数:22,代码来源:odbc_result.php


示例6: ADOFieldObject

 function &FetchField($fieldOffset = -1)
 {
     $off = $fieldOffset + 1;
     // offsets begin at 1
     $o = new ADOFieldObject();
     $o->name = @odbc_field_name($this->_queryID, $off);
     $o->type = @odbc_field_type($this->_queryID, $off);
     $o->max_length = @odbc_field_len($this->_queryID, $off);
     if (ADODB_ASSOC_CASE == 0) {
         $o->name = strtolower($o->name);
     } else {
         if (ADODB_ASSOC_CASE == 1) {
             $o->name = strtoupper($o->name);
         }
     }
     return $o;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:17,代码来源:adodb-odbc.inc.php


示例7: tableInfo

 /**
  * Returns information about a table or a result set
  *
  * @param object|string  $result  DB_result object from a query or a
  *                                 string containing the name of a table.
  *                                 While this also accepts a query result
  *                                 resource identifier, this behavior is
  *                                 deprecated.
  * @param int            $mode    a valid tableInfo mode
  *
  * @return array  an associative array with the information requested.
  *                 A DB_Error object on failure.
  *
  * @see DB_common::tableInfo()
  * @since Method available since Release 1.7.0
  */
 function tableInfo($result, $mode = null)
 {
     if (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         $id = @odbc_exec($this->connection, "SELECT * FROM {$result}");
         if (!$id) {
             return $this->odbcRaiseError();
         }
         $got_string = true;
     } elseif (isset($result->result)) {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->result;
         $got_string = false;
     } else {
         /*
          * Probably received a result resource identifier.
          * Copy it.
          * Deprecated.  Here for compatibility only.
          */
         $id = $result;
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $this->odbcRaiseError(DB_ERROR_NEED_MORE_DATA);
     }
     if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     $count = @odbc_num_fields($id);
     $res = array();
     if ($mode) {
         $res['num_fields'] = $count;
     }
     for ($i = 0; $i < $count; $i++) {
         $col = $i + 1;
         $res[$i] = array('table' => $got_string ? $case_func($result) : '', 'name' => $case_func(@odbc_field_name($id, $col)), 'type' => @odbc_field_type($id, $col), 'len' => @odbc_field_len($id, $col), 'flags' => '');
         if ($mode & DB_TABLEINFO_ORDER) {
             $res['order'][$res[$i]['name']] = $i;
         }
         if ($mode & DB_TABLEINFO_ORDERTABLE) {
             $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
         }
     }
     // free the result only if we were called on a table
     if ($got_string) {
         @odbc_free_result($id);
     }
     return $res;
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:73,代码来源:odbc.php


示例8: write_data_odbc

 function write_data_odbc($table_name)
 {
     global $db;
     $ary_type = $ary_name = array();
     $ident_set = false;
     $sql_data = '';
     // Grab all of the data from current table.
     $sql = "SELECT *\n\t\t\tFROM {$table_name}";
     $result = $db->sql_query($sql);
     $retrieved_data = odbc_num_rows($result);
     if ($retrieved_data) {
         $sql = "SELECT 1 as has_identity\n\t\t\t\tFROM INFORMATION_SCHEMA.COLUMNS\n\t\t\t\tWHERE COLUMNPROPERTY(object_id('{$table_name}'), COLUMN_NAME, 'IsIdentity') = 1";
         $result2 = $db->sql_query($sql);
         $row2 = $db->sql_fetchrow($result2);
         if (!empty($row2['has_identity'])) {
             $sql_data .= "\nSET IDENTITY_INSERT {$table_name} ON\nGO\n";
             $ident_set = true;
         }
         $db->sql_freeresult($result2);
     }
     $i_num_fields = odbc_num_fields($result);
     for ($i = 0; $i < $i_num_fields; $i++) {
         $ary_type[$i] = odbc_field_type($result, $i + 1);
         $ary_name[$i] = odbc_field_name($result, $i + 1);
     }
     while ($row = $db->sql_fetchrow($result)) {
         $schema_vals = $schema_fields = array();
         // Build the SQL statement to recreate the data.
         for ($i = 0; $i < $i_num_fields; $i++) {
             $str_val = $row[$ary_name[$i]];
             if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) {
                 $str_quote = '';
                 $str_empty = "''";
                 $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val));
             } else {
                 if (preg_match('#date|timestamp#i', $ary_type[$i])) {
                     if (empty($str_val)) {
                         $str_quote = '';
                     } else {
                         $str_quote = "'";
                     }
                 } else {
                     $str_quote = '';
                     $str_empty = 'NULL';
                 }
             }
             if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) {
                 $str_val = $str_empty;
             }
             $schema_vals[$i] = $str_quote . $str_val . $str_quote;
             $schema_fields[$i] = $ary_name[$i];
         }
         // Take the ordered fields and their associated data and build it
         // into a valid sql statement to recreate that field in the data.
         $sql_data .= "INSERT INTO {$table_name} (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n";
         $this->flush($sql_data);
         $sql_data = '';
     }
     $db->sql_freeresult($result);
     if ($retrieved_data && $ident_set) {
         $sql_data .= "\nSET IDENTITY_INSERT {$table_name} OFF\nGO\n";
     }
     $this->flush($sql_data);
 }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:64,代码来源:acp_database.php


示例9: sql_fieldtype

 function sql_fieldtype($offset, $query_id = 0)
 {
     if (!$query_id) {
         $query_id = $this->query_result;
     }
     if ($query_id) {
         $result = @odbc_field_type($query_id, $offset);
         return $result;
     } else {
         return false;
     }
 }
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:12,代码来源:db2.php


示例10: FieldType

 function FieldType($rsMain, $i)
 {
     return odbc_field_type($rsMain, $i + 1);
 }
开发者ID:modulexcite,项目名称:frameworks,代码行数:4,代码来源:dbClass2.php


示例11: free

free(){odbc_free_result($this->resultSet);$this->resultSet=NULL;}function
getResultColumns(){$count=odbc_num_fields($this->resultSet);$columns=array();for($i=1;$i<=$count;$i++){$columns[]=array('name'=>odbc_field_name($this->resultSet,$i),'table'=>NULL,'fullname'=>odbc_field_name($this->resultSet,$i),'nativetype'=>odbc_field_type($this->resultSet,$i));}return$columns;}function
开发者ID:nosko,项目名称:socialSearch,代码行数:2,代码来源:dibi.min.php


示例12: afficheForm

 function afficheForm($entite, $titre, $id, $event = null, $source = null)
 {
     include_once 'classes/materiel.class.php';
     include_once 'classes/fournisseur.class.php';
     //initialise disabled
     global $disabled;
     $disabled = '';
     $cnx = ouvresylob(1);
     //recup table pr chq entité
     switch ($entite) {
         case "contrat":
             $latable = "informix.zz_contratmat";
             $lajointure = "";
             $leschamps = "*";
             $lechamp = "id_contratmat";
             $obligatoires = array("num", "debut", "fin", "preavis", "ent");
             break;
         case "intervention":
             $latable = "informix.zz_inter";
             $lajointure = "";
             $leschamps = "id_inter as id,debut_inter as debut, fin_inter as fin, \r\n                        presta_inter as prestataire, intervenant_inter as intervenant,\r\n                        etat_inter, type_inter, \r\n                        periodicite_inter as periodicite, priorite_inter as priorite, \r\n                        domaine_inter as domaine, cout_inter as cout,\r\n                        detail_inter as detail, supp_inter as supp";
             $lechamp = "id_inter";
             $obligatoires = array("debut", "fin", "intervenant", "type_inter", "domaine");
             break;
         case "materiel":
             $latable = "informix.zz_materiel";
             $lajointure = " left join informix.zz_misservice on informix.zz_misservice.id_materiel = informix.zz_materiel.id_materiel\r\n                                left join informix.zz_destruction on informix.zz_destruction.id_materiel = informix.zz_materiel.id_materiel\r\n                                left join informix.bas_postrav on informix.bas_postrav.no_poste= informix.zz_materiel.id_posttrav";
             $leschamps = "informix.zz_materiel.id_materiel as id, sn_materiel as sn, desig_materiel as designation,\r\n                            zone_materiel as zonemateriel, famille_materiel as fammat, id_posttrav as poste,\r\n                            type_materiel as typemateriel, marq_materiel as marque_materiel, frn_materiel as fournisseur,\r\n                            dteha_materiel as achat, etat_materiel as etatmateriel, contrat_materiel as contratmat, \r\n                            informix.zz_materiel.usage_materiel as usagemateriel, dte_misservice, dte_destruction";
             $lechamp = "informix.zz_materiel.id_materiel";
             $obligatoires = array("designation", "zonemateriel", "fammat", "typemateriel", "etatmateriel", "dte_misservice");
             break;
         default:
             $latable = "informix.zz_" . $entite;
             $lechamp = "id_" . $entite;
             $obligatoires = array("");
             break;
     }
     //on recupere les champs de l'entite
     $sql = "select " . $leschamps . " from " . $latable;
     if ($lajointure != '') {
         $sql .= $lajointure;
     }
     if ($id != null) {
         //on a un id => recup entite pr modif
         $sql = $sql . " where " . $lechamp . " = " . $id . "";
     } else {
         $sql = $sql . " where 1=2";
         //recup dernier id renseigné
         $sql0 = "SELECT max(" . $lechamp . ") FROM " . $latable;
         //echo $sql0;
         $res = odbc_exec($cnx, $sql0) or die('Erreur : ' . $sql);
         if (odbc_result($res, 1) > 0) {
             $no = odbc_result($res, 1) + 1;
         } else {
             $no = 1;
         }
     }
     $result = odbc_exec($cnx, $sql) or die('Erreur : ' . $sql);
     $ncols = odbc_num_fields($result);
     for ($i = 0; $i < odbc_num_fields($result); $i++) {
         $champs[] = odbc_field_name($result, $i + 1);
         $typeChamp[] = odbc_field_type($result, $i + 1);
     }
     $nb_champs = odbc_num_fields($result);
     //initialise tableau de valeurs a vide
     $valeurs = array();
     for ($i = 0; $i < $nb_champs; $i++) {
         $valeurs[$i] = '';
     }
     //si id renseigné => on est en modif : on recup donnees table
     if ($id) {
         while (odbc_fetch_row($result)) {
             for ($i = 0; $i < $nb_champs; $i++) {
                 $valeurs[$i] = odbc_result($result, $i + 1);
             }
             //si etat = 3 on disabled
             if ($entite == 'intervention' and $valeurs[5] == 3 or $entite == 'materiel' and $valeurs[10] == 3) {
                 $disabled = 'disabled';
             }
         }
         $no = $id;
     } elseif (isset($_POST['id'])) {
         for ($i = 0; $i < $nb_champs; $i++) {
             if (isset($_POST[$champs[$i]]) and $_POST[$champs[$i]] != '') {
                 $valeurs[$i] = $_POST[$champs[$i]];
             }
         }
         $no = $_POST['id'];
         //on recup n° entite pr affichage
     } elseif (isset($_GET['materiel']) and $_GET['materiel'] != '') {
         for ($i = 0; $i < $nb_champs; $i++) {
             if (isset($_GET[$champs[$i]]) and $_GET[$champs[$i]] != '') {
                 $valeurs[$i] = utf8_decode($_GET[$champs[$i]]);
                 //on a encode pr passer en param ds calendar => on decode
             }
         }
     }
     //odbc_close($cnx);
     echo "<br>";
     echo "<div id='edit'>";
//.........这里部分代码省略.........
开发者ID:enoram,项目名称:maintenance,代码行数:101,代码来源:functions.php


示例13: db_field_type

function db_field_type($res, $field_offset)
{
    switch (DATABASE) {
        case 'mysql':
            return mysql_field_type($res, $field_offset);
        case 'mysqli':
            $fo = mysqli_fetch_field_direct($res, $field_offset);
            if ($fo === false) {
                return false;
            }
            return $fo->type;
        case 'sqlserver':
            return odbc_field_type($res, $field_offset);
    }
}
开发者ID:ahmedandroid1980,项目名称:appgini,代码行数:15,代码来源:db.php


示例14: odbc_num_rows

 echo ", fields=" . $maxfields . ", rows=" . odbc_num_rows($r) . "\n";
 if (odbc_num_rows($r) == 0) {
     // if no rows, dont go looking for data _or_ fields
     continue;
 }
 // Get all the field names and store in an array $fields
 if ($maxfields > 3) {
     $maxfields = $maxfields - 3;
     // TODO: why this is needed, php crashes otherise
 }
 $ignores = array('DATE_ACCOUNT_OPENED');
 // TODO: if there are fields not to show
 for ($i = 1; $i <= $maxfields; $i++) {
     //echo "\nfield " . $i . odbc_field_name($r, $i) . " type=" . odbc_field_type($r, $i);
     if (!in_array(odbc_field_name($r, $i), $ignores)) {
         $fields[odbc_field_name($r, $i)] = odbc_field_type($r, $i);
     }
     //else
     //  echo "Ignore: " . odbc_field_name($r, $i);
 }
 //print_r($fields);   // to show the field structure
 // for each row store data in array $results indexed by fieldname
 $x = 0;
 while ($row = odbc_fetch_row($r)) {
     for ($i = 1; $i <= odbc_num_fields($r); $i++) {
         if (!in_array(odbc_field_name($r, $i), $ignores)) {
             $results[$x][odbc_field_name($r, $i)] = odbc_result($r, $i);
         }
     }
     $x++;
 }
开发者ID:Developers-account,项目名称:sage,代码行数:31,代码来源:sage1.php


示例15: odbc_exec

  <th>Name</th>
  <th>Type</th>
  <th>Length</th>
 </tr>
<?php 
            $info = odbc_exec($conn, "select * from php_test");
            $numfields = odbc_num_fields($info);
            for ($i = 1; $i <= $numfields; $i++) {
                ?>
 <tr>
  <td><?php 
                echo odbc_field_name($info, $i);
                ?>
</td>
  <td><?php 
                echo odbc_field_type($info, $i);
                ?>
</td>
  <td><?php 
                echo odbc_field_len($info, $i);
                ?>
</td>
 </tr>
<?php 
            }
            odbc_free_result($info);
            ?>
</table>

Inserting data:
<?php 
开发者ID:vitorgja,项目名称:hiphop-php,代码行数:31,代码来源:odbc-t5.php


示例16: 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();
     $sql = 'SELECT * FROM ' . $this->fullTableName($model);
     $result = odbc_exec($this->connection, $sql);
     $count = odbc_num_fields($result);
     for ($i = 1; $i <= $count; $i++) {
         $cols[$i - 1] = odbc_field_name($result, $i);
     }
     foreach ($cols as $column) {
         $type = odbc_field_type(odbc_exec($this->connection, "SELECT " . $column . " FROM " . $this->fullTableName($model)), 1);
         $fields[$column] = array('type' => $type);
     }
     $this->__cacheDescription($model->tablePrefix . $model->table, $fields);
     return $fields;
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:26,代码来源:dbo_odbc.php


示例17: mysql_free_result

         }
     }
     mysql_free_result($result);
     mysql_close($connection);
     break;
 case 'ORACLE':
     $connect = odbc_connect($servername, $username, $password);
     $result = odbc_exec($connect, $sql);
     # return error if query failed
     if (!$result) {
         print json_encode(array('error' => array('message' => odbc_errormsg($connect), 'code' => odbc_error($connect))));
         exit;
     } else {
         #odbc returns results as strings, so get datatype fields here
         for ($x = 1; $x <= odbc_num_fields($result); $x++) {
             $types[] = odbc_field_type($result, $x);
         }
         while ($row = odbc_fetch_array($result)) {
             $x = 0;
             #convert each string to its actual datatype, so easily usable in javascript
             foreach ($row as $key => $value) {
                 switch ($types[$x]) {
                     case 'NUMBER':
                         $row[$key] = $value + 0;
                         break;
                     default:
                         break;
                 }
                 $x++;
             }
             $data[] = $row;
开发者ID:BryanJacobHunter,项目名称:tcmCoilApp,代码行数:31,代码来源:json_db_lib.php


示例18: odbc_exec

<?php

if (isset($_POST['table'])) {
    $sql = Grammar::select_all($_POST['table']);
    $result = odbc_exec($connection, $sql);
    if ($result) {
        $nCols = odbc_num_fields($result);
        odbc_fetch_row($result, 0);
    } else {
        $nCols = 0;
        $status = odbc_errormsg($connection);
    }
    echo "\"metadata\":[";
    for ($i = 1; $i <= $nCols; $i++) {
        echo "{\"type\":";
        echo json_encode(odbc_field_type($result, $i));
        echo ",\"name\":";
        echo json_encode(odbc_field_name($result, $i));
        echo ",\"len\":";
        echo json_encode(odbc_field_len($result, $i));
        echo ",\"precision\":";
        echo json_encode(odbc_field_precision($result, $i));
        echo ",\"scale\":";
        echo json_encode(odbc_field_scale($result, $i));
        if ($i < $nCols) {
            echo "},";
        } else {
            echo "}";
        }
    }
    echo "],";
开发者ID:jeronimonunes,项目名称:OdbcWebAdmin,代码行数:31,代码来源:metadata.php


示例19: ADOFieldObject

 function &FetchField($fieldOffset = -1)
 {
     $off = $fieldOffset + 1;
     // offsets begin at 1
     $o = new ADOFieldObject();
     $o->name = @odbc_field_name($this->_queryID, $off);
     $o->type = @odbc_field_type($this->_queryID, $off);
     $o->max_length = @odbc_field_len($this->_queryID, $off);
     return $o;
 }
开发者ID:qoire,项目名称:portal,代码行数:10,代码来源:adodb-odbc.inc.php


示例20: ecritFormulaire

 function ecritFormulaire($pTable, $pNomForm, $pFichAction, $pMethode, $pFichier)
 {
     //écrit dans un fichier le code HTML produisant un formulaire pour les champs d'une table d'une base
     $result = odbc_do($this->connexion, "select * from " . $pTable);
     //explore les champs de la table
     //écriture des propriétés du formulaire
     fputs($pFichier, '<form name="' . $pNomForm . '" method="' . $pMethode . '" action="' . $pFichAction . '">');
     //écrit dans le fichier
     fputs($pFichier, "\n");
     //retour à la ligne
     //parcours des champs de la table
     for ($i = 1; $i < odbc_num_fields($result) + 1; $i++) {
         $this->traiteUnChampForm(odbc_field_name($result, $i), odbc_field_type($result, $i), odbc_field_len($result, $i), $pFichier);
     }
     //écriture du pied de formulaire avec les boutons correspondants
     fputs($pFichier, '<label class="titre"></label><div class="zone"><input type="reset" value="annuler"></input><input type="submit"></input></form>');
 }
开发者ID:silly-kid,项目名称:MonPortefolio,代码行数:17,代码来源:classGesTables.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP odbc_primarykeys函数代码示例发布时间:2022-05-24
下一篇:
PHP odbc_field_name函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap