本文整理汇总了PHP中JDatabase类的典型用法代码示例。如果您正苦于以下问题:PHP JDatabase类的具体用法?PHP JDatabase怎么用?PHP JDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JDatabase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getProfileFields
protected function getProfileFields()
{
$settings = $this->loadSettings('facebook');
$fields = array();
$default = array((object) array('id' => 'xyz', 'name' => 'Configure DB Settings First'));
if ($settings->get('db_table') == "") {
return $default;
} else {
if ($settings->get('db_name') != "") {
$options = array();
$options['user'] = $settings->get('db_user');
$options['password'] = $settings->get('db_password');
$options['database'] = $settings->get('db_name');
$dbo = JDatabase::getInstance($options);
} else {
$dbo = JFactory::getDBO();
}
$columns = $dbo->getTableColumns($settings->get('db_table'));
if (!$columns) {
return $default;
}
foreach ($columns as $key => $type) {
$fields[] = (object) array('id' => $key, 'name' => $key);
}
return $fields;
}
}
开发者ID:q0821,项目名称:esportshop,代码行数:27,代码来源:customdb.php
示例2: testTruncateTable
/**
* Tests the JDatabase::truncateTable method.
*
* @return void
*
* @since 12.1
*/
public function testTruncateTable()
{
$this->assertNull(
$this->db->truncateTable('#__dbtest'),
'truncateTable should not return anything if successful.'
);
}
开发者ID:robschley,项目名称:joomla-platform,代码行数:14,代码来源:JDatabaseTest.php
示例3:
/**
* Database object constructor
*
* @param array List of options used to configure the connection
* @since 1.5
* @see JDatabase
*/
function __construct($options)
{
$host = array_key_exists('host', $options) ? $options['host'] : 'localhost';
$user = array_key_exists('user', $options) ? $options['user'] : '';
$password = array_key_exists('password', $options) ? $options['password'] : '';
$database = array_key_exists('database', $options) ? $options['database'] : '';
$prefix = array_key_exists('prefix', $options) ? $options['prefix'] : 'jos_';
$select = array_key_exists('select', $options) ? $options['select'] : true;
// Perform a number of fatality checks, then return gracefully
if (!function_exists('mysql_connect')) {
$this->_errorNum = 1;
$this->_errorMsg = 'The MySQL adapter "mysql" is not available.';
return;
}
// Connect to the server
if (!($this->_connection = @mysql_connect($host, $user, $password, true))) {
$this->_errorNum = 2;
$this->_errorMsg = 'Could not connect to MySQL';
return;
}
// Finalize initialisation
parent::__construct($options);
// select the database
if ($select) {
$this->select($database);
}
}
开发者ID:joebushi,项目名称:joomla,代码行数:34,代码来源:mysql.php
示例4: setUpBeforeClass
public static function setUpBeforeClass()
{
jimport('joomla.database.database');
jimport('joomla.database.table');
// Load the config if available.
@ include_once JPATH_TESTS . '/config.php';
if (class_exists('JTestConfig')) {
$config = new JTestConfig;
}
if (!is_object(self :: $dbo)) {
$options = array (
'driver' => isset ($config) ? $config->dbtype : 'mysql',
'host' => isset ($config) ? $config->host : '127.0.0.1',
'user' => isset ($config) ? $config->user : 'utuser',
'password' => isset ($config) ? $config->password : 'ut1234',
'database' => isset ($config) ? $config->db : 'joomla_ut',
'prefix' => isset ($config) ? $config->dbprefix : 'jos_'
);
self :: $dbo = JDatabase :: getInstance($options);
if (JError :: isError(self :: $dbo)) {
//ignore errors
define('DB_NOT_AVAILABLE', true);
}
}
self :: $database = JFactory :: $database;
JFactory :: $database = self :: $dbo;
}
开发者ID:realityking,项目名称:JAJAX,代码行数:31,代码来源:JoomlaDatabaseTestCase.php
示例5: __construct
function __construct()
{
$params = $this->getParams();
// bridge/phpbb path can be not set or doesn't exist, this would cause errors including configuration files
if (!$params->get('bridge_path') || !JFolder::exists(JPATH_SITE . DS . $params->get('bridge_path')) || !$params->get('phpbb3_path') || !JFolder::exists(JPATH_SITE . DS . $params->get('phpbb3_path'))) {
return;
}
$this->phpbb_path = $params->get('phpbb3_path');
$this->bridge_path = $params->get('bridge_path');
$this->bridge_params = $params;
$this->link_format = $params->get('link_format', 'bridged');
if (!JFile::exists(JPATH_ROOT . DS . $this->phpbb_path . DS . 'config.php')) {
return;
}
//Include the phpBB3 configuration
require JPATH_ROOT . DS . $this->phpbb_path . DS . 'config.php';
// Config is incomplete
if (!isset($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $table_prefix)) {
return;
}
$options = array('driver' => $dbms, 'host' => $dbhost, 'user' => $dbuser, 'password' => $dbpasswd, 'database' => $dbname, 'prefix' => $table_prefix);
$this->phpbb_db =& JDatabase::getInstance($options);
if (JFile::exists(JPATH_ROOT . DS . $this->bridge_path . DS . 'configuration.php')) {
//Include the bridge configuration
require_once JPATH_ROOT . DS . $this->bridge_path . DS . 'includes' . DS . 'helper.php';
//load phpBB3 elements
JForumHelper::loadPHPBB3(JPATH_ROOT . DS . $this->bridge_path);
}
}
开发者ID:skyview059,项目名称:e-learning-website,代码行数:29,代码来源:helper.php
示例6:
/**
* Database object constructor
*
* @param array List of options used to configure the connection
* @since 1.5
* @see JDatabase
*/
function __construct($options)
{
$host = array_key_exists('host', $options) ? $options['host'] : 'localhost';
$user = array_key_exists('user', $options) ? $options['user'] : '';
$password = array_key_exists('password', $options) ? $options['password'] : '';
$database = array_key_exists('database', $options) ? $options['database'] : '';
$prefix = array_key_exists('prefix', $options) ? $options['prefix'] : 'jos_';
$select = array_key_exists('select', $options) ? $options['select'] : true;
// Perform a number of fatality checks, then return gracefully
if (!function_exists('mysql_connect')) {
$this->_errorNum = 1;
$this->_errorMsg = JText::_('JLIB_DATABASE_ERROR_ADAPTER_MYSQL');
return;
}
// Connect to the server
if (!($this->_connection = @mysql_connect($host, $user, $password, true))) {
$this->_errorNum = 2;
$this->_errorMsg = JText::_('JLIB_DATABASE_ERROR_CONNECT_MYSQL');
return;
}
// Finalize initialisation
parent::__construct($options);
// Set sql_mode to non_strict mode
mysql_query("SET @@SESSION.sql_mode = '';", $this->_connection);
// select the database
if ($select) {
$this->select($database);
}
}
开发者ID:akksi,项目名称:jcg,代码行数:36,代码来源:mysql.php
示例7: removeBookings
/**
* удаление информации по бронированию с сайта, вубука и базы Визит-а
*/
public function removeBookings($order_id)
{
$db_local = JDatabase::getInstance(VipLocalApi::getDbConnectOptions());
$db = JFactory::getDBO();
$booking_info = $this->getBookingInfo($db, $order_id);
//echo'<pre>';var_dump($booking_info);echo'</pre>';die;
if (!is_null($booking_info)) {
if ($booking_info['k_zajav'] != 0) {
// удаляем с локального сервера
VipLocalApi::cancelReservation($db_local, $booking_info['k_zajav']);
}
$reservation_code = $booking_info['reservation_code'];
if ($reservation_code == 0) {
$reservation_code = intval($booking_info['wubook_answer']);
}
//echo'<pre>';var_dump($reservation_code);echo'</pre>';die;
if ($reservation_code != 0) {
//отменяем на вубуке
WuBookApi::cancelReservation($reservation_code);
//die;
}
//удаляем с сайта информацию о сроках бронирования
$this->removeBookingInfo($db, $booking_info['id']);
}
//$this->removeOrder($db, $order_id);
//$mainframe = JFactory::getApplication();
//JError::raiseNotice(100, _JSHOP_ORDER_IS_CANCELED);
//$mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=user&task=orders', 1, 1));
}
开发者ID:aldegtyarev,项目名称:vip-kvartira,代码行数:32,代码来源:remove_booking_on_cancel_order.php
示例8: getOptions
/**
* Method to get the list of database options.
*
* This method produces a drop down list of available databases supported
* by JDatabase drivers that are also supported by the application.
*
* @return array The field option objects.
*
* @since 11.3
* @see JDatabase
*/
protected function getOptions()
{
// Initialize variables.
// This gets the connectors available in the platform and supported by the server.
$available = JDatabase::getConnectors();
/**
* This gets the list of database types supported by the application.
* This should be entered in the form definition as a comma separated list.
* If no supported databases are listed, it is assumed all available databases
* are supported.
*/
$supported = $this->element['supported'];
if (!empty($supported)) {
$supported = explode(',', $supported);
foreach ($supported as $support) {
if (in_array($support, $available)) {
$options[$support] = ucfirst($support);
}
}
} else {
foreach ($available as $support) {
$options[$support] = ucfirst($support);
}
}
// This will come into play if an application is installed that requires
// a database that is not available on the server.
if (empty($options)) {
$options[''] = JText::_('JNONE');
}
return $options;
}
开发者ID:jimyb3,项目名称:mathematicalteachingsite,代码行数:42,代码来源:databaseconnection.php
示例9: getMWDBO
/**
* Return a middleware database object
*
* @return mixed
*/
public static function getMWDBO()
{
static $instance;
if (!is_object($instance)) {
$config = Component::params('com_tools');
$enabled = $config->get('mw_on');
if (!$enabled && !App::isAdmin()) {
return null;
}
$options['driver'] = $config->get('mwDBDriver');
$options['host'] = $config->get('mwDBHost');
$options['port'] = $config->get('mwDBPort');
$options['user'] = $config->get('mwDBUsername');
$options['password'] = $config->get('mwDBPassword');
$options['database'] = $config->get('mwDBDatabase');
$options['prefix'] = $config->get('mwDBPrefix');
if ((!isset($options['password']) || $options['password'] == '') && (!isset($options['user']) || $options['user'] == '') && (!isset($options['database']) || $options['database'] == '')) {
$instance = \App::get('db');
} else {
$instance = \JDatabase::getInstance($options);
if ($instance instanceof Exception) {
$instance = \App::get('db');
}
}
}
if ($instance instanceof Exception) {
return null;
}
return $instance;
}
开发者ID:zooley,项目名称:hubzero-cms,代码行数:35,代码来源:utils.php
示例10: getDBInstance
/**
* Get Database Default Settings
*/
static function getDBInstance($driver = null, $host = null, $user = null, $password = null, $dbname = null, $prefix = null)
{
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_jmm');
$dbsettings = $params->get('dbsettings');
if ($dbsettings == 1) {
$driver = $app->getCfg('dbtype');
$host = $params->get('dbhost');
$user = $params->get('dbusername');
$password = $params->get('dbpass');
if (isset($_REQUEST['dbname'])) {
$dbname = JRequest::getVar('dbname');
} else {
$dbname = $params->get('dbname');
}
$prefix = $params->get('dbprefix');
} else {
if (!isset($driver)) {
$driver = $app->getCfg('dbtype');
}
if (!isset($host)) {
$host = $app->getCfg('host');
}
if (!isset($user)) {
$user = $app->getCfg('user');
}
if (!isset($password)) {
$password = $app->getCfg('password');
}
if (!isset($dbname)) {
if (isset($_REQUEST['dbname'])) {
$dbname = JRequest::getVar('dbname');
} else {
$dbname = $app->getCfg('db');
}
}
if (!isset($prefix)) {
$prefix = $app->getCfg('dbprefix');
}
}
/**
* If User Use Custom DB Configuration
*/
$option = array();
$option['driver'] = $driver;
$option['host'] = $host;
$option['user'] = $user;
$option['password'] = $password;
$option['database'] = $dbname;
$option['prefix'] = $prefix;
$db = JDatabase::getInstance($option);
if ($dbname == '') {
$dbLists = self::getDataBaseLists($db);
if (count($dbLists) > 0) {
JFactory::getApplication()->redirect('index.php?option=com_jmm&view=tables&dbname=' . $dbLists[0], 'DataBase Switched to ' . $dbLists[0]);
}
}
return $db;
}
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:62,代码来源:jmmcommon.php
示例11: chekBookingBeforeSave
/**
* отправляется запрос в базу локального сервера для окончательной проверки доступности для бронирования
*/
public function chekBookingBeforeSave(&$order, &$cart)
{
$db_local = JDatabase::getInstance(VipLocalApi::getDbConnectOptions());
$db = JFactory::getDBO();
$user = JFactory::getUser();
$adv_user = JSFactory::getUser();
$adv_user = JSFactory::getTable('usershop', 'jshop');
$adv_user->load($user->id);
$order->country = $adv_user->country;
$order->f_name = $adv_user->f_name;
$order->l_name = $adv_user->l_name;
$order->email = $adv_user->email;
$order->phone = $adv_user->phone;
// echo'<pre>';print_r($user);echo'</pre>';//die;
// echo'<pre>';print_r($adv_user);echo'</pre>';//die;
// echo'<pre>';print_r($order);echo'</pre>';die;
$product_id_local = $cart->products[0]['ean'];
$product_id = $cart->products[0]['product_id'];
$category_id = $cart->products[0]['category_id'];
$booking_date_info = $cart->products[0]['free_attributes_value'];
//$date_from = '31-10-2015';
$date_from = str_replace('/', '-', $booking_date_info[0]->value);
$date_to = str_replace('/', '-', $booking_date_info[1]->value);
//проверяем только локальный сервер, так как на WuBook-е установлена нотификация каждого нового бронирования.
$object_is_free_on_local = $this->chekBookingOnLocal($db_local, $product_id_local, $date_from, $date_to);
//$object_is_free_on_local = true;
//повторно проверяем по базе сайта, чтобы никто не забронил номер пока пользователь "копается"
$object_is_free_on_site = $this->chekBookingOnSite($db, $product_id, $date_from, $date_to);
if ($object_is_free_on_local == true && $object_is_free_on_site == true) {
//заменяем разделитеть даты
$date_from = str_replace('/', '-', $date_from);
$date_to = str_replace('/', '-', $date_to);
// echo'<pre>';print_r($product_id_local);echo'</pre>';//die;
// echo'<pre>';print_r($date_from);echo'</pre>';//die;
// echo'<pre>';print_r($date_to);echo'</pre>';//die;
// echo'<pre>';print_r($order);echo'</pre>';die;
// echo'<pre>';print_r($db_local);echo'</pre>';die;
$k_zajav = VipLocalApi::addBookingOnLocalServer($db_local, $product_id_local, $date_from, $date_to, $order, VipLocalApi::ON_BOOKING_FROM_SITE_PRIM_PREFIX);
//echo'<pre>';var_dump($k_zajav);echo'</pre>';die;
$session = JFactory::getSession();
$session->set("k_zajav", $k_zajav);
} else {
$cart->clear();
$mainframe = JFactory::getApplication();
JError::raiseNotice(100, _JSHOP_OBJECT_IS_ALREADY_BOOKED);
$contextfilter = "jshoping.list.front.product.cat." . $category_id;
$date_from_ = $mainframe->getUserStateFromRequest($contextfilter . 'dfrom', 'dfrom', date('d/m/Y'));
$date_to_ = $mainframe->getUserStateFromRequest($contextfilter . 'dto', 'dto', date('d/m/Y', time() + 60 * 60 * 24));
if ($date_from_ == '') {
$date_from_ = date('d/m/Y');
}
if ($date_to_ == '') {
$date_to_ = date('d/m/Y', time() + 60 * 60 * 24);
}
$mainframe->redirect(SEFLink('index.php?option=com_jshopping&view=category&layout=category&task=view&category_id=' . $category_id . '&dfrom=' . $date_from_ . '&dto=' . $date_to_, 1, 1));
}
}
开发者ID:aldegtyarev,项目名称:vip-kvartira,代码行数:60,代码来源:check_booking_on_confirm_order.php
示例12: exists
/**
* Determines if phpbb exists on the site
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function exists()
{
$file = JPATH_ROOT . '/' . $this->path . '/config.php';
if (!JFile::exists($file)) {
return false;
}
require_once $file;
$options = array('driver' => $dbms, 'host' => $dbhost, 'user' => $dbuser, 'password' => $dbpasswd, 'database' => $dbname, 'prefix' => $table_prefix);
$this->db = JDatabase::getInstance($options);
return true;
}
开发者ID:knigherrant,项目名称:decopatio,代码行数:19,代码来源:client.php
示例13: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @return void
*
* @since 11.1
*/
protected function setUp()
{
@(include_once JPATH_TESTS . '/config_mysql.php');
if (class_exists('JMySQLTestConfig')) {
$config = new JMySQLTestConfig();
} else {
$this->markTestSkipped('There is no mysql test config file present.');
}
$this->object = JDatabase::getInstance(array('driver' => $config->dbtype, 'database' => $config->db, 'host' => $config->host, 'user' => $config->user, 'password' => $config->password));
parent::setUp();
}
开发者ID:GMaup,项目名称:joomla-platform,代码行数:19,代码来源:JDatabaseMySQLTest.php
示例14: array
/**
* Method to get a JDatabase object.
*
* @param string $driver The database driver to use.
* @param string $host The hostname to connect on.
* @param string $user The user name to connect with.
* @param string $password The password to use for connection authentication.
* @param string $database The database to use.
* @param string $prefix The table prefix to use.
* @param boolean $select True if the database should be selected.
*
* @return JDatabase
* @since 1.0
*/
public static function &getDBO($driver, $host, $user, $password, $database, $prefix, $select = true)
{
static $db;
if (!$db) {
// Build the connection options array.
$options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix, 'select' => $select);
// Get a database object.
$db = JDatabase::getInstance($options);
}
return $db;
}
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:25,代码来源:database.php
示例15: __construct
function __construct($options = array(), $driver_options = null)
{
//$this->adapter = \JFactory::getDBO();
$params = array();
$params['driver'] = $options['type'];
$params['host'] = $options['host'];
$params['user'] = $options['user'];
$params['password'] = $options['pass'];
$params['database'] = $options['name'];
$params['prefix'] = $options['prefix'];
$this->adapter = \JDatabase::getInstance($params);
}
开发者ID:vstorm83,项目名称:propertease,代码行数:12,代码来源:joomla.php
示例16: up
/**
* Up
**/
public function up()
{
$rparams = $this->getParams('com_register');
if (!empty($rparams)) {
$values = $rparams->toArray();
$this->db->setQuery("SELECT * FROM `#__extensions` WHERE `type`='component' AND `element`='com_members' LIMIT 1");
if ($data = $this->db->loadAssoc()) {
$component = new \JTableExtension($this->db);
$component->bind($data);
$mparams = new \Hubzero\Config\Registry($component->params);
foreach ($values as $key => $value) {
$mparams->set($key, $value);
}
$component->params = $mparams->toString();
$component->store();
}
}
// Get the default menu identifier
//$this->db->setQuery("SELECT menutype FROM `#__menu` WHERE home='1' LIMIT 1;");
//$menutype = $this->db->loadResult();
$this->db->setQuery("SELECT extension_id FROM `#__extensions` WHERE `type`='component' AND `element`='com_members'");
$component = $this->db->loadResult();
// Check if there's a menu item for com_register
$this->db->setQuery("SELECT id FROM `#__menu` WHERE `alias`='register' AND `path`='register'");
//" AND menutype=" . $this->db->quote($menutype));
if ($id = $this->db->loadResult()) {
// There is!
// So, just update its link
$this->db->setQuery("UPDATE `#__menu` SET `link`='index.php?option=com_members&view=register&layout=create', `component_id`=" . $this->db->quote($component) . " WHERE `id`=" . $this->db->quote($id));
$this->db->query();
} else {
$this->db->setQuery("SELECT menutype FROM `#__menu` WHERE `home`='1' LIMIT 1;");
$menutype = $this->db->loadResult();
$this->db->setQuery("SELECT ordering FROM `#__menu` WHERE `menutype`=" . $this->db->quote($menutype) . " ORDER BY ordering DESC LIMIT 1");
$ordering = intval($this->db->loadResult());
$ordering++;
// No menu item for com_register so we need to create one for the new com_members controler
$query = "INSERT INTO `#__menu` (`id`, `menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `level`, `component_id`, `ordering`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `lft`, `rgt`, `home`, `language`, `client_id`)\n";
$query .= "VALUES ('', '{$menutype}', 'Register', 'register', '', 'register', 'index.php?option=com_members&view=register&layout=create', 'component', 1, 1, 1, {$component}, {$ordering}, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '', 0, 0, 0, '*', 0);";
$this->db->setQuery($query);
$this->db->query();
// If we have the nested set class available, use it to rebuild lft/rgt
if (class_exists('JTableNested') && method_exists('JTableNested', 'rebuild')) {
// Use the MySQL driver for this
$config = \JFactory::getConfig();
$database = \JDatabase::getInstance(array('driver' => 'mysql', 'host' => $config->getValue('host'), 'user' => $config->getValue('user'), 'password' => $config->getValue('password'), 'database' => $config->getValue('db')));
$table = new \JTableMenu($database);
$table->rebuild();
unset($database);
}
}
$this->deleteComponentEntry('register');
}
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:56,代码来源:Migration20140528145010ComRegister.php
示例17: testQuoteName
/**
* Tests the JDatabase::quoteName method.
*
* @return void
*
* @since 11.4
*/
public function testQuoteName()
{
$this->assertThat($this->db->quoteName('test'), $this->equalTo('[test]'), 'Tests the left-right quotes on a string.');
$this->assertThat($this->db->quoteName('a.test'), $this->equalTo('[a].[test]'), 'Tests the left-right quotes on a dotted string.');
$this->assertThat($this->db->quoteName(array('a', 'test')), $this->equalTo(array('[a]', '[test]')), 'Tests the left-right quotes on an array.');
$this->assertThat($this->db->quoteName(array('a.b', 'test.quote')), $this->equalTo(array('[a].[b]', '[test].[quote]')), 'Tests the left-right quotes on an array.');
$this->assertThat($this->db->quoteName(array('a.b', 'test.quote'), array(null, 'alias')), $this->equalTo(array('[a].[b]', '[test].[quote] AS [alias]')), 'Tests the left-right quotes on an array.');
$this->assertThat($this->db->quoteName(array('a.b', 'test.quote'), array('alias1', 'alias2')), $this->equalTo(array('[a].[b] AS [alias1]', '[test].[quote] AS [alias2]')), 'Tests the left-right quotes on an array.');
$this->assertThat($this->db->quoteName((object) array('a', 'test')), $this->equalTo(array('[a]', '[test]')), 'Tests the left-right quotes on an object.');
ReflectionHelper::setValue($this->db, 'nameQuote', '/');
$this->assertThat($this->db->quoteName('test'), $this->equalTo('/test/'), 'Tests the uni-quotes on a string.');
}
开发者ID:raquelsa,项目名称:Joomla,代码行数:19,代码来源:JDatabaseTest.php
示例18: getDB
/**
* Return DB object
* Returns the $database object to trinity
*/
public static function getDB()
{
if (!isset(self::$db)) {
$db = JDatabase::getInstance(self::getDBOptions());
if ($db instanceof Exception) {
jexit('Database Error: ' . (string) $db);
} else {
self::$db = $db;
}
}
return self::$db;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:16,代码来源:jtrinitycoredb.php
示例19: getAllAmount
function getAllAmount(&$params)
{
global $mainframe;
jimport('joomla.database.database');
jimport('joomla.database.table');
$conf =& JFactory::getConfig();
$host = $conf->getValue('config.host');
$driver = $conf->getValue('config.dbtype');
$options = array('driver' => $driver, 'host' => $params->get('dbhost'), 'user' => $params->get('dbuser'), 'password' => $params->get('dbpass'), 'database' => $params->get('dbname'), 'prefix' => "");
$db =& JDatabase::getInstance($options);
$query = "SELECT count(joborder.joborder_id) AS count FROM joborder,extra_field,user,company WHERE field_name LIKE('Job Orders') AND extra_field.data_item_id = joborder.joborder_id AND joborder.status = 'active' AND joborder.entered_by = user.user_id AND joborder.company_id = company.company_id AND joborder.public = '1'";
$db->setQuery($query);
$lists = $db->loadResult();
return $lists;
}
开发者ID:HTApplications,项目名称:OpenCATS,代码行数:15,代码来源:helper.php
示例20: __construct
function __construct()
{
parent::__construct();
//pull settings from admin
$db =& JFactory::getDBO();
$db->setQuery("SELECT * From #__catonesettings limit 1");
$SETTINGS = $db->loadObject();
jimport('joomla.database.database');
jimport('joomla.database.table');
$conf =& JFactory::getConfig();
// TODO: Cache on the fingerprint of the arguments
$driver = $conf->getValue('config.dbtype');
$optionDb = array('driver' => $driver, 'host' => $SETTINGS->OC_Database_host, 'user' => $SETTINGS->OC_Database_Username, 'password' => $SETTINGS->OC_Database_password, 'database' => $SETTINGS->OC_Database_Name, 'prefix' => "");
$this->CatsDb =& JDatabase::getInstance($optionDb);
}
开发者ID:HTApplications,项目名称:OpenCATS,代码行数:15,代码来源:catsone.php
注:本文中的JDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论