mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-28 23:08:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@292207 c90b9560-bf6c-de11-be94-00142212c4b1
135 lines
4.6 KiB
XML
135 lines
4.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="ref.pdo-4d.sql4d" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SQL acceptable by 4D</refname>
|
|
<refpurpose>PDO and SQL 4D</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<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 :
|
|
<link xlink:href="&url.4d.doc;">&url.4d.doc;</link>.
|
|
Below is a list of 4D SQL characteristics: it is not exhaustive,
|
|
but may serve as an introduction.
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>Characteristics of 4D SQL</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Characteristics</entry>
|
|
<entry>Alternative</entry>
|
|
<entry>Note</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>INTEGER</entry>
|
|
<entry>INT is the supported integer type. Modify the SQL to use INT.</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry>UNION</entry>
|
|
<entry>Unsupported. Make separate queries.</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry>LEFT JOIN</entry>
|
|
<entry>Use the SQL 89 notation</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry>SELECT 1 + 1;</entry>
|
|
<entry>SELECT 1 + 1 FROM _USER_SCHEMAS;</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry>FLOAT</entry>
|
|
<entry>Cast the FLOAT value with a SQL 4D function (ROUND, TRUNC or TRUNCATE)</entry>
|
|
<entry>Unsupported in the driver PDO_4D v1.0</entry>
|
|
</row>
|
|
<row>
|
|
<entry>Strong typing : one must provide the right type that 4D expect. One can't insert '1' (as a string) in an INTEGER column.</entry>
|
|
<entry>Modify your SQL query, or your PHP to adapt the type</entry>
|
|
<entry>Unsupported</entry>
|
|
</row>
|
|
<row>
|
|
<entry><function>PDO::execute($row)</function></entry>
|
|
<entry>Use the prepared statements, and use the right types. It will also
|
|
only works if all the table's column are of type <literal>TEXT</literal>.</entry>
|
|
<entry>The PDO extension cast all values through execute() as string, and expect the SQL database to parse the values.</entry>
|
|
</row>
|
|
<row>
|
|
<entry>SELECT NULL FROM TABLE</entry>
|
|
<entry>It is not allowed to use the NULL constante in the select list</entry>
|
|
<entry>Do not use NULL constants. Extract them from the table</entry>
|
|
</row>
|
|
<row>
|
|
<entry>SELECT * FROM TABLE WHERE 1</entry>
|
|
<entry>A constant can't be used in a WHERE clause.</entry>
|
|
<entry>Use <literal>1 = 1</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry>SHOW TABLES</entry>
|
|
<entry>The list of tables, schemas, index, etc. are in 7 4D tables</entry>
|
|
<entry>
|
|
Use <literal>_USER_TABLES</literal>, <literal>_USER_COLUMNS</literal>,
|
|
<literal>_USER_INDEXES</literal>, <literal>_USER_CONSTRAINTS</literal>,
|
|
<literal>_USER_IND_COLUMNS</literal>, <literal>_USER_CONS_COLUMNS</literal>,
|
|
and <literal>_USER_SCHEMAS</literal>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>SQL structure delimiter</entry>
|
|
<entry>To escape SQL elements (tables, fields, users, groups, schema,
|
|
primary key, etc.), closing brackets must be doubled, and the whole
|
|
identifier must be between square brackets.
|
|
</entry>
|
|
<entry>
|
|
Use the following function to protect SQL objects, and then,
|
|
put it between square brackets :
|
|
<literal>str_replace(']',']]', $table)</literal>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
In version 11.3 and below, it wasn't possible to use the SQL syntax
|
|
<literal>id INT PRIMARY KEY</literal> during the creation of a table.
|
|
This have been fixed in 4D 11.4 and up. It is recommended to use
|
|
at least version 11.4 with PDO_4D.
|
|
</para>
|
|
</note>
|
|
</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
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/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
|
|
-->
|
|
|