diff options
author | robocoder <anthon.pang@gmail.com> | 2009-09-18 03:29:27 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2009-09-18 03:29:27 +0400 |
commit | 0494a63c73790b3d62788e3f5f6eefca468ea22b (patch) | |
tree | 471116a26dd71c2a0208dddb94e6fc2931f73318 /core/Tracker/Db.php | |
parent | fd16c9ce87e010d1e5652c362e23ae05b41fd854 (diff) |
fixes #904 - MySQL error codes; unsupported adapters can map these to driver-specific SQLSTATE (see example)
fixes #980 - Piwik Installation support for "MySQL Improved" (mysqli) extension
fixes #984 - Set client connection charset to utf8.
Fixed tracker profiling data not recorded until after report generated.
More refactoring and database abstraction:
- Installation gets a list of adapters instead of hardcoding in the plugin
- checking for database-specific system requirements deferred to the adapter
- error detection moved to adapter but we still use MySQL error codes rather than defining new constants
Note: unit tests don't run with MYSQLI -- Zend Framework's Mysqli adapater doesn't support prepare() yet
git-svn-id: http://dev.piwik.org/svn/trunk@1473 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Tracker/Db.php')
-rw-r--r-- | core/Tracker/Db.php | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/core/Tracker/Db.php b/core/Tracker/Db.php index 6616e74c74..193c1a71a5 100644 --- a/core/Tracker/Db.php +++ b/core/Tracker/Db.php @@ -31,7 +31,7 @@ abstract class Piwik_Tracker_Db * You can then use Piwik::printSqlProfilingReportTracker(); * to display the SQLProfiling report and see which queries take time, etc. */ - public function enableProfiling() + public static function enableProfiling() { self::$profiling = true; } @@ -39,7 +39,7 @@ abstract class Piwik_Tracker_Db /** * Disables the SQL profiling logging. */ - public function disableProfiling() + public static function disableProfiling() { self::$profiling = false; } @@ -121,10 +121,6 @@ abstract class Piwik_Tracker_Db */ public function disconnect() { - if(self::$profiling) - { - $this->recordProfiling(); - } $this->connection = null; } @@ -159,6 +155,14 @@ abstract class Piwik_Tracker_Db } /** + * Return number of affected rows in last query + * + * @param mixed $queryResult Result from query() + * @return int + */ + abstract public function rowCount($queryResult); + + /** * Executes a query, using optional bound parameters. * * @param string Query @@ -176,4 +180,12 @@ abstract class Piwik_Tracker_Db * @return int */ abstract public function lastInsertId(); - } + + /** + * Test error number + * + * @param string $errno + * @return bool True if error number matches; false otherwise + */ + abstract public function isErrNo($errno); +} |