From 7a30a425b9348a78d013c78c3940efe8c1f5fa35 Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 21 Mar 2018 10:53:40 +0100 Subject: [PATCH] PDO::PGSQL_ATTR_DISABLE_PREPARES is much better with PDO::ATTR_EMULATE_PREPARES queries are prepared by PDO with PDO::PGSQL_ATTR_DISABLE_PREPARES queries are prepared by PG, just unnamed --- faq.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/faq.md b/faq.md index dd31bd2..8761cb9 100644 --- a/faq.md +++ b/faq.md @@ -79,14 +79,18 @@ parameter to connect string. ### Disabling prepared statements in PHP/PDO To disable use of server-side prepared statements, the PDO attribute -`PDO::ATTR_EMULATE_PREPARES` must be set to `true`. Either at +`PDO::PGSQL_ATTR_DISABLE_PREPARES` must be set to `true`. Either at connect-time: - $db = new PDO("dsn", "user", "pass", array(PDO::ATTR_EMULATE_PREPARES => true)); + $db = new PDO("dsn", "user", "pass", array(PDO::PGSQL_ATTR_DISABLE_PREPARES => true)); or later: - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + $db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); + +Prior to PHP 5.6, you have to replace `PDO::PGSQL_ATTR_DISABLE_PREPARES` by `PDO::ATTR_EMULATE_PREPARES`. + +If you are using Doctrine/DBAL its already done for you. ## How to upgrade PgBouncer without dropping connections?