当前位置: 首页>>代码示例>>PHP>>正文


PHP JDatabaseDriver::setQuery方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\EasySocial(\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.name, a.username, ' . 'b.alias, b.permalink, ' . 'c.small, c.medium, c.square, c.large')->from($this->db->quoteName('#__users', 'a'))->leftJoin($this->db->quoteName('#__social_users', 'b') . ' ON a.id = b.user_id')->leftJoin($this->db->quoteName('#__social_avatars', 'c') . ' ON a.id = c.uid')->where('a.id IN ( ' . implode(',', $ids) . ')');
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList('user_id');
     }
 }
开发者ID:ITPrism,项目名称:SocialCommunityDistribution,代码行数:21,代码来源:EasySocial.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\EasySocial(\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.name, a.username, " . "b.alias, b.permalink, " . "c.small, c.medium, c.square, c.large")->from($this->db->quoteName("#__users", "a"))->leftJoin($this->db->quoteName("#__social_users", "b") . " ON a.id = b.user_id")->leftJoin($this->db->quoteName("#__social_avatars", "c") . " ON a.id = c.uid")->where("a.id IN ( " . implode(",", $ids) . ")");
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList("user_id");
     }
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:21,代码来源:EasySocial.php

示例13: 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

示例14: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\SocialCommunity(\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.id AS user_id, a.image_icon, a.image_small, a.image_square, a.image, " . $query->concatenate(array("a.id", "a.alias"), ":") . " AS slug, " . "b.name as location, b.country_code")->from($this->db->quoteName("#__itpsc_profiles", "a"))->leftJoin($this->db->quoteName("#__itpsc_locations", "b") . " ON a.location_id = b.id")->where("a.id IN ( " . implode(",", $ids) . ")");
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList("user_id");
     }
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:22,代码来源:SocialCommunity.php

示例15: load

 /**
  * Load data about profiles from database.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  *
  * $profiles = new Prism\Integration\Profiles\SocialCommunity(\JFactory::getDbo());
  * $profiles->load($ids);
  * </code>
  *
  * @param array $ids
  */
 public function load(array $ids)
 {
     if (count($ids) > 0) {
         // Create a new query object.
         $query = $this->db->getQuery(true);
         $query->select('a.id AS user_id, a.image_icon, a.image_small, a.image_square, a.image, ' . $query->concatenate(array('a.id', 'a.alias'), ':') . ' AS slug, ' . 'b.name as location, b.country_code')->from($this->db->quoteName('#__itpsc_profiles', 'a'))->leftJoin($this->db->quoteName('#__itpsc_locations', 'b') . ' ON a.location_id = b.id')->where('a.id IN ( ' . implode(',', $ids) . ')');
         $this->db->setQuery($query);
         $this->profiles = (array) $this->db->loadObjectList('user_id');
     }
 }
开发者ID:bellodox,项目名称:PrismLibrary,代码行数:22,代码来源:SocialCommunity.php


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