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

From: Date: Mon, 19 Apr 2004 05:17:04 +0000
Subject: cvs: peardoc /en/package/database/db intro-auto.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-3635@lists.php.net to get a copy of this message
danielc Mon Apr 19 01:17:04 2004 EDT Modified files: /peardoc/en/package/database/db intro-auto.xml Log: Light cleanup. http://cvs.php.net/diff.php/peardoc/en/package/database/db/intro-auto.xml?r1=1.30&r2=1.31&ty=u Index: peardoc/en/package/database/db/intro-auto.xml diff -u peardoc/en/package/database/db/intro-auto.xml:1.30 peardoc/en/package/database/db/intro-auto.xml:1.31 --- peardoc/en/package/database/db/intro-auto.xml:1.30 Fri Apr 16 19:29:44 2004 +++ peardoc/en/package/database/db/intro-auto.xml Mon Apr 19 01:17:04 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.30 $ --> +<!-- $Revision: 1.31 $ --> <refentry id="package.database.db.intro-auto"> <refnamediv> @@ -16,13 +16,15 @@ <function>autoPrepare</function></link> and <link linkend="package.database.db.db-common.autoexecute"> <function>autoExecute</function></link> - 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 + 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. </para> <para> - Imagine you have an 'user' table with 3 fields (id, name and country). + Imagine you have a 'user' table with 3 fields + (id, name and country). You have to write sql queries like: <programlisting role="sql"> @@ -63,7 +65,7 @@ </programlisting> In this example, <link linkend="package.database.db.db-common.autoprepare"> - <function>autoPrepare</function></link> will build the following sql query: + <function>autoPrepare</function></link> will build the following SQL query: <programlisting role="sql"> <![CDATA[ @@ -78,7 +80,8 @@ <para> To add records, you have to use <link linkend="package.database.db.db-common.execute"> - <function>execute</function></link> or <link linkend="package.database.db.db-common.executemultiple"> + <function>execute</function></link> or <link + linkend="package.database.db.db-common.executemultiple"> <function>executeMultiple</function></link> like: <programlisting role="php"> @@ -96,8 +99,9 @@ ]]> </programlisting> - 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 + So, you don't have to write any SQL <command>INSERT</command> + queries! And it works with <command>UPDATE</command> + queries too. For flexibility reasons, you have only to write the <command>WHERE</command> clause of the query. For instance: <programlisting role="php"> @@ -149,9 +153,11 @@ <para> Using <link linkend="package.database.db.db-common.autoexecute"> <function>autoExecute</function></link> is the easiest way - to do insert or update queries. It is a mix of <link linkend="package.database.db.db-common.autoprepare"> - <function>autoPrepare</function></link> and <link linkend="package.database.db.db-common.autoprepare"> - <function>execute</function></link>. + to do insert or update queries. It is a mix of <link + linkend="package.database.db.db-common.autoprepare"> + <function>autoPrepare</function></link> and <link + linkend="package.database.db.db-common.autoprepare"> + <function>execute</function></link>. </para> <para> @@ -192,7 +198,7 @@ </para> <para> - And it's the same thing for update queries: + And it's the same thing for <command>UPDATE</command> queries: <programlisting role="php"> <![CDATA[ @@ -226,7 +232,8 @@ </para> <para> - Be careful, if you don't specify any WHERE statement, all the records + Be careful, if you don't specify any <command>WHERE</command> + statement, all the records of the table will be updated. </para> </refsect2>

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