8000 bug #15074 Fixing DbalSessionHandler to work with a Oracle "limitatio… · symfony/symfony@69171d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 69171d4

Browse files
committed
bug #15074 Fixing DbalSessionHandler to work with a Oracle "limitation" or bug? (nuncanada)
This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes #15074). Discussion ---------- Fixing DbalSessionHandler to work with a Oracle "limitation" or bug? | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15050 | License | MIT | Doc PR | Commits ------- c314659 Fixing DbalSessionHandler to work with a Oracle "limitation" or bug?
2 parents 041c489 + c314659 commit 69171d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ public function write($sessionId, $data)
159159
$mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
160160
$mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
161161
$mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT);
162+
163+
//Oracle has a bug that will intermitently happen if you
164+
//have only 1 bind on a CLOB field for 2 different statements
165+
//(INSERT and UPDATE in this case)
166+
if ('oracle' == $this->con->getDatabasePlatform()->getName()) {
167+
$mergeStmt->bindParam(':data2', $encoded, \PDO::PARAM_STR);
168+
}
169+
162170
$mergeStmt->execute();
163171

164172
return true;
@@ -224,7 +232,7 @@ private function getMergeSql()
224232
// DUAL is Oracle specific dummy table
225233
return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ".
226234
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
227-
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time";
235+
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data2, $this->timeCol = :time";
228236
case $this->con->getDatabasePlatform() instanceof SQLServer2008Platform:
229237
// MERGE is only available since SQL Server 2008 and must be terminated by semicolon
230238
// It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx

0 commit comments

Comments
 (0)
0