ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:recordset:fieldtypesarray

This is an old revision of the document!


fieldTypesArray

See Also

fetchField

Syntax
array fieldTypesArray()

Description

The method returns an array of ADOFieldObjects representing all of the objects returned in a result set. It is the equivalent of looping from 1 to fieldCount , calling the fetchField method. The method returns false if a recordset is not available for any reason


Example

This example uses a postgres database so returns numerous Postgress specific fields

$sql = "SELECT * FROM employees";
 
$result = $db->execute($sql)
 
print_r($results->fieldTypesArray());
/*
* Returns
Array
(
    [0] => ADOFieldObject Object
        (
            [name] => emp_no
            [max_length] => 0
            [type] => 3
            [orgname] => emp_no
            [table] => dept_emp
            [orgtable] => dept_emp
            [def] => 
            [db] => employees
            [catalog] => def
            [length] => 11
            [charsetnr] => 63
            [flags] => 53251
            [decimals] => 0
            [primary_key] => 2
            [not_null] => 1
            [auto_increment] => 0
            [binary] => 0
            [unsigned] => 0
        )
 
    [1] => ADOFieldObject Object
        (
            [name] => dept_no
            [max_length] => 4
            [type] => 254
            [orgname] => dept_no
            [table] => dept_emp
            [orgtable] => dept_emp
            [def] => 
            [db] => employees
            [catalog] => def
            [length] => 16
            [charsetnr] => 255
            [flags] => 20491
            [decimals] => 0
            [primary_key] => 2
            [not_null] => 1
            [auto_increment] => 0
            [binary] => 0
            [unsigned] => 0
        )
 
    [2] => ADOFieldObject Object
        (
            [name] => from_date
            [max_length] => 10
            [type] => 10
            [orgname] => from_date
            [table] => dept_emp
            [orgtable] => dept_emp
            [def] => 
            [db] => employees
            [catalog] => def
            [length] => 10
            [charsetnr] => 63
            [flags] => 4225
            [decimals] => 0
            [primary_key] => 0
            [not_null] => 1
            [auto_increment] => 0
            [binary] => 128
            [unsigned] => 0
        )
......
*/
v5/reference/recordset/fieldtypesarray.1620177602.txt.gz · Last modified: 2021/05/05 03:20 by mnewnham