Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .composer-require-checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"symbol-whitelist": [
"Doctrine\\Common\\EventSubscriber",
"Doctrine\\DBAL\\Event\\SchemaColumnDefinitionEventArgs",
"Doctrine\\DBAL\\Events"
"Doctrine\\DBAL\\Events",
"PDO\\Mysql"
]
}
2 changes: 0 additions & 2 deletions .github/workflows/fix-cs-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}

- name: Run PHP-CS-Fixer
uses: docker://ghcr.io/php-cs-fixer/php-cs-fixer:3.62.0-php8.3
Expand Down
15 changes: 13 additions & 2 deletions src/Webfactory/Slimdump/Database/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private function dumpData(Schema\Table $asset, Table $tableConfig): void
} else {
throw new RuntimeException('failed to obtain the wrapped PDO object from the DBAL connection');
}
$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
$this->controlBufferedQuery($pdo, false);
$actualRows = 0;

$this->outputFormatDriver->beginTableDataDump($asset, $tableConfig);
Expand All @@ -155,7 +155,7 @@ private function dumpData(Schema\Table $asset, Table $tableConfig): void
$this->progressOutput->writeln(\sprintf('<error>Expected %d rows, actually processed %d – verify results!</error>', $numRows, $actualRows));
}

$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
$this->controlBufferedQuery($pdo, true);

$this->outputFormatDriver->endTableDataDump($asset, $tableConfig);
}
Expand All @@ -166,4 +166,15 @@ public static function isBlob(Schema\Column $column): bool

return $type instanceof BlobType || $type instanceof BinaryType;
}

private function controlBufferedQuery(PDO $pdo, bool $value): void
{
if (version_compare(\PHP_VERSION, '8.4.0', '<')) {
$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

return;
}

$pdo->setAttribute(PDO\Mysql::ATTR_USE_BUFFERED_QUERY, $value);
}
}
Loading