File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/Symfony/Component/Messenger/Bridge/Doctrine/Transport Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 18
18
use Doctrine \DBAL \Exception \TableNotFoundException ;
19
19
use Doctrine \DBAL \LockMode ;
20
20
use Doctrine \DBAL \Platforms \MySQLPlatform ;
21
+ use Doctrine \DBAL \Platforms \OraclePlatform ;
21
22
use Doctrine \DBAL \Query \QueryBuilder ;
22
23
use Doctrine \DBAL \Result ;
23
24
use Doctrine \DBAL \Schema \AbstractSchemaManager ;
@@ -183,6 +184,18 @@ public function get(): ?array
183
184
);
184
185
}
185
186
187
+ // Wrap the rownum query in a sub-query to allow writelocks without ORA-02014 error
188
+ if ($ this ->driverConnection ->getDatabasePlatform () instanceof OraclePlatform) {
189
+ $ sql = str_replace ('SELECT a.* FROM ' , 'SELECT a.id FROM ' , $ sql );
190
+
191
+ $ wrappedQuery = $ this ->driverConnection ->createQueryBuilder ()
192
+ ->select ('w.* ' )
193
+ ->from ($ this ->configuration ['table_name ' ], 'w ' )
194
+ ->where ('w.id IN( ' .$ sql .') ' );
195
+
196
+ $ sql = $ wrappedQuery ->getSQL ();
197
+ }
198
+
186
199
// use SELECT ... FOR UPDATE to lock table
187
200
$ stmt = $ this ->executeQuery (
188
201
$ sql .' ' .$ this ->driverConnection ->getDatabasePlatform ()->getWriteLockSQL (),
You can’t perform that action at this time.
0 commit comments