FBIRD_PARAM_INFO
Purpose
Use the fbird_param_info function to retrieve
information about the parameters of a prepared query:
Syntax
<field_info> ::= fbird_param_info(
qry_hndl, col )
Element
|
Type
|
Description
|
qry_hndl
|
resource
|
A valid query handle
|
col
|
integer
|
A column number (first column has number 0)
|
<return>
|
mixed
|
An array on success, false on failure
|
Semantics
The fbird_param_info function returns an array
with information about the expected type for a parameter after a
parametrised query has been prepared. The array is in the form of
name, alias, relation, length, type. If the query handle is not
valid, the function returns False.
On success this function returns an associative
array with five entries. These entries are the same as for the
fbird_field_info function. Note that the entries have lowercase
names. Only the type and length entries have meaning for parameters.
Entry
|
Description
|
'name'
|
Empty string
|
'alias'
|
Empty string
|
'relation'
|
Empty string
|
'length'
|
Length in bytes.
|
'type'
|
String with SQL type name.
|
The currently
supported type names are: CAHR, VARCHAR, SMALLINT, INTEGER, BIGINT,
FLOAT, DOUBLE PRECISION, TIMESTAMP, DATE, TIME, BLOB, ARRAY and QUAD.
Note that type names are in uppercase.
It is currently not
possible to retrieve further information about columns of type ARRAY,
such as type, dimensions, and lower and upper bounds. This may be
added in a later version of the Firebird PHP5 driver.
Example
The below example code fragment queries for all
columns of a table and prints the column information for each column
in the result set:
$qry = fbird_prepare("SELECT * FROM
tablename" WHERE id=?); $coln = fbird_num_params($qry); for
($i = 0; $i < $coln; $i++) { $par_info = fbird_param_info($qry,
$i); echo "type: ".
$par_info['type']. "\n"; echo
"length: ". $par_info['length']. "\n"; }
See also
fbird_prepare,
fbird_execute,
fbird_num_params
|