From f21aba621a9baee840afbbf904fff3502d654ac2 Mon Sep 17 00:00:00 2001 From: Damien Seguy Date: Wed, 22 Apr 2009 13:52:44 +0000 Subject: [PATCH] initial documentation git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@279153 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pdo_4d/constants.xml | 61 +++++++++ reference/pdo_4d/dsn.xml | 104 ++++++++++++++++ reference/pdo_4d/examples.xml | 219 +++++++++++++++++++++++++++++++++ reference/pdo_4d/ini.xml | 180 +++++++++++++++++++++++++++ reference/pdo_4d/reference.xml | 86 +++++++++++++ reference/pdo_4d/sql4d.xml | 103 ++++++++++++++++ reference/pdo_4d/sqltypes.xml | 160 ++++++++++++++++++++++++ 7 files changed, 913 insertions(+) create mode 100644 reference/pdo_4d/constants.xml create mode 100644 reference/pdo_4d/dsn.xml create mode 100644 reference/pdo_4d/examples.xml create mode 100644 reference/pdo_4d/ini.xml create mode 100644 reference/pdo_4d/reference.xml create mode 100644 reference/pdo_4d/sql4d.xml create mode 100644 reference/pdo_4d/sqltypes.xml diff --git a/reference/pdo_4d/constants.xml b/reference/pdo_4d/constants.xml new file mode 100644 index 0000000000..49af4d77eb --- /dev/null +++ b/reference/pdo_4d/constants.xml @@ -0,0 +1,61 @@ + + + + + + Constants for PDO_4D + Constants for PDO_4D + + + + &reftitle.constants; + &pdo.driver-constants; + + + + PDO::FOURD_ATTR_CHARSET + (integer) + + + + Change the charset in which 4D returns data. + (Default is UTF-8). + + + + + + PDO::FOURD_ATTR_PREFERRED_IMAGE_TYPES + (integer) + + + + The requested format of the image, when selecting a row + with a column type PICTURE. It may be any type that 4D supports. + + + + + + + + diff --git a/reference/pdo_4d/dsn.xml b/reference/pdo_4d/dsn.xml new file mode 100644 index 0000000000..702abeca5b --- /dev/null +++ b/reference/pdo_4d/dsn.xml @@ -0,0 +1,104 @@ + + + + + + PDO_4D DSN + Connecting to 4D SQL server + + + + &reftitle.description; + + The PDO_4D DSN consists of: + + + DSN prefix + + + The DSN prefix is 4D:. + + + + + host + + + The host on which the 4D SQL server is. + + + + + port + + + The port number for the server. This is optional. + + + + + dbname + + + The name of the database. This parameter is optional, + and it is not used. + + + + + chars_set + + + The 4D character set. + + + + + + + + &reftitle.examples; + + + DSN examples for PDO_4D + + The following examples has two DSN for PDO_4D, + that connects to a 4D database : + + + + Other possible values : + + + + + + + + + + + diff --git a/reference/pdo_4d/examples.xml b/reference/pdo_4d/examples.xml new file mode 100644 index 0000000000..cd6d33239c --- /dev/null +++ b/reference/pdo_4d/examples.xml @@ -0,0 +1,219 @@ + + + + + + Examples with PDO_4D + Examples PDO_4D + + + + + This basic example show how to connect, execute a query, + read data and disconnect from a 4D SQL server. + + Basic example with PDO_4D + +exec('CREATE TABLE test(id varCHAR(1) NOT NULL, val VARCHAR(10))'); +} catch (PDOException $e) { + die("Erreur 4D : " . $e->getMessage()); +} + +$db->exec("INSERT INTO test VALUES('A', 'A')"); +$db->exec("INSERT INTO test VALUES('B', 'A')"); +$db->exec("INSERT INTO test VALUES('C', 'C')"); + +$stmt = $db->prepare('SELECT id, val from test'); + +$stmt->execute(); +print_r($stmt->fetchAll()); + +unset($stmt); +unset($db); +?> +]]> + + &example.outputs; + + Array + ( + [ID] => A + [0] => A + [VAL] => B + [1] => B + ) + + [1] => Array + ( + [ID] => C + [0] => C + [VAL] => D + [1] => D + ) + + [2] => Array + ( + [ID] => E + [0] => E + [VAL] => F + [1] => F + ) + +) + +]]> + + + + + + + + This example shows how to execute a query in 4D language, + and how to read the result through PDO_4D. + + Accessing 4D language from pdo_4d + + Set up a 4D method, called method. Make sure + in the method properties that the option + Available via SQL is checked. The 4D code + is the following. + + + + + + The PHP code to use the above 4D method is : + + +prepare('SELECT {FN method() AS VARCHAR } FROM _USER_SCHEMAS LIMIT 1'); + +$stmt->execute(); +print_r($stmt->fetchAll()) ; + +unset($stmt); +unset($db); +?>]]> + + &example.outputs; + + Array + ( + [] => F0011140 + [0] => F0011140 + ) + +) +]]> + + + + + + + + + Executing a LEFT JOIN in 4D + + This example shows how to execute a LEFT JOIN SQL query, with 4D. + + +prepare($query); +$stmt->execute(); +        +print_r($stmt->fetchAll()); +  +$stmt = null; +$db = null; +?> +]]> + + + + + + + + diff --git a/reference/pdo_4d/ini.xml b/reference/pdo_4d/ini.xml new file mode 100644 index 0000000000..a7440e9276 --- /dev/null +++ b/reference/pdo_4d/ini.xml @@ -0,0 +1,180 @@ + + + +
+ &reftitle.runtime; + &extension.runtime; + + + &ConfigureOptions; PDO_4D + + + + &Name; + &Default; + &Changeable; + &Changelog; + + + + + pdo_4d.default_host + "localhost" + PHP_INI_ALL + + + + pdo_4d.default_port + 19812 + PHP_INI_ALL + + + + pdo_4d.default_user + "" + PHP_INI_ALL + + + + pdo_4d.default_password + + PHP_INI_ALL + + + + pdo_4d.connect_timeout + 60 + PHP_INI_ALL + + + + pdo_4d.charset + utf-16 + PHP_INI_ALL + + + + pdo_4d.prefered_image_type + "JPEG" + PHP_INI_ALL + + + + +
+ &ini.php.constants; +
+ +&ini.descriptions.title; + + + + + + pdo_4d.default_host + string + + + + The default host. + + + + + + + pdo_4d.default_port + string + + + + The default port number for the connexion. + + + + + + + pdo_4d.default_user + string + + + + The default 4D user. + + + + + + + pdo_4d.default_password + string + + + + The default password. + + + + + + + pdo_4d.connect_timeout + string + + + + The expiration time for the connexion to the 4D SQL server. + + + + + + + pdo_4d.charset + string + + + + The data charset. + + + + + + + pdo_4d.prefered_image_type + string + + + + The default image format that 4D returns. It may be + any format that 4D supports. For example, JPEG or PNG. + + + + + + +
+ + diff --git a/reference/pdo_4d/reference.xml b/reference/pdo_4d/reference.xml new file mode 100644 index 0000000000..e7ccd996ca --- /dev/null +++ b/reference/pdo_4d/reference.xml @@ -0,0 +1,86 @@ + + + + + + + Driver 4D for PDO (PDO_4D) + Driver 4D for PDO + + +
+ &reftitle.intro; + &warn.experimental; + + PDO_4D is a driver that implements the + PHP Data Objects (PDO) interface + to enable access from PHP to 4D databases. + + + 4D is an integrated platform that speeds and simplifies the development + and deployment of business applications, used in over 70 countries, by + a community of thousands of developers and vertical solution providers, + with millions of end-users worldwide. + + + By offering a suite of integrated tools such as an ANSI SQL relational + and transactional database, a graphical development environment, a + fourth-generation language with over 1000 high-level commands, a + built-in HTTP server, application server, etc., 4D facilitates the + creation and maintenance of applications from one to hundreds of + simultaneous users, whether on Windows, Mac or from any Web client. + + + 4D is also an open platform, offering a complete API for plug-in + creation, including various connectors that allow it to act as a + back-end or front-end for many environments (Oracle via OCI, SOAP + client or server, Flex data source, all ODBC databases, XML over + HTTP, etc.) + + + In addition to the ability to interact with 4D applications across + Web Services, 4D databases can now be directly accessed using the + PDO_4D driver. + + + More details about the 4D development environment on www.4D.com + + + PDO_4D has been developed to work on Windows (Vista), + Mac OS X (10.5) and Linux (Debian-tested). It is known to work with + 4D versions 11.4 and up, for Mac OS X and Windows. Older + plat-forms may work, but are unsupported. + +
+
+ + &reference.pdo-4d.dsn; + &reference.pdo-4d.constants; + &reference.pdo-4d.sqltypes; + &reference.pdo-4d.sql4d; + &reference.pdo-4d.examples; + + +
+ + \ No newline at end of file diff --git a/reference/pdo_4d/sql4d.xml b/reference/pdo_4d/sql4d.xml new file mode 100644 index 0000000000..19f7abc151 --- /dev/null +++ b/reference/pdo_4d/sql4d.xml @@ -0,0 +1,103 @@ + + + + + + Indications sur le SQL supporté par 4D + PDO and SQL 4D + + + + &reftitle.description; + + 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 : + &url.4d.doc;. + Below is a list of 4D SQL characteristics: it is not exhaustive, + but may serve as an introduction. + + + + Characteristics of 4D SQL + + + + Ch + aracteristics + Alternative + Note + + + + + INTEGER + INT is the supported integer type. Modify the SQL to use INT. + + + + UNION + Unsupported. Make separate queries. + + + + LEFT JOIN + Use the SQL 89 notation (see example #3 PDO_4D) + + + + SELECT 1 + 1; + SELECT 1 + 1 FROM _USER_SCHEMAS; + + + + FLOAT + Cast the FLOAT value with a SQL 4D function (ROUND, TRUNC or TRUNCATE) + Unsupported in the driver PDO_4D v1.0 + + + Strong typing : one must provide the right type that 4D expect. One can't insert '1' (as a string) in an INTEGER column. + Modify your SQL query, or your PHP to adapt the type + Unsupported + + + PDO::execute($row) only works if all the table's column are of type TEXT + Use the prepared statements, and use the right types. + The PDO extension cast all values through execute() as string, and expect the SQL database to parse the values. + + + +
+
+ + + In version 11.3 and below, it wasn't possible to use the SQL syntax + id INT PRIMARY KEY 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. + + +
+
+ + + diff --git a/reference/pdo_4d/sqltypes.xml b/reference/pdo_4d/sqltypes.xml new file mode 100644 index 0000000000..f67927bb78 --- /dev/null +++ b/reference/pdo_4d/sqltypes.xml @@ -0,0 +1,160 @@ + + + + + + SQL types with PDO_4D and PHP + SQL types with PDO_4D and PHP + + + + + + Supported SQL types + + + + Type SQL 4D + Equivalent 4D + Note + + + + + ALPHA_NUMERIC + TEXT + + + + VARCHAR + TEXT + + + + TEXT + TEXT + + + + TIMESTAMP + DATE + + + + INTERVAL + HOUR + + + + DURATION + HOUR + + + + BOOLEAN + BOOLEAN + + + + BIT + BOOLEAN + + + + BYTE + INT32 + + + + INT16 + SMALLINT + + + + SMALLINT + SMALLINT + + + + INT32 + INT32 + + + + INT + INT32 + + + + INT64 + INT64 + + + + NUMERIC + INT64 + + + + REAL + REAL + + + + FLOAT + FLOAT + Unsupported + + + DOUBLE PRECISION + FLOAT + + + + BLOB + BLOB + Must use a prepared statement, and PDO::PARAM_LOB + + + BIT VARYING + BLOB + Must use a prepared statement, and PDO::PARAM_LOB + + + CLOB + TEXT + + + + PICTURE + PICTURE + Must use a prepared statement, and PDO::PARAM_LOB + + + +
+
+
+
+ + +