cvs: peardoc /en/package/database/db intro-fetch.xml
| From: | Daniel Convissor | Date: | Sat, 22 May 2004 21:27:24 +0000 |
| Subject: | cvs: peardoc /en/package/database/db intro-fetch.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-4066@lists.php.net to get a copy of this message | ||
danielc Sat May 22 17:27:24 2004 EDT
Modified files:
/peardoc/en/package/database/db intro-fetch.xml
Log:
Add note about problems with duplicate column names.
http://cvs.php.net/diff.php/peardoc/en/package/database/db/intro-fetch.xml?r1=1.44&r2=1.45&ty=u
Index: peardoc/en/package/database/db/intro-fetch.xml
diff -u peardoc/en/package/database/db/intro-fetch.xml:1.44
peardoc/en/package/database/db/intro-fetch.xml:1.45
--- peardoc/en/package/database/db/intro-fetch.xml:1.44 Wed Apr 28 01:27:11 2004
+++ peardoc/en/package/database/db/intro-fetch.xml Sat May 22 17:27:23 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
-<!-- $Revision: 1.44 $ -->
+<!-- $Revision: 1.45 $ -->
<refentry id="package.database.db.intro-fetch">
<refnamediv>
@@ -120,6 +120,31 @@
]]>
</screen>
</para>
+ <para>
+ NOTE: When a query contains the same column name more
+ than once (such as when joining tables which have
+ duplicate column names) and the fetch mode is
+ <constant>DB_FETCHMODE_ASSOC</constant> or
+ <constant>DB_FETCHMODE_OBJECT</constant>,
+ the data from the last column with a given name will
+ be the one returned. There are two immediate options
+ to work around this issue:
+ <simplelist>
+ <member>
+ Use aliases in your query, for example
+ <userinput>People.Name AS PersonName<userinput>
+ </member>
+ <member>
+ Change the fetch mode to <constant>DB_FETCHMODE_ORDERED</constant>
+ </member>
+ </simplelist>
+ </para>
+ <para>
+ TIP: If you are running into this issue, it likely
+ indicates poor planning of the database schema. Either
+ data is needlessly being duplicated or the same names are
+ being used for different kinds of data.
+ </para>
</refsect2>
<refsect2 id="package.database.db.intro-fetch.desc.set">