Fix #3476: Database sessions with Postgres did not work properly

close #4004
This commit is contained in:
Guillaume Smaha
2016-01-15 13:36:05 +01:00
committed by Carsten Brandt
parent 1e1c5b7b05
commit dadd253a20
3 changed files with 21 additions and 1 deletions

View File

@@ -247,7 +247,7 @@ class CDbHttpSession extends CHttpSession
$expire=time()+$this->getTimeout();
$db=$this->getDbConnection();
if($db->getDriverName()=='pgsql')
$data=new CDbExpression("convert_to(".$db->quoteValue($data).", 'UTF8')");
$data=new CDbExpression($db->quoteValueWithType($data, PDO::PARAM_LOB)."::bytea");
if($db->getDriverName()=='sqlsrv' || $db->getDriverName()=='mssql' || $db->getDriverName()=='dblib')
$data=new CDbExpression('CONVERT(VARBINARY(MAX), '.$db->quoteValue($data).')');
if($db->createCommand()->select('id')->from($this->sessionTableName)->where('id=:id',array(':id'=>$id))->queryScalar()===false)