cvs: peardoc /en/package/database/db-table intro-database.xml

From: Date: Sun, 01 Jul 2007 03:40:42 +0000
Subject: cvs: peardoc /en/package/database/db-table intro-database.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-9857@lists.php.net to get a copy of this message
morse Sun Jul 1 03:40:42 2007 UTC Modified files: /peardoc/en/package/database/db-table intro-database.xml Log: Added newlines around function synopses, within CDATA blocks.

http://cvs.php.net/viewvc.cgi/peardoc/en/package/database/db-table/intro-database.xml?r1=1.5&r2=1.6&diff_format=u Index: peardoc/en/package/database/db-table/intro-database.xml diff -u peardoc/en/package/database/db-table/intro-database.xml:1.5 peardoc/en/package/database/db-table/intro-database.xml:1.6 --- peardoc/en/package/database/db-table/intro-database.xml:1.5 Sun Jul 1 03:15:20 2007 +++ peardoc/en/package/database/db-table/intro-database.xml Sun Jul 1 03:40:42 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="package.database.db-table.intro-database"> <refnamediv> @@ -342,7 +342,8 @@ The following code defines a subclass <classname>Person_Table</classname> that represents a database table Person: <programlisting role="php"> -<![CDATA[<?php +<![CDATA[ +<?php require_once 'DB/Table.php' class Person_Table extends DB_Table @@ -523,7 +524,11 @@ empty shell, to which tables, foreign key references, and links are then added. The constructor interface is <programlisting> -<![CDATA[void DB_Table_Database(DB/MDB2 object $conn, string $name)]]> +<![CDATA[ + +void DB_Table_Database(DB/MDB2 object $conn, string $name) + +]]> </programlisting> The parameter $conn must be either a DB or MDB2 object, which establishes a connection to a RDBMS. The $name parameter is the name of the @@ -563,7 +568,9 @@ for this method is <programlisting> <![CDATA[ + true|PEAR_Error addTable(object &$Table) + ]]> </programlisting> where $Table is a <classname>DB_Table</classname> object that is passed @@ -597,7 +604,10 @@ Synopsis (simplified): <programlisting> <![CDATA[ -true|PEAR_Error addRef(string $ftable, string|array $fkey, string $rtable, [string|array $rkey] ) + +true|PEAR_Error addRef(string $ftable, string|array $fkey, + string $rtable, [string|array $rkey] ) + ]]> </programlisting> Here $ftable is the name of a referencing (or foreign key) table, $fkey @@ -660,7 +670,9 @@ Synopsis: <programlisting> <![CDATA[ + true|PEAR_Error addLink(string $table1, string $table2, string $link) + ]]> </programlisting> Here, $link is the name of a linking table that links tables named @@ -824,7 +836,11 @@ <para> Synopsis: <programlisting> -<![CDATA[void deleteTable(string $table)]]> +<![CDATA[ + +void deleteTable(string $table) + +]]> </programlisting> Parameter $table is the name of the table to be deleted. Deletion of a table causes deletion of the table and all other entities of @@ -840,7 +856,11 @@ <para> Synopsis: <programlisting> -<![CDATA[void deleteRef(string $ftable, string $rtable)]]> +<![CDATA[ + +void deleteRef(string $ftable, string $rtable) + +]]> </programlisting> where $ftable and $rtable are the names of the referencing and referenced tables, respectively. Deletion of a foreign key reference @@ -854,7 +874,11 @@ <para> Synopsis: <programlisting> -<![CDATA[void deleteLink(string $table1, string $table2, [string $link])]]> +<![CDATA[ + +void deleteLink(string $table1, string $table2, [string $link]) + +]]> </programlisting> Here $table1 and $table2 are names of the linked tables, and the optional parameter $link is the name of the linking table. If $link @@ -929,7 +953,10 @@ The full interface of the <function>addRef</function> method is: <programlisting> <![CDATA[ -true|PEAR_Error addRef(string $ftable, mixed $fkey, string $rtable, [mixed $rkey], [string|null $on_delete], [string|null $on_update]) + +true|PEAR_Error addRef(string $ftable, mixed $fkey, string $rtable, [mixed $rkey], + [string|null $on_delete], [string|null $on_update]) + ]]> </programlisting> Here, $ftable is the referencing table, $fkey is the foreign key, $rtable @@ -984,8 +1011,10 @@ Synopses: <programlisting> <![CDATA[ + void setOnDelete(string $ftable, string $rtable, string|null $action) void setOnUpdate(string $ftable, string $rtable, string|null $action) + ]]> </programlisting> Here, $ftable and $rtable are the names of referencing (foreign key) @@ -1023,8 +1052,10 @@ Synopses: <programlisting> <![CDATA[ + void setActOnDelete(bool $flag) void setActOnUpdate(bool $flag) + ]]> </programlisting> Passing a true value to either method activates PHP emulation of all @@ -1059,7 +1090,11 @@ or off, for insertion or updating of any table in database, with the <function>setCheckFKey</function> method. The interface of this method is: <programlisting> -<![CDATA[void setCheckFKey(bool $flag);]]> +<![CDATA[ + +void setCheckFKey(bool $flag) + +]]> </programlisting> Passing a true value of $flag turns on checking of foreign keys (the default), while a false value turns checking off. @@ -1083,7 +1118,8 @@ For example, a query for names of all people that live on Oak Street in Anytown in our example database might be <programlisting> -<![CDATA[<?php +<![CDATA[ +<?php $oak = array( 'select' => 'Person.FirstName, Person.LastName, Address.Building', 'from' => 'Person, Address', @@ -1098,7 +1134,8 @@ <function>buildSQL</function></link> method accepts such a query array as a parameter and returns the corresponding SQL command string. For example <programlisting role="php"> -<![CDATA[<?php +<![CDATA[ +<?php echo $db->buildSQL($oak); ?>]]> </programlisting> @@ -1119,7 +1156,8 @@ As in <classname>DB_Table</classname>, such query arrays can be stored in the public $sql property array: <programlisting role="php"> -<![CDATA[<?php +<![CDATA[ +<?php $db->sql['oak'] = $oak ?>]]> </programlisting> @@ -1166,7 +1204,10 @@ <function>selectResult</function> is: <programlisting> <![CDATA[ -mixed select*( array|string $sql_key, [string $filter], [string $order], [int $start], [int $count], [array $params]) + +mixed select*( array|string $sql_key, [string $filter], [string $order], + [int $start], [int $count], [array $params]) + ]]> </programlisting> As discussed above, $sql_key is either a query array, or the key of @@ -1196,7 +1237,9 @@ Synopsis: <programlisting role="php"> <![CDATA[ + array|PEAR_Error autoJoin([array $cols], [array $tables], [string $filter]) + ]]> </programlisting> Here, $cols is a sequential array of the names of the desired columns, @@ -1337,7 +1380,9 @@ Synposis: <programlisting> <![CDATA[ + string quote(mixed $value) + ]]> </programlisting> The <function>DB_Table_Database::quote</function> method calls either the @@ -1399,7 +1444,10 @@ methods: <programlisting> <![CDATA[ -string|PEAR_Error buildSQL(array|string $query, [string $filter], [string $order], [int $start], [int $count]) + +string|PEAR_Error buildSQL(array|string $query, [string $filter], [string $order], + [int $start], [int $count]) + ]]> </programlisting> As in the <function>select*</function> methods, $query is a query array or a key @@ -1420,7 +1468,11 @@ <para> Synopsis: <programlisting> -<![CDATA[array|PEAR_Error validCol(string $col, [array $from])]]> +<![CDATA[ + +array|PEAR_Error validCol(string $col, [array $from]) + +]]> </programlisting> The required parameter $col is a column name. The optional $from parameter is a sequential array of table names. @@ -1475,9 +1527,11 @@ Synopses: <programlisting> <![CDATA[ + true|PEAR_Error insert(string $table, array $data) true|PEAR_Error delete(string $table, [string $where]) true|PEAR_Error update(string $table, array $data, [string $where]) + ]]> </programlisting> In all three functions $table_name is the name of the table to which @@ -1597,7 +1651,11 @@ </para> <para> Synopsis: <programlisting> -<![CDATA[void setTableSubclassPath(string $path)]]> +<![CDATA[ + +void setTableSubclassPath(string $path) + +]]> </programlisting> Parameter $path is the path to the desired directory, without a trailing directory separator. The path must be specified in @@ -1626,9 +1684,11 @@ entire database, including all of its tables and foreign key references, like so: <programlisting role="php"> -<![CDATA[<?php +<![CDATA[ +<?php $xml_string = $db->toXML(); -?>]]> +?> +]]> </programlisting> The <function>DB_Table_Database::fromXML</function> method is a static method that takes an MDB2 XML database schema string as its only parameter and returns @@ -1667,10 +1727,12 @@ corresponding <classname>DB_Table</classname> methods, are: <programlisting> <![CDATA[ + void autoValidInsert(bool $flag); void autoValidUpdate(bool $flag); void autoRecast(bool $flag); void autoInc(bool $flag); + ]]> </programlisting> Each has a boolean argument that turns on (true) or off (false) one
« previous php.pear.doc (#9857) next »