cvs: peardoc /en/package/database/db/db-common quoteidentifier.xml
| From: | Daniel Convissor | Date: | Sun, 08 Feb 2004 00:48:20 +0000 |
| Subject: | cvs: peardoc /en/package/database/db/db-common quoteidentifier.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-2449@lists.php.net to get a copy of this message | ||
danielc Sat Feb 7 19:48:20 2004 EDT
Added files:
/peardoc/en/package/database/db/db-common quoteidentifier.xml
Log:
Add quoteidentifier.
http://cvs.php.net/co.php/peardoc/en/package/database/db/db-common/quoteidentifier.xml?r=1.1&p=1
Index: peardoc/en/package/database/db/db-common/quoteidentifier.xml
+++ peardoc/en/package/database/db/db-common/quoteidentifier.xml
<!-- $Revision: 1.1 $ -->
<refentry id="package.database.db.db-common.quoteidentifier">
<refnamediv>
<refname>DB_common::quoteIdentifier()</refname>
<refpurpose>Format string so it can be safely used as an identifier</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>DB::quoteIdentifier</function></funcdef>
<paramdef>string <parameter>$str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="package.database.db.db-common.quoteidentifier.desc">
&title.desc;
<para>
Format input so it can be safely used as a delimited identifier
in a query. Identifiers are objects such as table or column names.
</para>
<para>
The format returned depends on the database type being used.
</para>
<para>
Delimited identifiers are known to generally work correctly under
the following drivers:
<simplelist>
<member>mssql</member>
<member>mysql</member>
<member>mysql4</member>
<member>oci8</member>
<member>odbc(access)</member>
<member>odbc(db2)</member>
<member>pgsql</member>
<member>sqlite</member>
<member>sybase</member>
</simplelist>
</para>
<para>
InterBase doesn't seem to be able to use delimited identifiers
via PHP.
</para>
</refsect1>
<refsect1 id="package.database.db.db-common.quoteidentifier.parameter">
&title.param;
<para>
<variablelist>
<varlistentry>
<term>
&type.string;
<parameter>$str</parameter>
</term>
<listitem>
<para>
the input to be quoted
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 id="package.database.db.db-common.quoteidentifier.return">
&title.returns;
<para>
<parameter>string</parameter> - the formatted string
</para>
</refsect1>
<refsect1 id="package.database.db.db-common.quotesmart.note">
&title.note;
¬e.notstatic;
<simpara>
Function available since: Release 1.6.0
</simpara>
<warning>
<para>
Just because you CAN use delimited identifiers doesn't mean
you SHOULD use them. In general, they end up causing way more
problems than they solve.
</para>
<para>
Portability is broken by using the following characters inside
delimited identifiers:
<simplelist>
<member>backtick (<literal>`</literal>) -- due to MySQL</member>
<member>double quote (<literal>"</literal>) -- due to
Oracle</member>
<member>brackets (<literal>[</literal> or <literal>]</literal>)
-- due to Access</member>
</simplelist>
</para>
</warning>
</refsect1>
<refsect1 id="package.database.db.db-common.quoteidentifier.example">
&title.example;
<example>
<title>Using <function>quoteIdentifier</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Once you have a valid DB object named $db...
$sql = 'SELECT ' . $db->quoteIdentifier('company name')
. ', address FROM clients';
$result = $db->query($sql);
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 id="package.database.db.db-common.quoteidentifier.see">
&title.see;
<para>
<link linkend="package.database.db.db-common.quotesmart">
<function>quoteSmart</function></link>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->