public static function db()
 {
     if (self::$_db === NULL) {
         if (self::$_useDbReplicate === NULL) {
             self::loadCore('db/DooSqlMagic');
             self::$_db = new DooSqlMagic();
         } else {
             self::loadCore('db/DooMasterSlave');
             self::$_db = new DooMasterSlave();
         }
     }
     if (!self::$_db->connected) {
         self::$_db->connect();
     }
     return self::$_db;
 }