Structures_DataGrid::dataSourceFactory()

Structures_DataGrid::dataSourceFactory()  -- Datasource driver Factory

Synopsis

require_once 'Structures/DataGrid.php';

Structures_DataGrid_DataSource|PEAR_Error& Structures_DataGrid::dataSourceFactory (mixed $source, array [$options = array()], string [$type = NULL])

Description

A clever method which loads and instantiate data source drivers.

Can be called in various ways:

Detect the source type and load the appropriate driver with default options:
$driver =& Structures_DataGrid::dataSourceFactory($source);

Detect the source type and load the appropriate driver with custom options:
$driver =& Structures_DataGrid::dataSourceFactory($source, $options);

Load a driver for an explicit type (faster, bypasses detection routine):
$driver =& Structures_DataGrid::dataSourceFactory($source, $options, $type);

Paramètres

mixed $source

The data source respective to the driver

array $options

An associative array of the form: array(optionName => optionValue, ...)

chaîne de caractères $type

The data source type constant (of the form DATAGRID_SOURCE_*)

Valeur retournée

returns driver object or PEAR_Error on failure

Valeurs renvoyées

throws no exceptions thrown

Voir aussi

see Structures_DataGrid::_detectSourceType()

Note

Cette fonction ne peut pas être appelée de façon statique.