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

From: Date: Tue, 11 Nov 2003 13:04:07 +0000
Subject: cvs: peardoc /en/package/database/db intro-auto.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-1940@lists.php.net to get a copy of this message
alan_k Tue Nov 11 08:04:07 2003 EDT Modified files: /peardoc/en/package/database/db intro-auto.xml Log: remove utf8 characters Index: peardoc/en/package/database/db/intro-auto.xml diff -u peardoc/en/package/database/db/intro-auto.xml:1.6 peardoc/en/package/database/db/intro-auto.xml:1.7 --- peardoc/en/package/database/db/intro-auto.xml:1.6 Tue Jun 17 07:10:34 2003 +++ peardoc/en/package/database/db/intro-auto.xml Tue Nov 11 08:04:07 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="package.database.db.intro-auto"> <refnamediv> <refname>Introduction - autoPrepare and autoExecute</refname> @@ -16,12 +16,12 @@ are facilities. With them, you don't have to write anymore these boring (insert or update) sql queries which are difficult to maintain when you add a field for instance. -   </para> + </para> <para> Imagine you have an 'user' table with 3 fields (id, name and country). You have to write sql queries like : <programlisting> -  <![CDATA[ + <![CDATA[ INSERT INTO table (id, name, country) VALUES (?, ?, ?) UPDATE table SET id=?, name=?, country=? WHERE ... ]]> @@ -38,7 +38,7 @@ <function>autoPrepare</function></link>, you don't have to write your insert or update queries. For example : <programlisting role="php"> -  <![CDATA[ + <![CDATA[ (...) // $dbh is an DB object $table_fields = array('id', 'name', 'country'); $table_name = 'user'; @@ -48,7 +48,7 @@ In this example, <link linkend="package.database.db.db-common.autoprepare"> <function>autoPrepare</function></link> will build the following sql query : <programlisting> -  <![CDATA[ + <![CDATA[ INSERT INTO user (id, name, country) VALUES (?, ?, ?) ]]> </programlisting> @@ -58,7 +58,7 @@ <function>execute</function></link> or <link linkend="package.database.db.db-common.executemultiple"> <function>executeMultiple</function></link> like : <programlisting role="php"> -  <![CDATA[ + <![CDATA[ (...) // $dbh is an DB object $table_fields = array('id', 'name', 'country'); $table_values = array(1, 'Fabien', 'France'); @@ -70,7 +70,7 @@ So, you don't have to write any sql insert queries ! But it works with update queries too. For flexibility reasons, you have only to write the WHERE statement of the query. For instance : -    <programlisting role="php"> + <programlisting role="php"> <![CDATA[ (...) // $dbh is an DB object $table_fields = array('name', 'country'); @@ -81,8 +81,8 @@ ]]> </programlisting> <link linkend="package.database.db.db-common.autoprepare"> -  <function>autoPrepare</function></link> will build the following query : -    <programlisting> + <function>autoPrepare</function></link> will build the following query : + <programlisting> <![CDATA[ UPDATE user SET name=?, country=? WHERE id=1 ]]>

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