cvs: pear /Structures_DataGrid/DataGrid/DataSource Common.php
| From: | Olivier Guilyardi | Date: | Wed, 01 Mar 2006 23:30:21 +0000 |
| Subject: | cvs: pear /Structures_DataGrid/DataGrid/DataSource Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38818@lists.php.net to get a copy of this message | ||
olivierg Wed Mar 1 23:30:21 2006 UTC
Modified files:
/pear/Structures_DataGrid/DataGrid/DataSource Common.php
Log:
Fixed prototype methods doc blocks and return values
http://cvs.php.net/viewcvs.cgi/pear/Structures_DataGrid/DataGrid/DataSource/Common.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/DataSource/Common.php
diff -u pear/Structures_DataGrid/DataGrid/DataSource/Common.php:1.3
pear/Structures_DataGrid/DataGrid/DataSource/Common.php:1.4
--- pear/Structures_DataGrid/DataGrid/DataSource/Common.php:1.3 Thu Dec 22 10:02:25 2005
+++ pear/Structures_DataGrid/DataGrid/DataSource/Common.php Wed Mar 1 23:30:21 2006
@@ -17,7 +17,7 @@
// | Andrew Nagy <asnagy@webitecture.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.3 2005/12/22 10:02:25 wiesemann Exp $
+// $Id: Common.php,v 1.4 2006/03/01 23:30:21 olivierg Exp $
/**
@@ -167,81 +167,92 @@
// Begin driver method prototypes DocBook template
/**#@+
+ *
+ * This method is public, but please note that it is not intended to be
+ * called by user-space code. It is meant to be called by the main
+ * Structures_DataGrid class.
*
- * This method is public, but please note that it is not intended to be called by
- * user-space code. It is meant to be called by the main Structures_DataGrid
- * container.
- *
- * It is intended to be overloaded by drivers.
+ * It is an abstract method, part of the DataGrid Datasource driver
+ * interface, and must overloaded by drivers.
*/
/**
* Fetching method prototype
*
- * When overloaded, should either return a PEAR_Error or a <b>reference</b>
- * to an array of the form :
- * array("Columns" => $columns, "Records" => $records)
- * where $columns is an array of Structures_DataGrid_Column objects and
- * $records an assoc array of rows
+ * When overloaded this method must return a 2D array of records
+ * on success or a PEAR_Error object on failure.
*
+ * FIXME: Why is there these $sortField and $sortDir parameters ? This
+ * is redundant with the sort() method.
+ *
+ * @abstract
* @param integer $offset Limit offset (starting from 0)
* @param integer $len Limit length
* @param string $sortField Field to sort by
* @param string $sortDir Sort direction : 'ASC' or 'DESC'
- * @return object PEAR_Error An error with message
- * 'No data source driver loaded'
+ * @return object PEAR_Error with message
+ * "No data source driver loaded"
* @access public
*/
function &fetch($offset=0, $len=null, $sortField=null, $sortDir='ASC')
{
- $err = new PEAR_Error("No data source driver loaded");
- return $err;
+ return new PEAR_Error("No data source driver loaded");
}
/**
* Counting method prototype
*
* Note : must be called before fetch()
- *
- * When overloaded, should either return a numeric value indicating the
- * total number of rows in the data source, or a PEAR_Error object
*
- * @return object PEAR_Error An error with message
- * 'No data source driver loaded'
+ * When overloaded, this method must return the total number or records
+ * or a PEAR_Error object on failure
+ *
+ * @abstract
+ * @return object PEAR_Error with message
+ * "No data source driver loaded"
* @access public
*/
function count()
{
- return PEAR_Error("No data source driver loaded");
+ return new PEAR_Error("No data source driver loaded");
}
/**
* Sorting method prototype
*
+ * When overloaded this method must return true on success or a PEAR_Error
+ * object on failure.
+ *
* Note : must be called before fetch()
*
- * @return object PEAR_Error An error with message
- * 'No data source driver loaded'
+ * @abstract
+ * @param string $sortField Field to sort by
+ * @param string $sortDir Sort direction : 'ASC' or 'DESC'
+ * @return object PEAR_Error with message
+ * "No data source driver loaded"
* @access public
*/
- function sort()
+ function sort($sortField, $sortDir = null)
{
- return PEAR_Error("No data source driver loaded");
+ return new PEAR_Error("No data source driver loaded");
}
/**
* Datasource binding method prototype
*
- * When overloaded, should either return true or a PEAR_Error object
+ * When overloaded this method must return true on success or a PEAR_Error
+ * object on failure.
*
- * @return object PEAR_Error An error with message
- * 'No data source driver loaded'
+ * @abstract
+ * @param mixed $container The datasource container
+ * @param array $options Binding options
+ * @return object PEAR_Error with message
+ * "No data source driver loaded"
* @access public
*/
-
- function bind()
+ function bind($container, $options = array())
{
- return PEAR_Error("No data source driver loaded");
+ return new PEAR_Error("No data source driver loaded");
}
/**#@-*/
@@ -296,4 +307,4 @@
}
}
-?>
\ No newline at end of file
+?>