Skip to content

Conversation

marliotto
Copy link

Hello,
I've fixed rewriting values when values was been set through bindValue().
For example:

$statement = $this->connection->prepare('INSERT INTO test_insert_table(id, payload) VALUES (?, ?), (?, ?)');
$statement->bindValue(0, 7, ParameterType::INTEGER);
$statement->bindValue(1, 'v?7');
$statement->bindValue(2, 8, ParameterType::INTEGER);
$statement->bindValue(3, 'v8');

Result SQL:

INSERT INTO test_insert_table(id, payload) VALUES (7, 'v87'), ('v8', ?)

Fixed bug with keys that have the same prefix.
For example:

$statement = $this->connection->prepare('INSERT INTO test_insert_table(id, payload) VALUES (:v1, :v10)');
$statement->execute(['v1' => 1, 'v10' => 'v1');

Also, new solution supports keys like '?' and ':key' in one query.

@marliotto
Copy link
Author

Hello @mochalygin , @argayash ! Could you check my PR?
It will fix #22

@asanikovich asanikovich self-assigned this Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants