amphp / mysql

An async MySQL client for PHP, optimizing database interactions with efficient non-blocking capabilities. Perfect for responsive, high-performance applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Substitue named parameter multiple times in a single query

Bilge opened this issue · comments

commented

Currently parameter substitution for named parameters only works if the name is substituted exactly once per name. However, there seems to be no technical reason why the same name cannot or should not be used multiple times, and indeed, this is supported by PDO.

yield $this->connection->execute(
    'INSERT foo
        SET Alfa=:Alfa,
            Bravo=:Bravo,
            Charlie=:Bravo
        ON DUPLICATE KEY UPDATE
            Bravo=:Bravo,
            Charlie=:Bravo
    ',
    [
        'Alfa' => 1,
        'Bravo' => 2,
    ]
);

Notice: Undefined index: Bravo in ConnectionStatement.php line 130