@@ -159,6 +159,14 @@ public function write($sessionId, $data)
159
159
$ mergeStmt ->bindParam (':id ' , $ sessionId , \PDO ::PARAM_STR );
160
160
$ mergeStmt ->bindParam (':data ' , $ encoded , \PDO ::PARAM_STR );
161
161
$ 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
+
162
170
$ mergeStmt ->execute ();
163
171
164
172
return true ;
@@ -224,7 +232,7 @@ private function getMergeSql()
224
232
// DUAL is Oracle specific dummy table
225
233
return "MERGE INTO $ this ->table USING DUAL ON ( $ this ->idCol = :id) " .
226
234
"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 " ;
228
236
case $ this ->con ->getDatabasePlatform () instanceof SQLServer2008Platform:
229
237
// MERGE is only available since SQL Server 2008 and must be terminated by semicolon
230
238
// It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx
0 commit comments