[HttpFoundation] use MERGE SQL for MS SQL Server session storage
This commit is contained in:
parent
e58d7cf6c6
commit
05ea19a4bf
@ -227,9 +227,15 @@ class PdoSessionHandler implements \SessionHandlerInterface
|
||||
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) " .
|
||||
"ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)";
|
||||
case 'oci':
|
||||
// DUAL is Oracle specific dummy table
|
||||
return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) " .
|
||||
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) " .
|
||||
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data";
|
||||
case 'sqlsrv':
|
||||
// MS SQL Server requires MERGE be terminated by semicolon
|
||||
return "MERGE INTO $this->table USING (SELECT 'x' AS dummy) AS src ON ($this->idCol = :id) " .
|
||||
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) " .
|
||||
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data;";
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user