當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SwatDB::queryOne方法代碼示例

本文整理匯總了PHP中SwatDB::queryOne方法的典型用法代碼示例。如果您正苦於以下問題:PHP SwatDB::queryOne方法的具體用法?PHP SwatDB::queryOne怎麽用?PHP SwatDB::queryOne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SwatDB的用法示例。


在下文中一共展示了SwatDB::queryOne方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getCommentCount

    protected function getCommentCount()
    {
        $sql = 'select count(1) from BlorgComment
			left outer join BlorgAuthor on BlorgComment.author = BlorgAuthor.id
			where ' . $this->getWhereClause();
        return SwatDB::queryOne($this->app->db, $sql);
    }
開發者ID:nburka,項目名稱:blorg,代碼行數:7,代碼來源:Index.php

示例2: getCommentCount

    protected function getCommentCount()
    {
        $sql = 'select count(1) from PinholeComment
			left outer join PinholePhotographer on PinholeComment.photographer = PinholePhotographer.id
			where ' . $this->getWhereClause();
        return SwatDB::queryOne($this->app->db, $sql);
    }
開發者ID:gauthierm,項目名稱:pinhole,代碼行數:7,代碼來源:Index.php

示例3: processInternal

 protected function processInternal()
 {
     parent::processInternal();
     $pager = $this->ui->getWidget('pager');
     $pager->total_records = SwatDB::queryOne($this->app->db, sprintf('select count(id) from Newsletter where %s', $this->getWhereClause()));
     $pager->process();
 }
開發者ID:GervaisdeM,項目名稱:deliverance,代碼行數:7,代碼來源:Index.php

示例4: hasAttested

    public function hasAttested(CMEFrontMatter $front_matter)
    {
        $this->checkDB();
        $sql = sprintf('select count(1) from AccountAttestedCMEFrontMatter
			where account = %s and front_matter = %s', $this->db->quote($this->id, 'integer'), $this->db->quote($front_matter->id, 'integer'));
        return SwatDB::queryOne($this->db, $sql) > 0;
    }
開發者ID:nrfredrickson,項目名稱:Cme,代碼行數:7,代碼來源:CMEAccount.php

示例5: getVisiblePostCount

    /**
     * Gets the number of visible posts this tag applies to
     *
     * This is more efficient than getting the set of posts and counting the
     * set. Use this method if you don't need the actual post objects.
     *
     * @return integer the number of posts this tag applies to.
     */
    public function getVisiblePostCount()
    {
        $sql = 'select count(id) from BlorgPost
			inner join BlorgPostTagBinding on id = post
			where tag = %s and BlorgPost.enabled = %s';
        return SwatDB::queryOne($this->db, sprintf($sql, $this->db->quote($this->id, 'integer'), $this->db->quote(true, 'boolean')));
    }
開發者ID:nburka,項目名稱:blorg,代碼行數:15,代碼來源:BlorgTag.php

示例6: initStartDate

    protected function initStartDate()
    {
        $oldest_date_string = SwatDB::queryOne($this->app->db, 'select min(complete_date) from InquisitionResponse
			where complete_date is not null
				and inquisition in (select evaluation from AccountCMEProgress)');
        $this->start_date = new SwatDate($oldest_date_string);
        $this->start_date->setTimezone($this->app->default_time_zone);
    }
開發者ID:nrfredrickson,項目名稱:Cme,代碼行數:8,代碼來源:Index.php

示例7: validateShortname

    protected function validateShortname($shortname)
    {
        $instance_id = $this->app->getInstanceId();
        $sql = sprintf('select count(id) from Article
			where shortname = %s and
				instance %s %s and
				parent %s %s
				and id %s %s', $this->app->db->quote($shortname, 'text'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), SwatDB::equalityOperator($this->parent), $this->app->db->quote($this->parent, 'integer'), SwatDB::equalityOperator($this->id, true), $this->app->db->quote($this->id, 'integer'));
        return SwatDB::queryOne($this->app->db, $sql) == 0;
    }
開發者ID:nburka,項目名稱:blorgy,代碼行數:10,代碼來源:Edit.php

示例8: loadData

 protected function loadData()
 {
     $instance_id = $this->app->getInstanceId();
     $where_clause = sprintf('visible = %s and instance %s %s', $this->app->db->quote($this->parent, 'boolean'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
     $order_widget = $this->ui->getWidget('order');
     $order_widget->addOptionsByArray(SwatDB::getOptionArray($this->app->db, 'PinholeMetaData', 'title', 'id', 'displayorder, title', $where_clause));
     $sql = 'select sum(displayorder) from PinholeMetaData where ' . $where_clause;
     $sum = SwatDB::queryOne($this->app->db, $sql, 'integer');
     $options_list = $this->ui->getWidget('options');
     $options_list->value = $sum == 0 ? 'auto' : 'custom';
 }
開發者ID:gauthierm,項目名稱:pinhole,代碼行數:11,代碼來源:Order.php

示例9: initInquisition

    protected function initInquisition()
    {
        parent::initInquisition();
        if (!$this->inquisition instanceof InquisitionInquisition) {
            // if we got here from the question index, load the inquisition
            // from the binding as we only have one inquisition per question
            $sql = sprintf('select inquisition from InquisitionInquisitionQuestionBinding
				where question = %s', $this->app->db->quote($this->question->id));
            $inquisition_id = SwatDB::queryOne($this->app->db, $sql);
            $this->inquisition = $this->loadInquisition($inquisition_id);
        }
    }
開發者ID:nrfredrickson,項目名稱:Cme,代碼行數:12,代碼來源:ImageOrder.php

示例10: processDBData

    protected function processDBData()
    {
        AdminDBDelete::processDBData();
        $instance_id = $this->app->getInstanceId();
        $sql = sprintf('select parent from Article
			where id = %s and instance %s %s', $this->app->db->quote($this->getFirstItem(), 'integer'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        $this->parent_id = SwatDB::queryOne($this->app->db, $sql);
        $item_list = $this->getItemList('integer');
        $sql = sprintf('delete from Article
			where id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        $num = SwatDB::exec($this->app->db, $sql);
        $message = new SwatMessage(sprintf(Site::ngettext('One article has been deleted.', '%s articles have been deleted.', $num), SwatString::numberFormat($num)));
        $this->app->messages->add($message);
    }
開發者ID:nburka,項目名稱:blorgy,代碼行數:14,代碼來源:Delete.php

示例11: getDefaultList

    public static function getDefaultList(SiteApplication $app, SiteInstance $instance = null)
    {
        $default_list = $app->config->mail_chimp->default_list;
        if ($app->hasModule('SiteMultipleInstanceModule') && $app->getInstance() === null) {
            if ($instance === null) {
                throw new DeliveranceException('Instance must be set.');
            }
            $sql = 'select value from InstanceConfigSetting
				where name = %s and instance = %s';
            $sql = sprintf($sql, $app->db->quote('mail_chimp.default_list', 'text'), $app->db->quote($instance->id, 'integer'));
            $default_list = SwatDB::queryOne($app->db, $sql);
        }
        return $default_list;
    }
開發者ID:GervaisdeM,項目名稱:deliverance,代碼行數:14,代碼來源:DeliveranceNewsletter.php

示例12: getTableModel

    protected function getTableModel(SwatView $view)
    {
        $sql = sprintf('select count(id) from BlorgTag where %s', $this->getWhereClause());
        $pager = $this->ui->getWidget('pager');
        $pager->total_records = SwatDB::queryOne($this->app->db, $sql);
        $sql = sprintf('select id, title, shortname
			from BlorgTag
			where %s
			order by %s', $this->getWhereClause(), $this->getOrderByClause($view, 'title'));
        $tags = SwatDB::query($this->app->db, $sql, 'BlorgTagWrapper');
        if (count($tags) > 0) {
            $this->ui->getWidget('results_frame')->visible = true;
            $this->ui->getWidget('results_message')->content = $pager->getResultsMessage(Blorg::_('result'), Blorg::_('results'));
        }
        return $tags;
    }
開發者ID:nburka,項目名稱:blorg,代碼行數:16,代碼來源:Index.php

示例13: loadData

    protected function loadData()
    {
        $instance_id = $this->app->getInstanceId();
        if ($instance_id === null) {
            $where_clause = '1 = 1';
        } else {
            $where_clause = sprintf('instance %s %s', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        }
        $order_widget = $this->ui->getWidget('order');
        $sql = sprintf('select * from BlorgAuthor where %s
			order by displayorder, name', $where_clause);
        $authors = SwatDB::query($this->app->db, $sql, SwatDBClassMap::get('BlorgAuthorWrapper'));
        foreach ($authors as $author) {
            $order_widget->addOption($author->id, $author->name);
        }
        $sql = 'select sum(displayorder) from BlorgAuthor where ' . $where_clause;
        $sum = SwatDB::queryOne($this->app->db, $sql, 'integer');
        $options_list = $this->ui->getWidget('options');
        $options_list->value = $sum == 0 ? 'auto' : 'custom';
    }
開發者ID:GervaisdeM,項目名稱:blorg,代碼行數:20,代碼來源:Order.php

示例14: login

    /**
     * Logs the current session into a {@link SiteAccount}
     *
     * @param string $email the email address of the account to login.
     * @param string $password the password of the account to login.
     *
     * @return boolean true if the session was successfully logged in and false
     *                       if the passphrase is incorrect.
     */
    public function login($passphrase)
    {
        // TODO: should passphrase be salted?
        $passphrase = md5($passphrase);
        $instance = $this->getInstanceId();
        $sql = sprintf('select instance from InstanceConfigSetting
			where instance %s %s and name = %s and value = %s', SwatDB::equalityOperator($instance), $this->app->db->quote($instance, 'integer'), $this->app->db->quote('pinhole.passphrase', 'text'), $this->app->db->quote($passphrase, 'text'));
        $id = SwatDB::queryOne($this->app->db, $sql);
        if ($id !== null) {
            $this->activate();
            if (!isset($this->authenticated_instances) || !$this->authenticated_instances instanceof ArrayObject) {
                $this->authenticated_instances = new ArrayObject();
            }
            $this->authenticated_instances[$this->getInstanceId()] = true;
            $logged_in = true;
        } else {
            $this->logout();
            $logged_in = false;
        }
        return $logged_in;
    }
開發者ID:gauthierm,項目名稱:pinhole,代碼行數:30,代碼來源:PinholeSessionModule.php

示例15: initLastSegments

    protected function initLastSegments()
    {
        for ($rating = 1; $rating <= 5; $rating++) {
            $use_random_start = true;
            if ($this->incremental === true) {
                $sql = sprintf('select value
					from MailingListMemberUpdaterCache
					where rating = %s and field = %s
					order by id desc
					limit 1', $this->db->quote($rating, 'integer'), $this->db->quote($this->field, 'text'));
                $segment = SwatDB::queryOne($this->db, $sql);
                if ($segment !== null) {
                    $use_random_start = false;
                    $this->last_segment[$rating] = $this->getNumericSegment($segment);
                }
            }
            // random the starting last segment, so as to not bias when running
            // incremental updates. is rand() good enough for this?
            if ($use_random_start === true) {
                $this->last_segment[$rating] = rand(0, $this->number_of_segments);
            }
        }
    }
開發者ID:GervaisdeM,項目名稱:deliverance,代碼行數:23,代碼來源:DeliveranceMailChimpListSegmenter.php


注:本文中的SwatDB::queryOne方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。