本文整理匯總了PHP中JDatabaseDriver::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP JDatabaseDriver::select方法的具體用法?PHP JDatabaseDriver::select怎麽用?PHP JDatabaseDriver::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JDatabaseDriver
的用法示例。
在下文中一共展示了JDatabaseDriver::select方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadDatabase
/**
* Allows the application to load a custom or default database driver.
*
* @param JDatabaseDriver $driver An optional database driver object. If omitted, the application driver is created.
*
* @return JApplicationBase This method is chainable.
*
* @since 12.1
*/
public function loadDatabase(JDatabaseDriver $driver = null)
{
if ($driver === null) {
$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' => $this->get('db_name'), 'prefix' => $this->get('db_prefix')));
// Select the database.
$this->db->select($this->get('db_name'));
} else {
$this->db = $driver;
}
// Set the database to our static cache.
JFactory::$database = $this->db;
return $this;
}
示例2: loadDatabase
/**
* 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;
}