Location: PHPKode > scripts > Nested Set DB Table > tests/1/NestedSetDbTable/DbAdapter/Interface.php
<?php
/**
 * Interface which class that wants to be adapter for the 
 * NestedSetDbTable_Abstract must implement.
 *
 * @author Nikola Posa <hide@address.com>
 * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License
 */
interface NestedSetDbTable_DbAdapter_Interface
{
	/**
	 * Safely quotes a value for an SQL query.
	 *
	 * @param string The value that will be quoted.
	 * @return string
	 */
	public function quote($value);
	
	/**
	 * Prepares and executes an SQL statement. This method should 
	 * return statement object, that has method rowCount(), which 
	 * returns the number of rows affected by the last SQL 
	 * statement. 
	 *
	 * @param string SQL statement that can contain placeholders.
	 * @param array An array of data to bind to the placeholders (optional).
	 * @return mixed
	 */
	public function query($sql, $bind = array());
	
	/**
     * Inserts a row with specified data.
     *
     * @param string Name of the table.
     * @param array Array with data as column-value pairs.
     * @return int The number of affected rows.
     */
	public function insert($tableName, $data);
	
	/**
     * Updates table rows with specified data, optionally based on 
	 * a SQL WHERE clause.
     *
     * @param string Name of the table.
     * @param array Array with data as column-value pairs.
     * @param string|null UPDATE WHERE clause. (optional)
     * @return int The number of affected rows.
     */
	public function update($tableName, $data, $where = null);
	
	/**
     * Deletes table rows based on a WHERE clause.
     *
     * @param string Name of the table.
     * @param string|null DELETE WHERE clause. (optional)
     * @return int The number of affected rows.
     */
	public function delete($tableName, $where = null);
	
	/**
     * Fetches all SQL result rows as a sequential array.
     *
     * @param string An SQL SELECT statement.
     * @return array
     */
	public function fetchAll($sql);
	
	/**
     * Fetches the first row of the SQL result.
     *
     * @param string An SQL SELECT statement.
     * @return array
     */
	public function fetchRow($sql);
}
?>
Return current item: Nested Set DB Table