PHP Velho Oeste 2024

sybase_fetch_field

(PHP 4, PHP 5)

sybase_fetch_field結果からフィールド情報を取得する

警告

この機能は PHP 7.0.0 で 削除 されました。

説明

sybase_fetch_field ( resource $result [, int $field_offset = -1 ] ) : object

sybase_fetch_field() は、あるクエリーの結果において、 フィールドに関する情報を得るために使用します。

パラメータ

result

field_offset

フィールドオフセットが指定されない場合、 sybase_fetch_field() によりまだ取り込まれていない次のフィールドが取り込まれます。

返り値

フィールド情報を含むオブジェクトを返します。

オブジェクトのプロパティを以下に示します。

  • name - カラム名。そのカラムがある関数の結果である場合、 このプロパティは、computed#N にセットされます。ただし、#N はシリアルナンバーです。
  • column_source - そのカラムが取り出されたテーブル
  • max_length - カラムの最大長
  • numeric - そのカラムが数値である場合に 1
  • type - カラムのデータ型

参考

add a note add a note

User Contributed Notes 2 notes

up
0
anthony dot leung at virgin dot net
20 years ago
Bit short on comments and tips bout this one so head down to mysql_fetch_fields where the concept is the same. I seemed to get an infinite loop over there using the $i counter tho, so I used a for loop instead.
The list of properties you can get from what I've called $info is in the example to the mysql equivalent.

//start of an example to print out column headings

echo "<table><tr>";
  $numfields=sybase_num_fields($query);
  for ($f=0;$f<=$numfields;$f++){
    $info = sybase_fetch_field($query);
    echo "<td> $info->name </td>";
  }
  echo "</tr><tr>";
up
0
gray at voicenet dot com
24 years ago
The 'type' field contains (roughly) the datatype of the source column.  Types returned are:

  'type'   Sybase Type
  -------  --------------------------
  string   CHAR, VARCHAR, TEXT
  image    IMAGE
  blob     BINARY, VARBINARY
  bit      BIT
  int      TINYINT, SMALLINT, INT
  real     REAL, FLOAT, NUMERIC, DECIMAL
  money    MONEY
  datetime DATETIME, SMALLDATETIME
To Top