static function getDbConnection()
 {
     if (!CommandCache::$db) {
         if (Yii::app()->params['sqlitecache_commands']) {
             $file = realpath(dirname(__FILE__) . '/../data/') . '/cmdcache.db';
             $init = false;
             if (@(!filesize($file))) {
                 $init = true;
             }
             $db = new CDbConnection('sqlite:' . $file);
             $db->emulatePrepare = true;
             $db->charset = 'utf8';
             $db->schemaCachingDuration = '3600';
             $db->active = true;
             if ($init) {
                 $cmd = $db->createCommand('create table if not exists `command_cache` (' . '`server_id` integer not null, `command` integer not null, `ts` integer not null,' . ' `data` text not null, primary key (`server_id`, `command`))');
                 $cmd->execute();
             }
             CommandCache::$db = $db;
         } else {
             CommandCache::$db = Yii::app()->db;
         }
     }
     return CommandCache::$db;
 }