summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2009-04-15 20:50:07 +0000
committergodzilla80@gmx.net <>2009-04-15 20:50:07 +0000
commit6761036cbd97fbc7e7f4f260730c486c6b95a299 (patch)
treea95a9bb13fbdf7b87a903af10fbb610c2acde6f5
parent37cd9aec35acd0cd03946fc6f26d7fe02c3c5d48 (diff)
TDbLogRoute::createDbTable: add AUTO_INCREMENT attribute to log_id column if driver is mysql
-rw-r--r--HISTORY1
-rw-r--r--framework/Util/TLogRouter.php15
2 files changed, 12 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index 58774564..d7a6c61d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,5 +1,6 @@
Version 3.1.5 (to be released)
BUG: URL wildcard patterns didn't work with subfolders
+BUG: TDbLogRoute::createDbTable: add AUTO_INCREMENT attribute to log_id column if driver is mysql (Yves)
BUG/ENH: TSqlMapCacheModel now consider <flushInterval> tag as described in doc (sqlmap.pdf) - valid attributes are duration in sec or seconds, minutes, hours, days (Yves)
BUG: Issue#88 - SQLMap $Param$ re-evaluation bug (Yves)
BUG: Issue#120 - TActiveDropDownList PromptText and PromptValue got lost during callback and data rebind (Yves)
diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php
index be6d620a..d37c6896 100644
--- a/framework/Util/TLogRouter.php
+++ b/framework/Util/TLogRouter.php
@@ -97,8 +97,8 @@ class TLogRouter extends TModule
/**
* Adds a TLogRoute instance to the log router.
- *
- * @param TLogRoute $route
+ *
+ * @param TLogRoute $route
* @throws TInvalidDataTypeException if the route object is invalid
*/
public function addRoute($route)
@@ -798,16 +798,23 @@ class TDbLogRoute extends TLogRoute
/**
* Creates the DB table for storing log messages.
+ * @todo create sequence for PostgreSQL
*/
protected function createDbTable()
{
+ $db = $this->getDbConnection();
+ $driver=$db->getDriverName();
+ $autoidAttributes = '';
+ if($driver==='mysql')
+ $autoidAttributes = 'AUTO_INCREMENT';
+
$sql='CREATE TABLE '.$this->_logTable.' (
- log_id INTEGER NOT NULL PRIMARY KEY,
+ log_id INTEGER NOT NULL PRIMARY KEY ' . $autoidAttributes . ',
level INTEGER,
category VARCHAR(128),
logtime VARCHAR(20),
message VARCHAR(255))';
- $this->getDbConnection()->createCommand($sql)->execute();
+ $db->createCommand($sql)->execute();
}
/**