fbsql_field_typeとは何? わかりやすく解説 Weblio辞書 (original) (raw)

PHP Documentation GroupPHP Documentation Group

fbsql_field_type

(PHP 4 >= 4.0.6, PHP 5)
fbsql_field_type — 結果の中で指定したフィールドの型を得る

説明

string fbsql_field_type ( resource result [, int field_offset] )
fbsql_field_type()fbsql_field_name() 関数と同じですが、 返される内容がフィールドの型となります。

パラメータ

result

fbsql_query() あるいはfbsql_db_query() が返す結果 ID。

field_offset

フィールドの数値オフセット。フィールドのインデックスは 0 からはじまります。

返り値

フィールドの型を文字列で返します。
これは int、real、string、blob あるいは» FrontBase のドキュメント で詳細が説明されている型のいずれかです。

例 660. fbsql_field_type() の例
`<?php

fbsql_connect("localhost", "_SYSTEM", "");
fbsql_select_db("wisconsin");
$result = fbsql_query("SELECT * FROM onek;"); fields=fbsqlnumfields(fields = fbsql_num_fields(fields=fbsqlnumfields(result); rows=fbsqlnumrows(rows = fbsql_num_rows(rows=fbsqlnumrows(result); i=0;<spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>t</mi><mi>a</mi><mi>b</mi><mi>l</mi><mi>e</mi><mo>=</mo><mi>f</mi><mi>b</mi><mi>s</mi><mi>q</mi><msub><mi>l</mi><mi>f</mi></msub><mi>i</mi><mi>e</mi><mi>l</mi><msub><mi>d</mi><mi>t</mi></msub><mi>a</mi><mi>b</mi><mi>l</mi><mi>e</mi><mostretchy="false">(</mo></mrow><annotationencoding="application/x−tex">table=fbsqlfieldtable(</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.6944em;"></span><spanclass="mordmathnormal">t</span><spanclass="mordmathnormal">ab</span><spanclass="mordmathnormal"style="margin−right:0.01968em;">l</span><spanclass="mordmathnormal">e</span><spanclass="mspace"style="margin−right:0.2778em;"></span><spanclass="mrel">=</span><spanclass="mspace"style="margin−right:0.2778em;"></span></span><spanclass="base"><spanclass="strut"style="height:1.0361em;vertical−align:−0.2861em;"></span><spanclass="mordmathnormal"style="margin−right:0.10764em;">f</span><spanclass="mordmathnormal">b</span><spanclass="mordmathnormal">s</span><spanclass="mordmathnormal"style="margin−right:0.03588em;">q</span><spanclass="mord"><spanclass="mordmathnormal"style="margin−right:0.01968em;">l</span><spanclass="msupsub"><spanclass="vlist−tvlist−t2"><spanclass="vlist−r"><spanclass="vlist"style="height:0.3361em;"><spanstyle="top:−2.55em;margin−left:−0.0197em;margin−right:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingreset−size6size3mtight"><spanclass="mordmathnormalmtight"style="margin−right:0.10764em;">f</span></span></span></span><spanclass="vlist−s">​</span></span><spanclass="vlist−r"><spanclass="vlist"style="height:0.2861em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal">e</span><spanclass="mordmathnormal"style="margin−right:0.01968em;">l</span><spanclass="mord"><spanclass="mordmathnormal">d</span><spanclass="msupsub"><spanclass="vlist−tvlist−t2"><spanclass="vlist−r"><spanclass="vlist"style="height:0.2806em;"><spanstyle="top:−2.55em;margin−left:0em;margin−right:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingreset−size6size3mtight"><spanclass="mordmathnormalmtight">t</span></span></span></span><spanclass="vlist−s">​</span></span><spanclass="vlist−r"><spanclass="vlist"style="height:0.15em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">ab</span><spanclass="mordmathnormal"style="margin−right:0.01968em;">l</span><spanclass="mordmathnormal">e</span><spanclass="mopen">(</span></span></span></span>result,i = 0; <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>t</mi><mi>a</mi><mi>b</mi><mi>l</mi><mi>e</mi><mo>=</mo><mi>f</mi><mi>b</mi><mi>s</mi><mi>q</mi><msub><mi>l</mi><mi>f</mi></msub><mi>i</mi><mi>e</mi><mi>l</mi><msub><mi>d</mi><mi>t</mi></msub><mi>a</mi><mi>b</mi><mi>l</mi><mi>e</mi><mo stretchy="false">(</mo></mrow><annotation encoding="application/x-tex">table = fbsql_field_table(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">t</span><span class="mord mathnormal">ab</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0361em;vertical-align:-0.2861em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal">b</span><span class="mord mathnormal">s</span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mord"><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-left:-0.0197em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.10764em;">f</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mord mathnormal">i</span><span class="mord mathnormal">e</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.2806em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">t</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">ab</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">e</span><span class="mopen">(</span></span></span></span>result, i=0;<spanclass="katex"><spanclass="katexmathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>t</mi><mi>a</mi><mi>b</mi><mi>l</mi><mi>e</mi><mo>=</mo><mi>f</mi><mi>b</mi><mi>s</mi><mi>q</mi><msub><mi>l</mi><mi>f</mi></msub><mi>i</mi><mi>e</mi><mi>l</mi><msub><mi>d</mi><mi>t</mi></msub><mi>a</mi><mi>b</mi><mi>l</mi><mi>e</mi><mostretchy="false">(</mo></mrow><annotationencoding="application/xtex">table=fbsqlfieldtable(</annotation></semantics></math></span><spanclass="katexhtml"ariahidden="true"><spanclass="base"><spanclass="strut"style="height:0.6944em;"></span><spanclass="mordmathnormal">t</span><spanclass="mordmathnormal">ab</span><spanclass="mordmathnormal"style="marginright:0.01968em;">l</span><spanclass="mordmathnormal">e</span><spanclass="mspace"style="marginright:0.2778em;"></span><spanclass="mrel">=</span><spanclass="mspace"style="marginright:0.2778em;"></span></span><spanclass="base"><spanclass="strut"style="height:1.0361em;verticalalign:0.2861em;"></span><spanclass="mordmathnormal"style="marginright:0.10764em;">f</span><spanclass="mordmathnormal">b</span><spanclass="mordmathnormal">s</span><spanclass="mordmathnormal"style="marginright:0.03588em;">q</span><spanclass="mord"><spanclass="mordmathnormal"style="marginright:0.01968em;">l</span><spanclass="msupsub"><spanclass="vlisttvlistt2"><spanclass="vlistr"><spanclass="vlist"style="height:0.3361em;"><spanstyle="top:2.55em;marginleft:0.0197em;marginright:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingresetsize6size3mtight"><spanclass="mordmathnormalmtight"style="marginright:0.10764em;">f</span></span></span></span><spanclass="vlists"></span></span><spanclass="vlistr"><spanclass="vlist"style="height:0.2861em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal">e</span><spanclass="mordmathnormal"style="marginright:0.01968em;">l</span><spanclass="mord"><spanclass="mordmathnormal">d</span><spanclass="msupsub"><spanclass="vlisttvlistt2"><spanclass="vlistr"><spanclass="vlist"style="height:0.2806em;"><spanstyle="top:2.55em;marginleft:0em;marginright:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingresetsize6size3mtight"><spanclass="mordmathnormalmtight">t</span></span></span></span><spanclass="vlists"></span></span><spanclass="vlistr"><spanclass="vlist"style="height:0.15em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">ab</span><spanclass="mordmathnormal"style="marginright:0.01968em;">l</span><spanclass="mordmathnormal">e</span><spanclass="mopen">(</span></span></span></span>result,i);
echo "テーブル '" . table."′には、フィールドが".table . "' には、フィールドが " . table."には、フィールドが".fields . " そしてレコードが " . $rows . " 件あります
";
echo "テーブルのフィールドは以下のとおりです
";
while ($i < $fields) {
type=fbsqlfieldtype(type = fbsql_field_type(type=fbsqlfieldtype(result, $i);
name=fbsqlfieldname(name = fbsql_field_name(name=fbsqlfieldname(result, $i);
len=fbsqlfieldlen(len = fbsql_field_len(len=fbsqlfieldlen(result, $i);
flags=fbsqlfieldflags(flags = fbsql_field_flags(flags=fbsqlfieldflags(result, $i);
echo type."".type . " " . type."".name . " " . len."".len . " " . len."".flags . "
";
$i++;
}
fbsql_close();

?>

`

参考

fbsql_field_name()

急上昇のことば