\Bitrix\Main\DB\Connection::query
?\Bitrix\Main\DB\Result::getSelectedRowsCount
возвращает null.$connection = Application::getConnection();
do {
$query = $connection->query('delete from logs limit 10');
$numberOfRecordsDeleted = $query->getSelectedRowsCount(); // null
} while ($numberOfRecordsDeleted);