cvs: peardoc /en/package/database/db/db-common query.xml

From: Date: Mon, 26 Jan 2004 20:43:04 +0000
Subject: cvs: peardoc /en/package/database/db/db-common query.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-2169@lists.php.net to get a copy of this message
danielc Mon Jan 26 15:43:04 2004 EDT Modified files: /peardoc/en/package/database/db/db-common query.xml Log: Better document prepare/execute mode. Clarify text. http://cvs.php.net/diff.php/peardoc/en/package/database/db/db-common/query.xml?r1=1.7&r2=1.8&ty=u Index: peardoc/en/package/database/db/db-common/query.xml diff -u peardoc/en/package/database/db/db-common/query.xml:1.7 peardoc/en/package/database/db/db-common/query.xml:1.8 --- peardoc/en/package/database/db/db-common/query.xml:1.7 Thu Oct 9 08:46:01 2003 +++ peardoc/en/package/database/db/db-common/query.xml Mon Jan 26 15:43:04 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry id="package.database.db.db-common.query"> <refnamediv> <refname>DB_Common::query()</refname> @@ -6,14 +6,11 @@ </refnamediv> <refsynopsisdiv> <funcsynopsis> - <funcsynopsisinfo> - require_once 'DB.php'; - </funcsynopsisinfo> <funcprototype> <funcdef>mixed <function>&amp;query</function></funcdef> <paramdef>string <parameter>$query</parameter></paramdef> <paramdef> - array <parameter><optional>$params</optional></parameter> + mixed <parameter><optional>$params</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> @@ -23,6 +20,17 @@ <para> Executes a SQL query </para> + <para> + Can be used instead of + <link linkend="package.database.db.db-common.prepare"> + <function>prepare</function></link> and + <link linkend="package.database.db.db-common.execute"> + <function>execute</function></link>, if you + set the <parameter>$params</parameter> parameter + and your query uses placeholders. + See <link linkend="package.database.db.intro-execute"> + Introduction - Execute</link> for more information on this mode. + </para> </refsect1> <refsect1 id="package.database.db.db-common.query.parameter"> &title.param; @@ -42,13 +50,15 @@ </varlistentry> <varlistentry> <term> - &type.array; + &type.mixed; <parameter>$params</parameter> </term> <listitem> <para> - the data to be added to - the query + array, string or numeric data to be added to the prepared statement. + Quantity of items passed must match quantity of placeholders in the + prepared statement: meaning 1 placeholder for non-array + parameters or 1 placeholder per array element. </para> </listitem> </varlistentry> @@ -58,8 +68,9 @@ <refsect1 id="package.database.db.db-common.query.return"> &title.returns; <para> - <parameter>mixed</parameter> - a new - &class.db-result;/&constant.db-ok; or a &class.db-error;, if fail + <parameter>mixed</parameter> - a new &class.db-result; object, + &constant.db-ok; for queries without results + or a &class.db-error; object on failure </para> </refsect1> <refsect1 id="package.database.db.db-common.query.throws"> @@ -88,7 +99,7 @@ <entry> See the <link linkend="package.database.db.db-common.prepare"> <function>prepare</function> documentation</link>, - if you want to use a SQL statement using wildcards. + if you want to use a SQL statement using placeholders. </entry> </row> <row> @@ -97,10 +108,10 @@ &null; </entry> <entry> - Too few data for filling the prepared SQL statment. + Quantity of parameters didn't match quantity of placeholders in the prepared statment. </entry> <entry> - Check the number of wildcards given in the SQL statement + Check the number of placeholders given in the SQL statement <link linkend="package.database.db.db-common.prepare"> <function>prepare</function></link>. Check the count of entries in the array for <parameter>$params</parameter>. The count @@ -143,21 +154,6 @@ <refsect1 id="package.database.db.db-common.query.note"> &title.note; &note.notstatic; - <note> - <para> - <function>query</function> can be used instead of - <link linkend="package.database.db.db-common.prepare"> - <function>prepare</function></link> and - <link linkend="package.database.db.db-common.execute"> - <function>execute</function></link>, if you - set the <parameter>$params</parameter> parameter - and your query uses wildcards. - </para> - </note> - <para> - See <link linkend="package.database.db.intro-execute"> - Introduction - Execute</link> for general using and an example. - </para> </refsect1> <refsect1 id="package.database.db.db-common.query.see"> &title.see;

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