summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-05-03 07:38:25 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-05-03 07:38:25 +0000
commit060e4cc112feeedeaf76f1c71fe221a45e8c3246 (patch)
tree051a06faf0b019666e3c5210f63ff5af407d49cc /src
parent45dc0d77c5585a51bb04ef21bdc83792ef0d622a (diff)
downloadzetacomponents-graph-060e4cc112feeedeaf76f1c71fe221a45e8c3246.zip
zetacomponents-graph-060e4cc112feeedeaf76f1c71fe221a45e8c3246.tar.gz
- Removed PdoDataset from Graph components
# Preparation for issue #10697: Move ezcGraphPdoDataSet to a # ezcGraphDatabaseTieIn
Diffstat (limited to 'src')
-rw-r--r--src/datasets/pdo.php138
-rw-r--r--src/element/axis.php2
-rw-r--r--src/exceptions/missing_column.php24
-rw-r--r--src/exceptions/statement_not_executed.php24
-rw-r--r--src/exceptions/too_many_columns.php26
-rw-r--r--src/graph_autoload.php4
6 files changed, 1 insertions, 217 deletions
diff --git a/src/datasets/pdo.php b/src/datasets/pdo.php
deleted file mode 100644
index 0da65bd..0000000
--- a/src/datasets/pdo.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/**
- * File containing the ezcGraphPdoDataSet class
- *
- * @package Graph
- * @version //autogentag//
- * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
- * @license http://ez.no/licenses/new_bsd New BSD License
- */
-/**
- * Class to transform PDO results into ezcGraphDataSets
- *
- * @package Graph
- * @mainclass
- */
-class ezcGraphPdoDataSet extends ezcGraphDataSet
-{
- /**
- * Constructor
- *
- * Creates a ezcGraphPdoDataSet 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',
- * );
- *
- * @param PDOStatement $statement
- * @param array $definition
- * @return ezcGraphPdoDataSet
- */
- public function __construct( PDOStatement $statement, array $definition = null )
- {
- parent::__construct();
-
- $this->data = array();
- $this->createFromPdo( $statement, $definition );
- }
-
- /**
- * 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',
- * );
- *
- * @param PDOStatement $statement
- * @param array $definition
- * @return void
- */
- protected function createFromPdo( PDOStatement $statement, array $definition = null )
- {
- $count = 0;
-
- if ( $definition === null )
- {
- while ( $row = $statement->fetch( PDO::FETCH_NUM ) )
- {
- ++$count;
-
- switch ( count( $row ) )
- {
- case 1:
- $this->data[] = $row[0];
- break;
- case 2:
- $this->data[$row[0]] = $row[1];
- break;
- default:
- throw new ezcGraphPdoDataSetTooManyColumnsException( $row );
- }
- }
- }
- else
- {
- while ( $row = $statement->fetch( PDO::FETCH_NAMED ) )
- {
- ++$count;
-
- if ( !array_key_exists( $definition[ezcGraph::VALUE], $row ) )
- {
- throw new ezcGraphPdoDataSetMissingColumnException( $definition[ezcGraph::VALUE] );
- }
-
- $value = $row[$definition[ezcGraph::VALUE]];
-
- if ( array_key_exists( ezcGraph::KEY, $definition ) )
- {
- if ( !array_key_exists( $definition[ezcGraph::KEY], $row ) )
- {
- throw new ezcGraphPdoDataSetMissingColumnException( $definition[ezcGraph::KEY] );
- }
-
- $this->data[$row[$definition[ezcGraph::KEY]]] = $value;
- }
- else
- {
- $this->data[] = $value;
- }
- }
- }
-
- // Empty result set
- if ( $count <= 0 )
- {
- throw new ezcGraphPdoDataSetStatementNotExecutedException( $statement );
- }
- }
-
- /**
- * Returns the number of elements in this dataset
- *
- * @return int
- */
- public function count()
- {
- return count( $this->data );
- }
-}
-
-?>
diff --git a/src/element/axis.php b/src/element/axis.php
index d14431d..0362481 100644
--- a/src/element/axis.php
+++ b/src/element/axis.php
@@ -38,7 +38,7 @@
* @property ezcGraphAxisLabelRenderer $axisLabelRenderer
* AxisLabelRenderer used to render labels and grid on this axis.
* @property callback $labelCallback
- * Callback function to format pie chart labels.
+ * Callback function to format chart labels.
* Function will receive two parameters and should return a
* reformatted label.
* string function( label, step )
diff --git a/src/exceptions/missing_column.php b/src/exceptions/missing_column.php
deleted file mode 100644
index 11c8bdc..0000000
--- a/src/exceptions/missing_column.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/**
- * File containing the ezcGraphPdoDataSetMissingColumnException class
- *
- * @package Graph
- * @version //autogen//
- * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
- * @license http://ez.no/licenses/new_bsd New BSD License
- */
-/**
- * Exception thrown if a requetsted column could not be found in result set
- *
- * @package Graph
- * @version //autogen//
- */
-class ezcGraphPdoDataSetMissingColumnException extends ezcGraphException
-{
- public function __construct( $column )
- {
- parent::__construct( "Missing column '{$column}' in result set." );
- }
-}
-
-?>
diff --git a/src/exceptions/statement_not_executed.php b/src/exceptions/statement_not_executed.php
deleted file mode 100644
index 2cbba5f..0000000
--- a/src/exceptions/statement_not_executed.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/**
- * File containing the ezcGraphPdoDataSetStatementNotExecutedException class
- *
- * @package Graph
- * @version //autogen//
- * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
- * @license http://ez.no/licenses/new_bsd New BSD License
- */
-/**
- * Exception thrown if a given statement has not been executed.
- *
- * @package Graph
- * @version //autogen//
- */
-class ezcGraphPdoDataSetStatementNotExecutedException extends ezcGraphException
-{
- public function __construct( $statement )
- {
- parent::__construct( "Empty result set. Execute the statement before using with ezcGraphPdoDataSet." );
- }
-}
-
-?>
diff --git a/src/exceptions/too_many_columns.php b/src/exceptions/too_many_columns.php
deleted file mode 100644
index 3aa5b8d..0000000
--- a/src/exceptions/too_many_columns.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * File containing the ezcGraphPdoDataSetTooManyColumnsException class
- *
- * @package Graph
- * @version //autogen//
- * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
- * @license http://ez.no/licenses/new_bsd New BSD License
- */
-/**
- * Exception thrown if a data set has too many columns for a key value
- * association.
- *
- * @package Graph
- * @version //autogen//
- */
-class ezcGraphPdoDataSetTooManyColumnsException extends ezcGraphException
-{
- public function __construct( $row )
- {
- $columnCount = count( $row );
- parent::__construct( "'{$columnCount}' columns are too many in a result." );
- }
-}
-
-?>
diff --git a/src/graph_autoload.php b/src/graph_autoload.php
index afe18c7..66c9e78 100644
--- a/src/graph_autoload.php
+++ b/src/graph_autoload.php
@@ -95,10 +95,6 @@ return array(
'ezcGraphDataSet' => 'Graph/datasets/base.php',
'ezcGraphArrayDataSet' => 'Graph/datasets/array.php',
'ezcGraphInvalidArrayDataSourceException' => 'Graph/exceptions/invalid_data_source.php',
- 'ezcGraphPdoDataSet' => 'Graph/datasets/pdo.php',
- 'ezcGraphPdoDataSetTooManyColumnsException' => 'Graph/exceptions/too_many_columns.php',
- 'ezcGraphPdoDataSetMissingColumnException' => 'Graph/exceptions/missing_column.php',
- 'ezcGraphPdoDataSetStatementNotExecutedException' => 'Graph/exceptions/statement_not_executed.php',
'ezcGraphNumericDataSet' => 'Graph/datasets/numeric.php',
'ezcGraphDataSetAveragePolynom' => 'Graph/datasets/average.php',
'ezcGraphDatasetAverageInvalidKeysException' => 'Graph/exceptions/invalid_keys.php',
OpenPOWER on IntegriCloud