Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 10696

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>PDO and SQL 4D</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="pdo-4d.sqltypes.html">SQL types with PDO_4D and PHP</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pdo-4d.examples.html">Examples with PDO_4D</a></div>
 <div class="up"><a href="ref.pdo-4d.html">4D (PDO)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="ref.pdo-4d.sql4d" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SQL acceptable by 4D</h1>
  <p class="verinfo">(No version information available, might only be in SVN)</p><p class="refpurpose"><span class="refname">SQL acceptable by 4D</span> &mdash; <span class="dc-title">PDO and SQL 4D</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-ref.pdo-4d.sql4d-description">
  <h3 class="title">Description</h3>
  <p class="para">
   4D implements strictly the ANSI 89 standard, and have it enforced.
   It is highly recommended to read the 4D SQL documentation to learn
   about the available commands. The URL of the manual is :
   <a href="http://doc.4d.com/" class="link external">&raquo;&nbsp;http://doc.4d.com/</a>.
   Below is a list of 4D SQL characteristics: it is not exhaustive,
   but may serve as an introduction.
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Characteristics of 4D SQL</strong></caption>
     
      <thead>
       <tr>
        <th>Characteristics</th>
        <th>Alternative</th>
        <th>Note</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>INTEGER</td>
        <td>Modify the SQL to use INT.</td>
        <td>INT is the supported integer type in 4Dv12.0.</td>
       </tr>

       <tr>
        <td>CHAR</td>
        <td>Use VARCHAR instead.</td>
        <td>Unsupported in 4Dv12.0</td>
       </tr>

       <tr>
        <td>UNION</td>
        <td>Unsupported. Make separate queries.</td>
        <td>Unsupported in 4Dv12.0</td>
       </tr>

       <tr>
        <td>SELECT 1 + 1;</td>
        <td>SELECT 1 + 1 FROM _USER_SCHEMAS;</td>
        <td>FROM is required</td>
       </tr>

       <tr>
        <td>FLOAT</td>
        <td>Cast the FLOAT value into a FLOAT or STRING, with an SQL 4D function (CAST, ROUND, TRUNC or TRUNCATE)</td>
        <td>Unsupported in current versions of the PDO_4D driver</td>
       </tr>

       <tr>
        <td>Strong typing</td>
        <td>Take care your SQL query, or your PHP code provides data with the expected type</td>
        <td>
         One must provide the right type that 4D expect. One can&#039;t insert &#039;1&#039; (as a string) in an INTEGER column.
        </td>
       </tr>

       <tr>
        <td> <span class="function"><strong>PDO::execute($row)()</strong></span> : only works if all the table&#039;s column are of type TEXT or VARCHAR</td>
        <td>Use the prepared statements, and use the right types.</td>
        <td>The PDO extension cast all values through execute() as string, and expect the SQL database to parse the values.</td>
       </tr>

       <tr>
        <td>SELECT NULL FROM TABLE</td>
        <td>Do not use NULL constants. Extract them from the table</td>
        <td>It is not allowed to use the NULL constant in the select list</td>
       </tr>

       <tr>
        <td>SELECT * FROM TABLE WHERE 1</td>
        <td>Use WHERE 1 = 1</td>
        <td>A constant can&#039;t be used in a WHERE clause</td>
       </tr>

       <tr>
        <td>SHOW TABLES</td>
        <td>Use system tables</td>
        <td>
         The list of tables, schemas, index, etc. are in these system tables :
         <em>_USER_TABLES</em>,  <em>_USER_COLUMNS</em>,  
         <em>_USER_INDEXES</em>,  <em>_USER_CONSTRAINTS</em>,  
         <em>_USER_IND_COLUMNS</em>,  <em>_USER_CONS_COLUMNS</em>,
         and <em>_USER_SCHEMAS</em>.
        </td>
       </tr>

       <tr>
        <td>SQL structure delimiter</td>
        <td>
         Use the following function to protect SQL elements:
         function sqlEscapeElement(elem) {
            return &#039;[&#039; . str_replace(&#039;]&#039;,&#039;]]&#039;, $elem) . &#039;]&#039;;
         }
        </td>
        <td>
         To escape SQL elements names (tables, fields, users, 
         groups, schema, primary key, etc.), the whole identifier
         must be between square brackets, and the closing 
         brackets &#039;]&#039; must be doubled.
        </td>
       </tr>

      </tbody>
     
    </table>

  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="pdo-4d.sqltypes.html">SQL types with PDO_4D and PHP</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pdo-4d.examples.html">Examples with PDO_4D</a></div>
 <div class="up"><a href="ref.pdo-4d.html">4D (PDO)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>