Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Fixes issue 404 that AR would fail when CDbLogRoute uses the same D…

…B connection
  • Loading branch information...
commit 982e2fa72bdf8f4a3c6ea40d4dfcc24ed267c435 1 parent 60fd554
qiang.xue authored
Showing with 11 additions and 12 deletions.
  1. +1 −0  CHANGELOG
  2. +10 −12 framework/logging/CDbLogRoute.php
View
1  CHANGELOG
@@ -7,6 +7,7 @@ Version 1.0.7 to be released
- Bug #372: CCacheHttpSession should initialize cache first before using it (Qiang)
- Bug #388: 'params' options passed to linkButton are not cleared after submit (Qiang)
- Bug #393: Greek language code should be 'el' insead of 'gr' (Qiang)
+- Bug #404: AR would fail when CDbLogRoute uses the same DB connection (Qiang)
- Bug: CMemCache has a typo when using memcached (Qiang)
- Bug: COciCommandBuilder is referencing undefined variable (Qiang)
- Bug: yiic webapp may generate incorrect path to yii.php (Qiang)
View
22 framework/logging/CDbLogRoute.php
@@ -80,19 +80,17 @@ public function init()
$db=$this->getDbConnection();
$db->setActive(true);
- $sql="SELECT * FROM {$this->logTableName} WHERE 0=1";
- try
+ if($this->autoCreateLogTable)
{
- $db->createCommand($sql)->execute();
- }
- catch(Exception $e)
- {
- // The log table does not exist
- if($this->autoCreateLogTable)
+ $sql="DELETE FROM {$this->logTableName} WHERE 0=1";
+ try
+ {
+ $db->createCommand($sql)->execute();
+ }
+ catch(Exception $e)
+ {
$this->createLogTable($db,$this->logTableName);
- else
- throw new CException(Yii::t('yii','CDbLogRoute requires database table "{table}" to store log messages.',
- array('{table}'=>$this->logTableName)));
+ }
}
}
@@ -115,7 +113,7 @@ protected function createLogTable($db,$tableName)
CREATE TABLE $tableName
(
$logID,
- level INTEGER,
+ level VARCHAR(128),
category VARCHAR(128),
logtime INTEGER,
message TEXT
Please sign in to comment.
Something went wrong with that request. Please try again.