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


PHP odbc_field_len函数代码示例

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


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

示例1: check_max_field_lengths

function check_max_field_lengths($fields_with_lengths, $POST)
{
    $errors = array();
    foreach ($fields_with_lengths as $fieldname) {
        $errors[] = odbc_field_len($_POST[$fieldname]);
    }
    return $errors;
}
开发者ID:aharris88,项目名称:old-projects,代码行数:8,代码来源:functions.php

示例2: 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

示例3: 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

示例4: columnData

 public function columnData()
 {
     if (empty($this->query)) {
         return false;
     }
     $columns = array();
     for ($i = 0, $index = 1, $c = $this->num_fields(); $i < $c; $i++, $index++) {
         $columns[$i] = new stdClass();
         $columns[$i]->name = odbc_field_name($this->query, $index);
         $columns[$i]->type = odbc_field_type($this->query, $index);
         $columns[$i]->max_length = odbc_field_len($this->query, $index);
         $columns[$i]->primary_key = 0;
         $columns[$i]->default = '';
     }
     return $columns;
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:16,代码来源:OdbcDriver.php

示例5: 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

示例6: CHAR

\tc CHAR(123),
\tvc VARCHAR(125)
)
EOSQL;
odbc_exec($conn, "IF OBJECT_ID('php_types') IS NOT NULL DROP TABLE php_types") or die(odbc_errormsg());
odbc_exec($conn, $sql) or die(odbc_errormsg());
$sql = "select * from php_types";
echo "Query: {$sql}\n";
$result = odbc_exec($conn, $sql) or die(odbc_errormsg());
$all = array('ui' => 'smallint-5', 'i' => 'int-10', 'ti' => 'tinyint-3', 'c' => 'char-123', 'vc' => 'varchar-125');
$err = '';
$ok = 0;
for ($i = 1; $i <= odbc_num_fields($result); $i++) {
    $name = odbc_field_name($result, $i);
    $type = odbc_field_type($result, $i);
    $len = odbc_field_len($result, $i);
    echo "column {$name} type {$type} len {$len}\n";
    $type = strtolower($type);
    if ($all[$name] != "{$type}-{$len}") {
        $err .= "Invalid column {$name}\n";
    } else {
        ++$ok;
    }
}
if ($ok != 5) {
    $err .= "Expected 5 columns\n";
}
if ($err) {
    echo "{$err}";
    exit(1);
}
开发者ID:johnnyzhong,项目名称:freetds,代码行数:31,代码来源:types.php

示例7: getColumnsMeta

 /**
  * Returns metadata for all columns in a result set.
  *
  * @return array
  */
 public function getColumnsMeta()
 {
     $count = odbc_num_fields($this->resultSet);
     $meta = array();
     for ($i = 1; $i <= $count; $i++) {
         // items 'name' and 'table' are required
         $meta[] = array('name' => odbc_field_name($this->resultSet, $i), 'table' => NULL, 'type' => odbc_field_type($this->resultSet, $i), 'length' => odbc_field_len($this->resultSet, $i), 'scale' => odbc_field_scale($this->resultSet, $i), 'precision' => odbc_field_precision($this->resultSet, $i));
     }
     return $meta;
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:15,代码来源:odbc.php

示例8: columnData

 public function columnData($col = '')
 {
     if (empty($this->query)) {
         return false;
     }
     $columns = [];
     $count = $this->numFields();
     for ($i = 0, $index = 1; $i < $count; $i++, $index++) {
         $fieldName = odbc_field_name($this->query, $index);
         $columns[$fieldName] = new \stdClass();
         $columns[$fieldName]->name = $fieldName;
         $columns[$fieldName]->type = odbc_field_type($this->query, $index);
         $columns[$fieldName]->maxLength = odbc_field_len($this->query, $index);
         $columns[$fieldName]->primaryKey = NULL;
         $columns[$fieldName]->default = NULL;
     }
     if (isset($columns[$col])) {
         return $columns[$col];
     }
     return $columns;
 }
开发者ID:znframework,项目名称:znframework,代码行数:21,代码来源:Odbc.php

示例9: odbc_exec

 $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 "],";
 $result = odbc_exec($connection, Grammar::count($_POST["table"]));
 if ($result && odbc_fetch_row($result)) {
     echo "\"totalRecords\":" . odbc_result($result, 1) . ",";
 } else {
开发者ID:jeronimonunes,项目名称:OdbcWebAdmin,代码行数:31,代码来源:metadata.php

示例10: odbc_exec

<?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 
            echo "{$gif1file} - {$gif2file} - {$gif3file}";
            odbc_free_result($res);
            $res = odbc_prepare($conn, "insert into php_test values(?,?)");
            if ($gif1file != "none") {
开发者ID:vitorgja,项目名称:hiphop-php,代码行数:31,代码来源:odbc-t5.php

示例11: form_add

function form_add($table)
{
    global $dsn, $dbConn;
    open_db();
    $tabs = odbc_tables($dbConn);
    $tables = array();
    while (odbc_fetch_row($tabs)) {
        if (odbc_result($tabs, "TABLE_TYPE") == "TABLE") {
            $table_name = odbc_result($tabs, "TABLE_NAME");
            if ($table_name == $table) {
                $tables["{$table_name}"] = array();
                $cols = odbc_exec($dbConn, 'select * from ' . $table_name . ' where 1=2');
                $ncols = odbc_num_fields($cols);
                echo "<form action='new.php?table=" . $table . "' id='" . $table . "_form' method='POST'>";
                echo "<fieldset id='edit-fields-" . $table . "'>\n";
                for ($n = 1; $n <= $ncols; $n++) {
                    $field_name = odbc_field_name($cols, $n);
                    echo "<div class='field'>\n";
                    echo "<label for='" . $field_name . "'>" . $field_name . "</label>\n";
                    if (odbc_field_len($cols, $n) > 50) {
                        $field_len = 50;
                    } else {
                        $field_len = odbc_field_len($cols, $n);
                    }
                    echo "<input class='required number' id='" . $field_name . "' name='" . $field_name . "' size='" . $field_len . "' type='text' />\n";
                    echo "</div>\n";
                }
                echo "<div class='field'>\n";
                echo "</div>\n";
                echo "</fieldset>\n";
                echo "<div class='buttons'>\n";
                echo "<input class='submit' type='submit' value='Add' />\n";
                echo "</div>\n";
                echo "</form>";
            }
        }
    }
    close_db();
    return true;
}
开发者ID:jcfischer,项目名称:AvatarHotel,代码行数:40,代码来源:db.php

示例12: odbc_getPossibleLongResult

 public function odbc_getPossibleLongResult(&$resultset, $fieldID)
 {
     $longValue = "";
     $longValue = odbc_result($resultset, $fieldID);
     if ($this->enable_lrl && $longValue != "" && odbc_field_len($resultset, $fieldID) > ini_get("odbc.defaultlrl")) {
         while (($chunk = odbc_result($resultset, $fieldID)) !== FALSE) {
             $longValue .= $chunk;
         }
     }
     return $longValue;
 }
开发者ID:neuroidss,项目名称:OSF-Web-Services,代码行数:11,代码来源:DBVirtuoso.php

示例13: vty_field_len

function vty_field_len($list,$i){
        switch($this->vtAdi){
        case 'mysql': return mysql_field_len($list,$i); break;
        case 'odbc': return odbc_field_len($list,$i); break;
        case 'mssql': return mssql_field_length($list,$i); break;
        case 'postgresql': pg_field_len($list,$i); break;
        }
}
开发者ID:awddesign,项目名称:vty,代码行数:8,代码来源:vty.php

示例14: 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

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