From aaebccf8bbc3c6b295a6d2ef806c8a899b7d1f38 Mon Sep 17 00:00:00 2001 From: Damien Seguy Date: Fri, 19 Mar 2010 11:49:22 +0000 Subject: [PATCH] doc update for 4D v12.0 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@296385 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pdo_4d/dsn.xml | 1 + reference/pdo_4d/examples.xml | 6 ++-- reference/pdo_4d/reference.xml | 10 +++--- reference/pdo_4d/sql4d.xml | 65 +++++++++++++++++----------------- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/reference/pdo_4d/dsn.xml b/reference/pdo_4d/dsn.xml index 27c5f651f0..147163ff94 100644 --- a/reference/pdo_4d/dsn.xml +++ b/reference/pdo_4d/dsn.xml @@ -89,6 +89,7 @@ diff --git a/reference/pdo_4d/examples.xml b/reference/pdo_4d/examples.xml index 2ac50507cb..ec0687c812 100644 --- a/reference/pdo_4d/examples.xml +++ b/reference/pdo_4d/examples.xml @@ -21,7 +21,7 @@ $user = 'test'; $pass = 'test'; // Connection to the 4D SQL server -$db = new PDO_4D($dsn, $user, $pass); +$db = new PDO($dsn, $user, $pass); try { $db->exec('CREATE TABLE test(id varCHAR(1) NOT NULL, val VARCHAR(10))'); @@ -109,7 +109,7 @@ $user = 'test'; $pass = 'test'; // Connection to the 4D server -$db = new pdo($dsn, $user, $pass); +$db = new PDO($dsn, $user, $pass); $stmt = $db->prepare('SELECT {FN method() AS VARCHAR } FROM _USER_SCHEMAS LIMIT 1'); @@ -153,7 +153,7 @@ $user = 'test'; $pass = 'test';   // Connection to 4D server 4D -$db = new PDO_4D($dsn, $user, $pass); +$db = new PDO($dsn, $user, $pass); $objects = array('[',']','[]','][','[[',']]','[[[',']]]','TBL ]]32[23'); diff --git a/reference/pdo_4d/reference.xml b/reference/pdo_4d/reference.xml index 68db59eee0..2863b8f228 100644 --- a/reference/pdo_4d/reference.xml +++ b/reference/pdo_4d/reference.xml @@ -4,8 +4,8 @@ - Driver 4D for PDO (PDO_4D) - Driver 4D for PDO + 4D Functions (PDO_4D) + 4D (PDO)
@@ -46,10 +46,8 @@ More details about the 4D development environment on &url.4d;. - 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. + PDO_4D is known to work with 4D versions 12 beta and up, for Mac OS X + and Windows. Older plat-forms may work, but are unsupported.
diff --git a/reference/pdo_4d/sql4d.xml b/reference/pdo_4d/sql4d.xml index c14db35770..d0b8141080 100644 --- a/reference/pdo_4d/sql4d.xml +++ b/reference/pdo_4d/sql4d.xml @@ -31,55 +31,57 @@ INTEGER - INT is the supported integer type. Modify the SQL to use INT. - + Modify the SQL to use INT. + INT is the supported integer type in 4Dv12.0. + + + CHAR + Use VARCHAR instead. + Unsupported in 4Dv12.0 UNION Unsupported. Make separate queries. - - - - LEFT JOIN - Use the SQL 89 notation - + Unsupported in 4Dv12.0 SELECT 1 + 1; SELECT 1 + 1 FROM _USER_SCHEMAS; - + FROM is required FLOAT - Cast the FLOAT value with a SQL 4D function (ROUND, TRUNC or TRUNCATE) - Unsupported in the driver PDO_4D v1.0 + Cast the FLOAT value into a FLOAT or STRING, with a SQL 4D function (CAST, ROUND, TRUNC or TRUNCATE) + Unsupported in current versions of the PDO_4D driver - 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 + Strong typing + Take care your SQL query, or your PHP code provides data with the expected type + + One must provide the right type that 4D expect. One can't insert '1' (as a string) in an INTEGER column. + - PDO::execute($row) - Use the prepared statements, and use the right types. It will also - only works if all the table's column are of type TEXT. + PDO::execute($row) : only works if all the table's column are of type TEXT or VARCHAR + 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. SELECT NULL FROM TABLE - It is not allowed to use the NULL constante in the select list Do not use NULL constants. Extract them from the table + It is not allowed to use the NULL constant in the select list SELECT * FROM TABLE WHERE 1 - A constant can't be used in a WHERE clause. - Use 1 = 1 + Use WHERE 1 = 1 + A constant can't be used in a WHERE clause SHOW TABLES - The list of tables, schemas, index, etc. are in 7 4D tables + Use system tables - Use _USER_TABLES, _USER_COLUMNS, + The list of tables, schemas, index, etc. are in these system tables : + _USER_TABLES, _USER_COLUMNS, _USER_INDEXES, _USER_CONSTRAINTS, _USER_IND_COLUMNS, _USER_CONS_COLUMNS, and _USER_SCHEMAS. @@ -87,14 +89,17 @@ SQL structure delimiter - 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. + + Use the following function to protect SQL elements: + function sqlEscapeElement(elem) { + return '[' . str_replace(']',']]', $elem) . ']'; + } - Use the following function to protect SQL objects, and then, - put it between square brackets : - str_replace(']',']]', $table). + 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 ']' must be doubled. @@ -103,10 +108,6 @@ - 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.