當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。