/** * Tests the JDatabaseDriver::setDebug method. * * @return void * * @since 12.1 */ public function testSetDebug() { $this->assertThat( $this->db->setDebug(true), $this->isType('boolean'), 'setDebug should return a boolean value containing the previous debug state.' ); }
/** * Get a database object. * * Returns the global {@link JDatabaseDriver} object, only creating it if it doesn't already exist. * * @return JDatabaseDriver * * @see JDatabaseDriver * @since 11.1 */ public static function getDbo() { if (!self::$database) { // Get the debug configuration setting $conf = self::getConfig(); $debug = $conf->get('debug'); self::$database = self::createDbo(); self::$database->setDebug($debug); } return self::$database; }
/** * Method to create a database driver for the Web application. * * @return void * * @since 1.0 */ protected function loadDatabase() { $database = 'sqlite' == $this->get('db_driver') ? APP_PATH_DATA . '/' . $this->get('db_name') : $this->get('db_name'); $this->db = JDatabaseDriver::getInstance(array('driver' => $this->get('db_driver'), 'host' => $this->get('db_host'), 'user' => $this->get('db_user'), 'password' => $this->get('db_pass'), 'database' => $database, 'prefix' => $this->get('db_prefix'))); // Select the database. if ('sqlite' != $this->get('db_driver')) { $this->db->select($this->get('db_name')); } // Set the debug flag. $this->db->setDebug($this->get('debug')); // Set the database to our static cache. JFactory::$database = $this->db; }
/** * Sets debug level * * @param int $level New level * @return int Previous level */ public function debug($level) { return $this->_db->setDebug($level); }
/** * Sets debug level * @param int */ function debug($level) { if (checkJversion() >= 2) { $this->_db->setDebug($level); } else { $this->_db->debug($level); } }