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

From: Date: Thu, 05 Feb 2004 01:29:18 +0000
Subject: cvs: peardoc /en/package/database/db/db-common quotesmart.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-2409@lists.php.net to get a copy of this message
danielc Wed Feb 4 20:29:18 2004 EDT Modified files: /peardoc/en/package/database/db/db-common quotesmart.xml Log: Explain how input types impact results. http://cvs.php.net/diff.php/peardoc/en/package/database/db/db-common/quotesmart.xml?r1=1.8&r2=1.9&ty=u Index: peardoc/en/package/database/db/db-common/quotesmart.xml diff -u peardoc/en/package/database/db/db-common/quotesmart.xml:1.8 peardoc/en/package/database/db/db-common/quotesmart.xml:1.9 --- peardoc/en/package/database/db/db-common/quotesmart.xml:1.8 Tue Jan 27 13:57:30 2004 +++ peardoc/en/package/database/db/db-common/quotesmart.xml Wed Feb 4 20:29:18 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry id="package.database.db.db-common.quotesmart"> <refnamediv> <refname>DB_common::quoteSmart()</refname> @@ -37,12 +37,118 @@ </variablelist> </para> </refsect1> + <refsect1 id="package.database.db.db-common.quotesmart.return"> &title.returns; <para> <parameter>mixed</parameter> - the formatted data </para> + <para> + The format of the results depends on the input's PHP type: + </para> + <itemizedlist> + <listitem> + <para> + <literal>input</literal> -&gt; <literal>returns</literal> + </para> + </listitem> + <listitem> + <para> + &type.null; -&gt; the string <literal>NULL</literal> + </para> + </listitem> + <listitem> + <para> + &type.int; or &type.double; -&gt; the unquoted number + </para> + </listitem> + <listitem> + <para> + &type.bool; -&gt; output depends on the driver in use + </para> + <para> + Most drivers return integers: <literal>1</literal> if + <literal>true</literal> or <literal>0</literal> if + <literal>false</literal>. + Some return strings: <literal>TRUE</literal> if + <literal>true</literal> or <literal>FALSE</literal> if + <literal>false</literal>. + Finally one returns strings: <literal>T</literal> if + <literal>true</literal> or <literal>F</literal> if + <literal>false</literal>. Here is a list of each DBMS, + the values returned and the suggested column type: + </para> + <itemizedlist> + <listitem> + <literal>dbase</literal> -&gt; <literal>T/F</literal> + (<literal>Logical</literal>) + </listitem> + <listitem> + <literal>fbase</literal> -&gt; <literal>TRUE/FALSE</literal> + (<literal>BOOLEAN</literal>) + </listitem> + <listitem> + <literal>ibase</literal> -&gt; <literal>1/0</literal> + (<literal>SMALLINT</literal>) [1] + </listitem> + <listitem> + <literal>ifx</literal> -&gt; <literal>1/0</literal> + (<literal>SMALLINT</literal>) [1] + </listitem> + <listitem> + <literal>msql</literal> -&gt; <literal>1/0</literal> + (<literal>INTEGER</literal>) + </listitem> + <listitem> + <literal>mssql</literal> -&gt; <literal>1/0</literal> + (<literal>BIT</literal>) + </listitem> + <listitem> + <literal>mysql</literal> -&gt; <literal>1/0</literal> + (<literal>TINYINT(1)</literal>) + </listitem> + <listitem> + <literal>mysql4</literal> -&gt; <literal>1/0</literal> + (<literal>TINYINT(1)</literal>) + </listitem> + <listitem> + <literal>oci8</literal> -&gt; <literal>1/0</literal> + (<literal>NUMBER(1)</literal>) + </listitem> + <listitem> + <literal>odbc</literal> -&gt; <literal>1/0</literal> + (<literal>SMALLINT</literal>) [1] + </listitem> + <listitem> + <literal>pgsql</literal> -&gt; <literal>TRUE/FALSE</literal> + (<literal>BOOLEAN</literal>) + </listitem> + <listitem> + <literal>sqlite</literal> -&gt; <literal>1/0</literal> + (<literal>INTEGER</literal>) + </listitem> + <listitem> + <literal>sybase</literal> -&gt; <literal>1/0</literal> + (<literal>TINYINT(1)</literal>) + </listitem> + </itemizedlist> + <para> + [1] Accommodate the lowest common denominator because not all + versions of have <literal>BOOLEAN</literal>. + </para> + </listitem> + <listitem> + <para> + other (including strings and numeric strings) -&gt; + the data with single quotes escaped by preceeding + single quotes, backslashes are escaped by preceeding + backslashes, then the whole string is encapsulated + between single quotes + </para> + </listitem> + </itemizedlist> </refsect1> + <refsect1 id="package.database.db.db-common.quotesmart.note"> &title.note; &note.notstatic;

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