diff --git a/reference/pdo_4d/examples.xml b/reference/pdo_4d/examples.xml index cd6d33239c..18b9fc86c0 100644 --- a/reference/pdo_4d/examples.xml +++ b/reference/pdo_4d/examples.xml @@ -1,5 +1,5 @@ - + @@ -194,6 +194,64 @@ $db = null; + + + + + Escaping 4D table names + + This examples illustrates how to escape characters in a + 4D SQL query. + + + $object) { + $object = str_replace(']',']]', $object); + print "$object\n"; + + $db->exec('CREATE TABLE IF NOT EXISTS ['.$object.'](['.$object.'] FLOAT)'); + + $req = "INSERT INTO [$object] ([$object]) VALUES ($id);"; + $db->query($req); + + $q = $db->prepare("SELECT [$object] FROM [$object]"); + $q->execute(); + $x[] = $q->fetch(PDO::FETCH_NUM); + + $db->exec('DROP TABLE ['.$object.'];'); +} + +?> +]]> + + + &example.outputs; + + + + + +