We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I write this for have available use types in bulk insert:
private function types(array $types, int $datasetLength, array $columns): array { $positionalTypes = []; for ($dataRowIdx = 0; $dataRowIdx < $datasetLength; $dataRowIdx++) { foreach (array_values($columns) as $columnIndex => $column) { $columnIndex = $columnIndex + $dataRowIdx * count($columns); $positionalTypes[$columnIndex] = null; if (array_key_exists($column, $types)) { $positionalTypes[$columnIndex] = $types[$column]; } } } return $positionalTypes; }
And
return $this->connection->executeUpdate($sql, $this->parameters($dataset), $this->types($types, count($dataset), $this->extractColumns($dataset)));
The text was updated successfully, but these errors were encountered:
@solovichenko, if I get you right, this is what you want:
<?php use Doctrine\DBAL\Connection; use Doctrine\DBAL\Types\Types; use Franzose\DoctrineBulkInsert\Query; $connection = new Connection(...); $rows = (new Query($connection))->execute( 'table', [ ['foo' => 111, 'bar' => 'qux'], ['foo' => 333, 'bar' => 'doo'], ], [ Types::BIGINT, // 'foo' is bigint Types::TEXT // 'bar' is text ] );
I need to add this to the README. The thing is that the third argument is used the same as in Dotrine DBAL (so-called parallel arrays).
Sorry, something went wrong.
No branches or pull requests
I write this for have available use types in bulk insert:
And
The text was updated successfully, but these errors were encountered: