cvs: pear /MDB/doc Modules_Datatype_skeleton.php Modules_Manager_skeleton.php Modules_Native_skeleton.php Modules_Reverse_skeleton.php

From: Date: Wed, 24 Sep 2003 09:32:32 +0000
Subject: cvs: pear /MDB/doc Modules_Datatype_skeleton.php Modules_Manager_skeleton.php Modules_Native_skeleton.php Modules_Reverse_skeleton.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-13034@lists.php.net to get a copy of this message
lsmith Wed Sep 24 05:32:32 2003 EDT Added files: /pear/MDB/doc Modules_Native_skeleton.php Modules_Reverse_skeleton.php Modified files: /pear/MDB/doc Modules_Datatype_skeleton.php Modules_Manager_skeleton.php Log: updated skeletons

Index: pear/MDB/doc/Modules_Datatype_skeleton.php diff -u pear/MDB/doc/Modules_Datatype_skeleton.php:1.1 pear/MDB/doc/Modules_Datatype_skeleton.php:1.2 --- pear/MDB/doc/Modules_Datatype_skeleton.php:1.1 Thu Jul 24 06:51:03 2003 +++ pear/MDB/doc/Modules_Datatype_skeleton.php Wed Sep 24 05:32:31 2003 @@ -42,7 +42,7 @@ // | Author: YOUR NAME <YOUR EMAIL> | // +----------------------------------------------------------------------+ // -// $Id: Modules_Datatype_skeleton.php,v 1.1 2003/07/24 10:51:03 lsmith Exp $ +// $Id: Modules_Datatype_skeleton.php,v 1.2 2003/09/24 09:32:31 lsmith Exp $ // // This is just a skeleton MDB driver. @@ -71,6 +71,16 @@ */ class MDB_Datatype_xxx extends MDB_Datatype_Common { + // }}} + // {{{ constructor + + /** + * Constructor + */ + function MDB_Datatype_xxx($db_index) + { + $this->MDB_Datatype_Common($db_index); + } // }}} // {{{ convertResult() @@ -85,6 +95,7 @@ */ function convertResult($value, $type) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: ConvertResult() } @@ -95,6 +106,7 @@ function get*Declaration($name, $field) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: Get*FieldValue() } @@ -114,6 +126,7 @@ */ function get*Value($prepared_query, $parameter, $clob) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: Get*FieldValue() } @@ -133,6 +146,7 @@ */ function getClobValue($prepared_query, $parameter, $clob) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: GetCLOBFieldValue() } @@ -150,6 +164,7 @@ */ function freeClobValue($prepared_query, $clob, &$value) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: FreeClobValue() } @@ -169,6 +184,7 @@ */ function getBlobValue($prepared_query, $parameter, $blob) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: GetBLOBFieldValue() } @@ -185,6 +201,7 @@ */ function freeBlobValue($prepared_query, $blob) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: FreeBlobValue() } } Index: pear/MDB/doc/Modules_Manager_skeleton.php diff -u pear/MDB/doc/Modules_Manager_skeleton.php:1.6 pear/MDB/doc/Modules_Manager_skeleton.php:1.7 --- pear/MDB/doc/Modules_Manager_skeleton.php:1.6 Thu Jul 24 06:50:15 2003 +++ pear/MDB/doc/Modules_Manager_skeleton.php Wed Sep 24 05:32:31 2003 @@ -42,7 +42,7 @@ // | Author: YOUR NAME <YOUR EMAIL> | // +----------------------------------------------------------------------+ // -// $Id: Modules_Manager_skeleton.php,v 1.6 2003/07/24 10:50:15 lsmith Exp $ +// $Id: Modules_Manager_skeleton.php,v 1.7 2003/09/24 09:32:31 lsmith Exp $ // // This is just a skeleton MDB driver. @@ -69,21 +69,32 @@ * @category Database * @author YOUR NAME <YOUR EMAIL> */ -class MDB_Manager_xxx_ extends MDB_Manager_Common +class MDB_Manager_xxx extends MDB_Manager_Common { // }}} + // {{{ constructor + + /** + * Constructor + */ + function MDB_Datatype_xxx($db_index) + { + $this->MDB_Manager_Common($db_index); + } + + // }}} // {{{ createDatabase() /** * create a new database * - * @param object $dbs database object that is extended by this class * @param string $name name of the database that should be created * @return mixed MDB_OK on success, a MDB error on failure * @access public */ - function createDatabase(&$db, $name) + function createDatabase($name) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: CreateDatabase() } @@ -93,13 +104,13 @@ /** * drop an existing database * - * @param object $dbs database object that is extended by this class * @param string $name name of the database that should be dropped * @return mixed MDB_OK on success, a MDB error on failure * @access public */ - function dropDatabase(&$db, $name) + function dropDatabase($name) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: DropDatabase() } @@ -109,7 +120,6 @@ /** * create a new table * - * @param object $dbs database object that is extended by this class * @param string $name Name of the database that should be created * @param array $fields Associative array that contains the definition of each field of the new table * The indexes of the array entries are the names of the fields of the table an @@ -137,8 +147,9 @@ * @return mixed MDB_OK on success, a MDB error on failure * @access public */ - function createTable(&$db, $name, $fields) + function createTable($name, $fields) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: CreateTable() } @@ -148,7 +159,6 @@ /** * alter an existing table * - * @param object $dbs database object that is extended by this class * @param string $name name of the table that is intended to be changed. * @param array $changes associative array that contains the details of each type * of change that is intended to be performed. The types of @@ -242,8 +252,9 @@ * * @return mixed MDB_OK on success, a MDB error on failure */ - function alterTable(&$db, $name, $changes, $check) + function alterTable($name, $changes, $check) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: AlterTable() } @@ -253,12 +264,12 @@ /** * list all databases * - * @param object $dbs database object that is extended by this class * @return mixed data array on success, a MDB error on failure * @access public */ - function listDatabases(&$db) + function listDatabases() { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } @@ -268,12 +279,12 @@ /** * list all users * - * @param object $dbs database object that is extended by this class * @return mixed data array on success, a MDB error on failure * @access public */ - function listUsers(&$db) + function listUsers() { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } @@ -283,12 +294,12 @@ /** * list all tables in the current database * - * @param object $dbs database object that is extended by this class * @return mixed data array on success, a MDB error on failure * @access public */ - function listTables(&$db) + function listTables() { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } @@ -298,30 +309,13 @@ /** * list all fields in a tables in the current database * - * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @return mixed data array on success, a MDB error on failure * @access public */ - function listTableFields(&$db, $table) - { - // new in MDB - } - - // }}} - // {{{ getTableFieldDefinition() - - /** - * get the stucture of a field into an array - * - * @param object $dbs database object that is extended by this class - * @param string $table name of table that should be used in method - * @param string $field_name name of field that should be used in method - * @return mixed data array on success, a MDB error on failure - * @access public - */ - function getTableFieldDefinition(&$db, $table, $field_name) + function listTableFields($table) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } @@ -331,7 +325,6 @@ /** * get the stucture of a field into an array * - * @param object $dbs database object that is extended by this class * @param string $table name of the table on which the index is to be created * @param string $name name of the index to be created * @param array $definition associative array that defines properties of the index to be created. @@ -361,8 +354,9 @@ * @return mixed MDB_OK on success, a MDB error on failure * @access public */ - function createIndex(&$db, $table, $name, $definition) + function createIndex($table, $name, $definition) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: CreateIndex() } @@ -372,14 +366,14 @@ /** * drop existing index * - * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed MDB_OK on success, a MDB error on failure * @access public */ - function dropIndex(&$db, $table, $name) + function dropIndex($table, $name) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: DropIndex() } @@ -389,32 +383,16 @@ /** * list all indexes in a table * - * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @return mixed data array on success, a MDB error on failure * @access public */ - function listTableIndexes(&$db, $table) + function listTableIndexes($table) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } - // }}} - // {{{ getTableIndexDefinition() - - /** - * get the stucture of an index into an array - * - * @param object $dbs database object that is extended by this class - * @param string $table name of table that should be used in method - * @param string $index_name name of index that should be used in method - * @return mixed data array on success, a MDB error on failure - * @access public - */ - function getTableIndexDefinition(&$db, $table, $index_name) - { - // new in MDB - } // }}} // {{{ createSequence() @@ -422,14 +400,14 @@ /** * create sequence * - * @param object $dbs database object that is extended by this class * @param string $seq_name name of the sequence to be created * @param string $start start value of the sequence; default is 1 * @return mixed MDB_OK on success, a MDB error on failure * @access public */ - function createSequence(&$db, $seq_name, $start) + function createSequence($seq_name, $start) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: CreateSequence() } @@ -439,13 +417,13 @@ /** * drop existing sequence * - * @param object $dbs database object that is extended by this class * @param string $seq_name name of the sequence to be dropped * @return mixed MDB_OK on success, a MDB error on failure * @access public */ - function dropSequence(&$db, $seq_name) + function dropSequence($seq_name) { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // take this from the corresponding Metabase driver: DropSequence() } @@ -455,28 +433,12 @@ /** * list all sequences in the current database * - * @param object $dbs database object that is extended by this class - * @return mixed data array on success, a MDB error on failure - * @access public - */ - function listSequences(&$db) - { - // new in MDB - } - - // }}} - // {{{ getSequenceDefinition() - - /** - * get the stucture of a sequence into an array - * - * @param object $dbs database object that is extended by this class - * @param string $sequence name of sequence that should be used in method * @return mixed data array on success, a MDB error on failure * @access public */ - function getSequenceDefinition(&$db, $sequence) + function listSequences() { + $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } } Index: pear/MDB/doc/Modules_Native_skeleton.php +++ pear/MDB/doc/Modules_Native_skeleton.php <?php // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1998-2002 Manuel Lemos, Tomas V.V.Cox, | // | Stig. S. Bakken, Lukas Smith, Frank M. Kromann | // | All rights reserved. | // +----------------------------------------------------------------------+ // | MDB is a merge of PEAR DB and Metabases that provides a unified DB | // | API as well as database abstraction for PHP applications. | // | This LICENSE is in the BSD license style. | // | | // | Redistribution and use in source and binary forms, with or without | // | modification, are permitted provided that the following conditions | // | are met: | // | | // | Redistributions of source code must retain the above copyright | // | notice, this list of conditions and the following disclaimer. | // | | // | Redistributions in binary form must reproduce the above copyright | // | notice, this list of conditions and the following disclaimer in the | // | documentation and/or other materials provided with the distribution. | // | | // | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, | // | Lukas Smith nor the names of his contributors may be used to endorse | // | or promote products derived from this software without specific prior| // | written permission. | // | | // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | // | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | // | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | // | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | // | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS| // | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | // | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | // | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY| // | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | // | POSSIBILITY OF SUCH DAMAGE. | // +----------------------------------------------------------------------+ // | Author: YOUR NAME <YOUR EMAIL> | // +----------------------------------------------------------------------+ // // $Id: Modules_Native_skeleton.php,v 1.1 2003/09/24 09:32:31 lsmith Exp $ // /** * MDB Xxx driver for the native module * * @package MDB * @category Database * @author YOUR NAME <YOUR EMAIL> */ class MDB_Native_xxx extends MDB_Native_Common { var $db_index; // }}} // {{{ constructor /** * Constructor */ function MDB_Native_xxx($db_index) { $this->db_index = $db_index; } } ?> Index: pear/MDB/doc/Modules_Reverse_skeleton.php +++ pear/MDB/doc/Modules_Reverse_skeleton.php <?php // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1998-2002 Manuel Lemos, Tomas V.V.Cox, | // | Stig. S. Bakken, Lukas Smith | // | All rights reserved. | // +----------------------------------------------------------------------+ // | MDB is a merge of PEAR DB and Metabases that provides a unified DB | // | API as well as database abstraction for PHP applications. | // | This LICENSE is in the BSD license style. | // | | // | Redistribution and use in source and binary forms, with or without | // | modification, are permitted provided that the following conditions | // | are met: | // | | // | Redistributions of source code must retain the above copyright | // | notice, this list of conditions and the following disclaimer. | // | | // | Redistributions in binary form must reproduce the above copyright | // | notice, this list of conditions and the following disclaimer in the | // | documentation and/or other materials provided with the distribution. | // | | // | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, | // | Lukas Smith nor the names of his contributors may be used to endorse | // | or promote products derived from this software without specific prior| // | written permission. | // | | // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | // | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | // | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | // | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | // | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS| // | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | // | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | // | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY| // | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | // | POSSIBILITY OF SUCH DAMAGE. | // +----------------------------------------------------------------------+ // | Author: YOUR NAME <YOUR EMAIL> | // +----------------------------------------------------------------------+ // // $Id: Modules_Reverse_skeleton.php,v 1.1 2003/09/24 09:32:31 lsmith Exp $ // // This is just a skeleton MDB driver. // In each of the listed methods I have added comments that tell you where // to look for a "reference" implementation. // Many of the methods below are taken from Metabase. Most of the methods // marked as "new in MDB" are actually taken from the latest beta files of // Metabase. However these beta files only include a version for MySQL. // Some of these methods have been expanded or changed slightly in MDB. // Looking in the relevant MDB Wrapper should give you some pointers, some // other difference you will only discover by looking at one of the existing // MDB driver or the common implementation in common.php. // One thing that will definately have to be modified in all "reference" // implementations of Metabase methods is the error handling. // Anyways don't worry if you are having problems: Lukas Smith is here to help! require_once 'MDB/Modules/Reverse/Common.php'; /** * MDB Xxx driver for the management modules * * @package MDB * @category Database * @author YOUR NAME <YOUR EMAIL> */ class MDB_Reverse_xxx extends MDB_Reverse_Common { // }}} // {{{ constructor /** * Constructor */ function MDB_Reverse_xxx($db_index) { $this->MDB_Reverse_Common($db_index); } // }}} // {{{ getTableFieldDefinition() /** * get the stucture of a field into an array * * @param string $table name of table that should be used in method * @param string $field_name name of field that should be used in method * @return mixed data array on success, a MDB error on failure * @access public */ function getTableFieldDefinition($table, $field_name) { $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } // }}} // {{{ getTableIndexDefinition() /** * get the stucture of an index into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a MDB error on failure * @access public */ function getTableIndexDefinition($table, $index_name) { $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } // }}} // {{{ getSequenceDefinition() /** * get the stucture of a sequence into an array * * @param string $sequence name of sequence that should be used in method * @return mixed data array on success, a MDB error on failure * @access public */ function getSequenceDefinition($sequence) { $db =& $GLOBALS['_MDB_databases'][$this->db_index]; // new in MDB } } ?>
« previous php.pear.cvs (#13034) next »