• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP JDatabaseDriver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中JDatabaseDriver的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseDriver类的具体用法?PHP JDatabaseDriver怎么用?PHP JDatabaseDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了JDatabaseDriver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getOptions

 /**
  * Method to get the list of database options.
  *
  * This method produces a drop down list of available databases supported
  * by JDatabaseDriver classes that are also supported by the application.
  *
  * @return  array  The field option objects.
  *
  * @since   11.3
  * @see     JDatabaseDriver::getConnectors()
  */
 protected function getOptions()
 {
     // This gets the connectors available in the platform and supported by the server.
     $available = JDatabaseDriver::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] = JText::_(ucfirst($support));
             }
         }
     } else {
         foreach ($available as $support) {
             $options[$support] = JText::_(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:WineWorld,项目名称:joomlatrialcmbg,代码行数:41,代码来源:databaseconnection.php


示例2: 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;
 }
开发者ID:yatan,项目名称:JiGS-PHP-RPG-engine,代码行数:22,代码来源:cli.php


示例3: getInstance

 /**
  * {@inheritdoc}
  *
  * @param   array $options Configuration options
  *
  * @return JDatabaseDriver
  *
  * @since 1.0
  */
 public static function getInstance($options = array())
 {
     $options['driver'] = isset($options['driver']) ? preg_replace('/[^A-Z0-9_\\.-]/i', '', $options['driver']) : 'mysqli';
     $options['database'] = isset($options['database']) ? $options['database'] : null;
     $options['select'] = isset($options['select']) ? $options['select'] : true;
     // Get an option hash to identify the instance
     $driverSignature = md5(serialize($options));
     // Check if the driver has been already instantiated
     if (empty(self::$instances[$driverSignature])) {
         // If the class doesn't exists, we cannot work with this driver.
         if (!self::isMySQL($options['driver'])) {
             // Let's using parent method
             return parent::getInstance($options);
         }
         // Let's create our driver instance using the options given.s
         try {
             /* @var $instance NenoDatabaseDriverMysqlx */
             $instance = new NenoDatabaseDriverMysqlx($options);
             $instance->refreshTranslatableTables();
         } catch (RuntimeException $ex) {
             throw new RuntimeException(sprintf('Unable to connect to the database. Error: %s', $ex->getMessage()));
         }
         // Save the instance into the instances set.
         self::$instances[$driverSignature] = $instance;
         // Load the tables configured to be translatable
         $instance->refreshTranslatableTables();
     }
     return self::$instances[$driverSignature];
 }
开发者ID:javigomez,项目名称:neno,代码行数:38,代码来源:driver.php


示例4: testTruncateTable

	/**
	 * Tests the JDatabaseDriver::truncateTable method.
	 *
	 * @return  void
	 *
	 * @since   12.1
	 */
	public function testTruncateTable()
	{
		$this->assertNull(
			$this->db->truncateTable('#__dbtest'),
			'truncateTable should not return anything if successful.'
		);
	}
开发者ID:realityking,项目名称:joomla-platform,代码行数:14,代码来源:JDatabaseDriverTest.php


示例5: isValid

 /**
  * Validate project owner.
  *
  * <code>
  * $projectId = 1;
  * $userId = 2;
  *
  * $owner = new Crowdfunding\Validator\Project\Owner(\JFactory::getDbo(), $projectId, $userId);
  * if(!$owner->isValid()) {
  * ......
  * }
  * </code>
  *
  * @return bool
  */
 public function isValid()
 {
     $query = $this->db->getQuery(true);
     $query->select('COUNT(*)')->from($this->db->quoteName('#__crowdf_projects', 'a'))->where('a.id = ' . (int) $this->projectId)->where('a.user_id = ' . (int) $this->userId);
     $this->db->setQuery($query, 0, 1);
     return (bool) $this->db->loadResult();
 }
开发者ID:sis-direct,项目名称:CrowdFunding,代码行数:22,代码来源:Owner.php


示例6: getColumns

 /**
  * Get table columns.
  *
  * @param string $table Table name.
  *
  * @return  array Table columns with type.
  */
 public function getColumns($table)
 {
     if (empty(self::$columnCache[$table])) {
         self::$columnCache[$table] = $this->db->getTableColumns($table);
     }
     return self::$columnCache[$table];
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:14,代码来源:DatabaseCommand.php


示例7: remove

 /**
  * Remove an extra image from database and file system.
  *
  * <code>
  * $imageId = 1;
  * $imagesFolder = "/.../folder";
  *
  * $image   = new CrowdFundingImageRemoverExtra(JFactory::getDbo(), $image, $imagesFolder);
  * $image->remove();
  * </code>
  */
 public function remove()
 {
     // Get the image
     $query = $this->db->getQuery(true);
     $query->select("a.image, a.thumb")->from($this->db->quoteName("#__crowdf_images", "a"))->where("a.id = " . (int) $this->imageId);
     $this->db->setQuery($query);
     $row = $this->db->loadObject();
     if (!empty($row)) {
         // Remove the image from the filesystem
         $file = JPath::clean($this->imagesFolder . DIRECTORY_SEPARATOR . $row->image);
         if (JFile::exists($file)) {
             JFile::delete($file);
         }
         // Remove the thumbnail from the filesystem
         $file = JPath::clean($this->imagesFolder . DIRECTORY_SEPARATOR . $row->thumb);
         if (JFile::exists($file)) {
             JFile::delete($file);
         }
         // Delete the record
         $query = $this->db->getQuery(true);
         $query->delete($this->db->quoteName("#__crowdf_images"))->where($this->db->quoteName("id") . " = " . (int) $this->imageId);
         $this->db->setQuery($query);
         $this->db->execute();
     }
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:36,代码来源:extra.php


示例8: load

 /**
  * This method loads data about e-mail template from a database.
  *
  * <code>
  * $emailId = 1;
  *
  * $email   = new Emailtemplates\Email();
  * $email->setDb(JFactory::getDbo());
  * $email->load($emailId);
  * </code>
  * 
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select('a.id, a.title, a.subject, a.body, a.sender_name, a.sender_email, a.catid')->from($this->db->quoteName('#__emailtemplates_emails', 'a'))->where('a.id = ' . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:21,代码来源:Email.php


示例9: isValid

 /**
  * Validate project owner.
  *
  * <code>
  * $projectId = 1;
  * $userId = 2;
  *
  * $owner = new Crowdfunding\Validator\Project\Owner(\JFactory::getDbo(), $projectId, $userId);
  * if(!$owner->isValid()) {
  * ......
  * }
  * </code>
  *
  * @return bool
  */
 public function isValid()
 {
     $query = $this->db->getQuery(true);
     $query->select("COUNT(*)")->from($this->db->quoteName("#__crowdf_projects", "a"))->where("a.id = " . (int) $this->projectId)->where("a.user_id = " . (int) $this->userId);
     $this->db->setQuery($query, 0, 1);
     $result = $this->db->loadResult();
     return (bool) $result;
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:23,代码来源:Owner.php


示例10: load

 protected function load()
 {
     $query = $this->db->getQuery(true);
     $query->select('a.id, a.name')->from($this->db->quoteName('#__itpsc_countries', 'a'))->order('a.name ASC');
     // Get the options.
     $this->db->setQuery($query);
     $this->data = $this->db->loadAssocList('id', 'name');
 }
开发者ID:ITPrism,项目名称:SocialCommunityDistribution,代码行数:8,代码来源:Countries.php


示例11: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\Gravatar(\JFactory::getDbo());
  * $profiles->load($ids);
  * </code>
  *
  * @param array $ids
  */
 public function load(array $ids)
 {
     if (!empty($ids)) {
         $query = $this->db->getQuery(true);
         $query->select("a.id AS user_id, a.email, MD5(a.email) as hash")->from($this->db->quoteName("#__users", "a"))->where("a.id IN ( " . implode(",", $ids) . ")");
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList("user_id");
     }
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:21,代码来源:Gravatar.php


示例12: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\Gravatar(\JFactory::getDbo());
  * $profiles->load($ids);
  * </code>
  *
  * @param array $ids
  */
 public function load(array $ids)
 {
     if (count($ids) > 0) {
         $query = $this->db->getQuery(true);
         $query->select('a.id AS user_id, a.email, MD5(a.email) as hash')->from($this->db->quoteName('#__users', 'a'))->where('a.id IN ( ' . implode(',', $ids) . ')');
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList('user_id');
     }
 }
开发者ID:ITPrism,项目名称:SocialCommunityDistribution,代码行数:21,代码来源:Gravatar.php


示例13: exists

 /**
  * Is an id exists?
  *
  * @param int|string $id The id to find.
  *
  * @return  boolean True if exists.
  */
 public function exists($id)
 {
     $query = $this->db->getQuery(true);
     $query->select($this->pkName)->from($this->table)->where($query->format('%n = %q', $this->pkName, $id));
     if ($this->db->setQuery($query)->loadResult()) {
         return true;
     }
     return false;
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:16,代码来源:TableHelper.php


示例14: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\JomSocial(\JFactory::getDbo());
  * $profiles->load($ids);
  * </code>
  *
  * @param array $ids
  */
 public function load(array $ids)
 {
     if (count($ids) > 0) {
         $query = $this->db->getQuery(true);
         $query->select('a.userid AS user_id, a.avatar, a.thumb')->from($this->db->quoteName('#__community_users', 'a'))->where('a.userid IN ( ' . implode(',', $ids) . ')');
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList('user_id');
     }
 }
开发者ID:bellodox,项目名称:PrismLibrary,代码行数:21,代码来源:JomSocial.php


示例15: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\JomSocial(\JFactory::getDbo());
  * $profiles->load($ids);
  * </code>
  *
  * @param array $ids
  */
 public function load(array $ids)
 {
     if (!empty($ids)) {
         $query = $this->db->getQuery(true);
         $query->select("a.userid AS user_id, a.avatar, a.thumb")->from($this->db->quoteName("#__community_users", "a"))->where("a.userid IN ( " . implode(",", $ids) . ")");
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList("user_id");
     }
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:21,代码来源:JomSocial.php


示例16: onUserAfterDelete

 /**
  * Remove all address for the user name
  *
  * Method is called after user data is deleted from the database
  *
  * @param   array    $user     Holds the user data
  * @param   boolean  $success  True if user was successfully stored in the database
  * @param   string   $msg      Message
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function onUserAfterDelete($user, $success, $msg)
 {
     if (!$success) {
         return false;
     }
     $query = $this->db->getQuery(true)->delete($this->db->quoteName('#__dogecointipping_address'))->where($this->db->quoteName('user_id') . ' = ' . (int) $user['id']);
     $this->db->setQuery($query)->execute();
     return true;
 }
开发者ID:joomlacn,项目名称:DogecoinTipping,代码行数:22,代码来源:dogecointipping.php


示例17: load

 /**
  * Load country data from database.
  *
  * <code>
  * $countryId = 1;
  *
  * $country   = new CrowdFundingCountry(JFactory::getDbo());
  * $country->load($countryId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.name, a.code, a.code4, a.latitude, a.longitude, a.currency, a.code")->from($this->db->quoteName("#__crowdf_countries", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:22,代码来源:country.php


示例18: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\Kunena(\JFactory::getDbo());
  * $profiles->load($ids);
  * </code>
  *
  * @param array $userIds
  */
 public function load(array $userIds)
 {
     if (count($userIds) > 0) {
         // Create a new query object.
         $query = $this->db->getQuery(true);
         $query->select('a.userid AS user_id, a.avatar')->from($this->db->quoteName('#__kunena_users', 'a'))->where('a.userid IN ( ' . implode(',', $userIds) . ')');
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList('user_id');
     }
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:22,代码来源:Kunena.php


示例19: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\Kunena(\JFactory::getDbo());
  * $profiles->load($ids);
  * </code>
  *
  * @param array $ids
  */
 public function load(array $ids)
 {
     if (!empty($ids)) {
         // Create a new query object.
         $query = $this->db->getQuery(true);
         $query->select("a.userid AS user_id, a.avatar")->from($this->db->quoteName("#__kunena_users", "a"))->where("a.userid IN ( " . implode(",", $ids) . ")");
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList("user_id");
     }
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:22,代码来源:Kunena.php


示例20: load

 /**
  * This method loads data about e-mail template from a database.
  *
  * <code>
  * $emailId = 1;
  *
  * $email   = new UserIdeasEmail();
  * $email->setDb(JFactory::getDbo());
  * $email->load($emailId);
  * </code>
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.subject, a.body, a.sender_name, a.sender_email")->from($this->db->quoteName("#__uideas_emails", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
开发者ID:pippogsm,项目名称:UserIdeas,代码行数:21,代码来源:email.php



注:本文中的JDatabaseDriver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP JDatabaseQuery类代码示例发布时间:2022-05-23
下一篇:
PHP JDatabase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap