本文整理汇总了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;
}