Structures_DataGrid::dataSourceFactory

Structures_DataGrid::dataSourceFactory() – データソースドライバのファクトリ

Synopsis

require_once 'Structures/DataGrid.php';

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

Description

データソースドライバの読み込みとインスタンス作成を行う、賢いメソッドです。

さまざまな方法でコールすることができます。

ソースの型を検出し、適切なドライバをデフォルトのオプションで読み込む:

<?php
$driver 
=& Structures_DataGrid::dataSourceFactory($source);
?>

ソースの型を検出し、適切なドライバを指定したオプションで読み込む:

<?php
$driver 
=& Structures_DataGrid::dataSourceFactory($source$options);
?>

型を明示的に指定してドライバを読み込む (検出ルーチンを飛ばすため、高速です):

<?php
$driver 
=& Structures_DataGrid::dataSourceFactory($source$options$type);
?>

Parameter

mixed $source

ドライバに対応するデータソース。

array $options

array(optionName => optionValue, ...) 形式の連想配列。

string $type

データソースの型を表す定数 (DATAGRID_SOURCE_* 形式)。

Return value

ドライバオブジェクト、あるいは失敗した場合に PEAR_Error を返します。

Throws

例外はスローされません。

See

Structures_DataGrid::_detectSourceType() も参照ください。

Note

This function can not be called statically.