GraphDatabaseTiein: ezcGraphDatabaseDataSet
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcGraphDatabaseDataSet
|
Class to transform PDO results into ezcGraphDataSets [
source]
Parents
ezcGraphDataSet
|
--ezcGraphDatabaseDataSet
Inherited Member Variables
From
ezcGraphDataSet:
Method Summary
|
public ezcGraphDatabase |
__construct(
$statement, [$definition = null] )
Constructor |
|
public int |
count(
)
Returns the number of elements in this dataset |
|
protected void |
createFromPdo(
$statement, [$definition = null] )
Create dataset from PDO statement |
|
protected void |
fetchByDefinition(
$statement, $definition )
Fecth data by provided definition |
|
protected void |
fetchNumeric(
$statement )
Fetch numeric |
Inherited Methods
From
ezcGraphDataSet :
Methods
__construct
ezcGraphDatabase __construct(
$statement, [
$definition = null] )
Constructor
Creates a ezcGraphDatabase from a PDOStatement and uses the columns defined in the definition array as keys and values for the data set.
If the definition array is empty a single column will be used as values, with two columns the first column will be used for the keys and the second for the data set values.
You may define the name of the rows used for keys and values by using an array like: array ( ezcGraph::KEY => 'row name', ezcGraph::VALUE => 'row name', );
PDO by default lowercases all column names, see PDO::setAttribute() for details. If the column names you pass to the dataset definition array are not lowercase, you either need to change the PDO::ATTR_CASE attribute of your PDO connection instance, or lowercase the names passed to the definition array. Otherwise this will throw ezcGraphDatabaseMissingColumnException exceptions.
Parameters
| Name |
Type |
Description |
$statement |
PDOStatement |
|
$definition |
array |
|
count
int count(
)
Returns the number of elements in this dataset
createFromPdo
void createFromPdo(
$statement, [
$definition = null] )
Create dataset from PDO statement
This methods uses the values from a PDOStatement to fill up the data sets data.
If the definition array is empty a single column will be used as values, with two columns the first column will be used for the keys and the second for the data set values.
You may define the name of the rows used for keys and values by using an array like: array ( ezcGraph::KEY => 'row name', ezcGraph::VALUE => 'row name', );
Parameters
| Name |
Type |
Description |
$statement |
PDOStatement |
|
$definition |
array |
|
fetchByDefinition
void fetchByDefinition(
$statement,
$definition )
Fecth data by provided definition
Use the provided definition with column names to fetch specific columns as key and values. Will throw a ezcGraphDatabaseMissingColumnException, if the column does not exist in the query result.
Parameters
| Name |
Type |
Description |
$statement |
PDOStatement |
|
$definition |
array |
|
fetchNumeric
void fetchNumeric(
$statement )
Fetch numeric
If there is only one column returned by the query use the column as values for the dataset. If there are two columns returned use the first as key and the second as values for teh dataset.
If there are more or less columns returned, a ezcGraphDatabaseTooManyColumnsException is thrown.
Parameters
| Name |
Type |
Description |
$statement |
PDOStatement |
|
Last updated: Mon, 05 Jan 2009