diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php index 1fe0627c235d8..48592cbab6036 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php @@ -470,6 +470,18 @@ private function executeInsert(string $sql, array $parameters = [], array $types if (!$id) { throw new TransportException('no id was returned by PostgreSQL from RETURNING clause.'); } + } elseif ($this->driverConnection->getDatabasePlatform() instanceof OraclePlatform) { + $sequenceName = 'seq_'.$this->configuration['table_name']; + + $this->driverConnection->executeStatement($sql, $parameters, $types); + + $result = $this->driverConnection->fetchOne('SELECT '.$sequenceName.'.CURRVAL FROM DUAL'); + + $id = (int) $result; + + if (!$id) { + throw new TransportException('no id was returned by Oracle from sequence: '.$sequenceName); + } } else { $this->driverConnection->executeStatement($sql, $parameters, $types); @@ -507,7 +519,7 @@ private function addTableToSchema(Schema $schema): void $table = $schema->createTable($this->configuration['table_name']); // add an internal option to mark that we created this & the non-namespaced table name $table->addOption(self::TABLE_OPTION_NAME, $this->configuration['table_name']); - $table->addColumn('id', Types::BIGINT) + $idColumn = $table->addColumn('id', Types::BIGINT) ->setAutoincrement(true) ->setNotnull(true); $table->addColumn('body', Types::TEXT) @@ -527,6 +539,13 @@ private function addTableToSchema(Schema $schema): void $table->addIndex(['queue_name']); $table->addIndex(['available_at']); $table->addIndex(['delivered_at']); + + // We need to create a sequence for Oracle and set the id column to get the correct nextval + if ($this->driverConnection->getDatabasePlatform() instanceof OraclePlatform) { + $idColumn->setDefault('seq_'.$this->configuration['table_name'].'.nextval'); + + $schema->createSequence('seq_'.$this->configuration['table_name']); + } } private function decodeEnvelopeHeaders(array $doctrineEnvelope): array pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy