cvs: peardoc /en/package/database mdb2.xml /en/package/database/mdb2 intro-auto.xml intro-module.xml

From: Date: Sat, 17 Jun 2006 09:09:45 +0000
Subject: cvs: peardoc /en/package/database mdb2.xml /en/package/database/mdb2 intro-auto.xml intro-module.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-8036@lists.php.net to get a copy of this message
lsmith Sat Jun 17 09:09:45 2006 UTC Added files: /peardoc/en/package/database/mdb2 intro-module.xml Modified files: /peardoc/en/package/database/mdb2 intro-auto.xml /peardoc/en/package/database mdb2.xml Log: - added documentation for module handling http://cvs.php.net/viewcvs.cgi/peardoc/en/package/database/mdb2/intro-auto.xml?r1=1.6&r2=1.7&diff_format=u Index: peardoc/en/package/database/mdb2/intro-auto.xml diff -u peardoc/en/package/database/mdb2/intro-auto.xml:1.6 peardoc/en/package/database/mdb2/intro-auto.xml:1.7 --- peardoc/en/package/database/mdb2/intro-auto.xml:1.6 Mon May 8 17:29:57 2006 +++ peardoc/en/package/database/mdb2/intro-auto.xml Sat Jun 17 09:09:45 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="package.database.mdb2.intro-auto"> <refnamediv> @@ -19,7 +19,10 @@ reduce the need to write boring <command>INSERT</command> or <command>UPDATE</command> SQL queries which are difficult to maintain when you - add a field for instance. + add a field for instance. It requires the + <link linkend="package.database.mdb2.intro-module">use</link> of the + <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Extended.html"> + Extended</ulink> module </para> <para> @@ -256,6 +259,14 @@ </refsect2> </refsect1> + + <refsect1 id="package.database.mdb2.intro-auto.see"> + &title.see; + <para> + <link linkend="package.database.mdb2.intro-module"> + <quote>Intro - Modules</quote></link> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewcvs.cgi/peardoc/en/package/database/mdb2.xml?r1=1.8&r2=1.9&diff_format=u Index: peardoc/en/package/database/mdb2.xml diff -u peardoc/en/package/database/mdb2.xml:1.8 peardoc/en/package/database/mdb2.xml:1.9 --- peardoc/en/package/database/mdb2.xml:1.8 Mon May 8 20:34:55 2006 +++ peardoc/en/package/database/mdb2.xml Sat Jun 17 09:09:45 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <sect1 id="package.database.mdb2"> <title>MDB2</title> <para> @@ -11,6 +11,7 @@ &package.database.mdb2.intro-query; &package.database.mdb2.intro-fetch; &package.database.mdb2.intro-execute; + &package.database.mdb2.intro-module; &package.database.mdb2.intro-auto; &package.database.mdb2.intro-portability; &package.database.mdb2.intro-sequences; http://cvs.php.net/viewcvs.cgi/peardoc/en/package/database/mdb2/intro-module.xml?view=markup&rev=1.1 Index: peardoc/en/package/database/mdb2/intro-module.xml +++ peardoc/en/package/database/mdb2/intro-module.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- add information on the following methods: factory(), singleton() --> <refentry id="package.database.mdb2.intro-module"> <refnamediv> <refname>Introduction - Modules</refname> <refpurpose>Loading and calling modules</refpurpose> </refnamediv> <refsect1 id="package.database.mdb2.intro-module.desc"> &title.desc; <para> MDB2 follows a modular concept to provide functionality beyond the basic ability to send queries to the database and fetch result sets. Currently the following modules are available: <itemizedlist> <listitem> <simpara> <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Datatype_Common.html"> Datatype</ulink> module - handles datatype abstraction </simpara> </listitem> <listitem> <simpara> <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Extended.html"> Extended</ulink> module - provides numerous high-level methods </simpara> </listitem> <listitem> <simpara> <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Function_Common.html"> Function</ulink> module - handles SQL function abstraction </simpara> </listitem> <listitem> <simpara> <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Manager_Common.html"> Manager</ulink> module - handles data definition language (DDL) abstraction and schema listing </simpara> </listitem> <listitem> <simpara> <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Native_Common.html"> Native</ulink> module - handles RDBMS specific functions </simpara> </listitem> <listitem> <simpara> <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Reverse_Common.html"> Reverse</ulink> module - handles schema reverse engineering abstraction </simpara> </listitem> </itemizedlist> </para> <simpara> A module is loaded using the <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html#methodloadModule"> <function>loadModule</function></ulink> method. This method returns the module instance, but also stores the instance in a property. The name of the property is either the lowercased name of the module passed in as the first parameter, or optionally the non null value of the second parameter. The method can also be used to load custom modules that are installed. </simpara> <example> <title>Loading a module</title> <programlisting role="php"> <![CDATA[ <?php require_once 'MDB2.php'; $dsn = 'pgsql://someuser:apasswd@localhost/thedb'; $options = array( 'debug' => 2, 'result_buffering' => false, ); $mdb2 =& MDB2::connect($dsn, $options); if (PEAR::isError($mdb2)) { die($mdb2->getMessage()); } // ... $mdb2->loadModule('Manager'); ?> ]]> </programlisting> </example> <example> <title>Loading a custom module</title> <programlisting role="php"> <![CDATA[ <?php / ... // file must reside be [peardir]/MDB2/MyModule.php $mdb2->loadModule('MyModule', 'someproperty', false); // file must reside be [peardir]/MDB2/Driver/MyRDBMSModule/[phptype].php $mdb2->loadModule('MyRDBMSModule', 'someotherproperty', true); ?> ]]> </example> <example> <title>Using a loaded module</title> <programlisting role="php"> <![CDATA[ <?php / ... $mdb2->loadModule('Manager'); $tables = $mdb2->manager->listTables(); ?> ]]> </example> <simpara> On PHP5 users can also rely on overloading to load and call modules. </simpara> <example> <title>Using the 'modules' option with PHP5 overloading</title> <programlisting role="php"> <![CDATA[ <?php require_once 'MDB2.php'; $dsn = 'pgsql://someuser:apasswd@localhost/thedb'; $options = array( 'debug' => 2, 'result_buffering' => false, ); $mdb2 =& MDB2::connect($dsn, $options); if (PEAR::isError($mdb2)) { die($mdb2->getMessage()); } // ... $module_shorthands = $mdb2->getOptions('modules'); // use the shorthand key for the given module as a prefix for the method name // where the first letter of the original method name is uppercased $tables = $mdb2->mgListTables(); ?> ]]> </programlisting> </example> <example> <title>Calling a method on a loaded module with PHP5 overloading</title> <programlisting role="php"> <![CDATA[ <?php require_once 'MDB2.php'; $dsn = 'pgsql://someuser:apasswd@localhost/thedb'; $options = array( 'debug' => 2, 'result_buffering' => false, ); $mdb2 =& MDB2::connect($dsn, $options); if (PEAR::isError($mdb2)) { die($mdb2->getMessage()); } // ... $mdb2->loadModule('Manager'); // since the manager module is already loaded we can all the listTable() method $tables = $mdb2->listTables(); ?> ]]> </programlisting> </example> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->

« previous php.pear.doc (#8036) next »