Bug->Doc #77031 [Opn]: ATTR_EMULATE_PREPARES and multiquery

From: Date: Tue, 06 Jul 2021 17:04:52 +0000
Subject: Bug->Doc #77031 [Opn]: ATTR_EMULATE_PREPARES and multiquery
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18920@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77031&edit=1

 ID:                 77031
 Updated by:         cmb@php.net
 Reported by:        giolaza at gmail dot com
 Summary:            ATTR_EMULATE_PREPARES and multiquery
 Status:             Open
-Type:               Bug
+Type:               Documentation Problem
 Package:            PDO MySQL
 Operating System:   Windows, Linux
 PHP Version:        7.2.11
 Block user comment: N
 Private report:     N

 New Comment:

PDO::query() is a shortcut for PDO::prepare() and PDO::execute().
mysql_prepare() only supports a single statement[1]; that's why
you're getting an error.  Emulated prepares, on the other hand,
don't mind multiple statements (unless
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false), so this works.

I think we should document this.

[1] <https://dev.mysql.com/doc/c-api/8.0/en/mysql-stmt-prepare.html>


Previous Comments:
------------------------------------------------------------------------
[2018-10-18 09:48:16] giolaza at gmail dot com

Description:
------------
PDO::ATTR_EMULATE_PREPARES and connect->quety('UPDATE 1 SLQ; UPDATE 2 SQL') problem

Test script:
---------------
$this->connect->setAttribute(\PDO::ATTR_EMULATE_PREPARES,false); 
$q2=[];
$q2[]='UPDATE users set
has_trialPeriod=0,last_changedBalance=1539846901 where id=1';
$q2[]='UPDATE users set
balance_usd=(balance_usd-99990000) where id=1';
$q=implode(';', $q2);

$this->connection->query($q);

got err

Actual result:
--------------
GOT SQL ERR 


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77031&edit=1


Thread (1 message)

  • cmb@php.net
  • Unknown Message
    • cmb@php.net
« previous php.doc.bugs (#18920) next »