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


PHP Gpf_SqlBuilder_SelectBuilder::toString方法代码示例

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


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

示例1: getCurrentAvgEurRate

 public function getCurrentAvgEurRate($targetcurrency, Gpf_DateTime_Range $range)
 {
     $sql = new Gpf_SqlBuilder_SelectBuilder();
     $sql->select->add('avg(' . Gpf_Db_Table_CurrencyRates::RATE . ')', Gpf_Db_Table_CurrencyRates::RATE);
     $sql->from->add(Gpf_Db_Table_CurrencyRates::getName());
     $sql->where->add(Gpf_Db_Table_CurrencyRates::SOURCE_CURRENCY, '=', 'EUR');
     $sql->where->add(Gpf_Db_Table_CurrencyRates::TARGET_CURRENCY, '=', $targetcurrency);
     $sql->where->add(Gpf_Db_Table_CurrencyRates::TYPE, '=', Gpf_Db_CurrencyRate::TYPE_DAILY);
     $dateCondition = new Gpf_SqlBuilder_CompoundWhereCondition();
     $coumpoundCondWithin = new Gpf_SqlBuilder_CompoundWhereCondition();
     $coumpoundCondWithin->add(Gpf_Db_Table_CurrencyRates::VALID_FROM, '>=', $range->getFrom()->toDateTime());
     $coumpoundCondWithin->add(Gpf_Db_Table_CurrencyRates::VALID_TO, '<=', $range->getTo()->toDateTime());
     $dateCondition->addCondition($coumpoundCondWithin, 'OR');
     $coumpoundCondBefore = new Gpf_SqlBuilder_CompoundWhereCondition();
     $coumpoundCondBefore->add(Gpf_Db_Table_CurrencyRates::VALID_FROM, '<=', $range->getFrom()->toDateTime());
     $coumpoundCondBefore->add(Gpf_Db_Table_CurrencyRates::VALID_TO, '>=', $range->getFrom()->toDateTime());
     $dateCondition->addCondition($coumpoundCondBefore, 'OR');
     $coumpoundCondAfter = new Gpf_SqlBuilder_CompoundWhereCondition();
     $coumpoundCondAfter->add(Gpf_Db_Table_CurrencyRates::VALID_FROM, '<=', $range->getTo()->toDateTime());
     $coumpoundCondAfter->add(Gpf_Db_Table_CurrencyRates::VALID_TO, '>=', $range->getTo()->toDateTime());
     $dateCondition->addCondition($coumpoundCondAfter, 'OR');
     $sql->where->addCondition($dateCondition);
     Gpf_Log::debug($sql->toString());
     Gpf_Log::debug('Avg rate: ' . $sql->getOneRow()->get(Gpf_Db_Table_CurrencyRates::RATE));
     return $sql->getOneRow()->get(Gpf_Db_Table_CurrencyRates::RATE);
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:26,代码来源:Helper.class.php

示例2: getDefaultCommissionGroup

	private function  getDefaultCommissionGroup() {
		$select = new Gpf_SqlBuilder_SelectBuilder();
		$select->select->add(Pap_Db_Table_CommissionGroups::ID);
		$select->from->add(Pap_Db_Table_CommissionGroups::getName());
		$select->where->add(Pap_Db_Table_CommissionGroups::CAMPAIGN_ID, '=', 'c.campaignid', 'AND', false);
        $select->where->add(Pap_Db_Table_CommissionGroups::IS_DEFAULT, '=', Gpf::YES);
        $select->limit->set(0,1);
		
		return '('.$select->toString().')';
	}
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:10,代码来源:Definition.class.php

示例3: getContent

 protected function getContent()
 {
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('content');
     $selectBuilder->from->add(Gpf_Db_Table_FileContents::getName());
     $selectBuilder->where->add('fileid', '=', $this->file->getFileId());
     $selectBuilder->orderBy->add('contentid', true);
     $sth = $this->createDatabase()->execute($selectBuilder->toString());
     while ($row = $sth->fetchArray()) {
         echo $row['content'];
     }
     return '';
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:13,代码来源:Db.class.php

示例4: toString

 public function toString()
 {
     return '(' . $this->subSelect->toString() . ') ' . $this->alias;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:4,代码来源:SubSelectTable.class.php

示例5: load

 public function load(Gpf_SqlBuilder_SelectBuilder $select)
 {
     $this->init();
     foreach ($select->select->getColumns() as $column) {
         $this->_header->add($column->getAlias());
     }
     $statement = $this->createDatabase()->execute($select->toString());
     while ($rowArray = $statement->fetchRow()) {
         $this->add($rowArray);
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:11,代码来源:PapApi.class.php

示例6: getPendingEmail

 /**
  *
  * @return Gpf_Data_RecordSet
  */
 private function getPendingEmail($outboxids)
 {
     $this->debug('Getting pending email...');
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add('o.' . Gpf_Db_Table_MailOutbox::ID, Gpf_Db_Table_MailOutbox::ID);
     $select->select->add('o.' . Gpf_Db_Table_MailOutbox::RETRY_NR, Gpf_Db_Table_MailOutbox::RETRY_NR);
     $select->select->add('m.*');
     $select->select->add('ma.*');
     $select->from->add(Gpf_Db_Table_MailOutbox::getName(), 'o');
     $select->from->addInnerJoin(Gpf_Db_Table_MailAccounts::getName(), 'ma', 'o.' . Gpf_Db_Table_MailOutbox::MAILACCOUNTID . ' = ma.' . Gpf_Db_Table_MailAccounts::ID);
     $select->from->addInnerJoin(Gpf_Db_Table_Mails::getName(), 'm', 'o.' . Gpf_Db_Table_MailOutbox::MAIL_ID . ' = m.' . Gpf_Db_Table_Mails::ID);
     if (!empty($outboxids)) {
         $select->where->add('o.' . Gpf_Db_Table_MailOutbox::ID, 'IN', $outboxids);
     } else {
         $select->where->add('o.' . Gpf_Db_Table_MailOutbox::ID, 'BETWEEN', $this->task->getWorkingAreaFrom() . ' AND ' . $this->task->getWorkingAreaTo(), 'AND', false);
     }
     //load just mails with status pending
     $select->where->add('o.' . Gpf_Db_Table_MailOutbox::STATUS, '=', Gpf_Db_Table_MailOutbox::STATUS_PENDING);
     // load just mails, which are already scheduled
     $select->where->add('o.' . Gpf_Db_Table_MailOutbox::SCHNEDULET_AT, '<=', $this->createDatabase()->getDateString());
     //if retry number is too high, don't repeat sending
     $select->where->add('o.' . Gpf_Db_Table_MailOutbox::RETRY_NR, '<', Gpf_Db_Table_MailOutbox::MAX_RETRY_NR);
     $this->debug('email select: ' . $select->toString());
     $select->limit->set(0, 1);
     return $select->getAllRows();
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:30,代码来源:OutboxRunner.class.php

示例7: getCustomFields

    private function getCustomFields(Pap_Common_User $user) {
        $customFields = explode(',', Gpf_Settings::get(GetResponseSignup_Config::CUSTOM_DATA_FIELDS));

        $select = new Gpf_SqlBuilder_SelectBuilder();
        $select->select->add(Gpf_Db_Table_FormFields::NAME);
        $select->select->add(Gpf_Db_Table_FormFields::CODE);
        $select->from->add(Gpf_Db_Table_FormFields::getName());

        array_walk($customFields, create_function('&$val', '$val = trim(strtolower($val));'));
        $select->where->add(Gpf_Db_Table_FormFields::CODE, 'IN', $customFields);
        $select->where->add(Gpf_Db_Table_FormFields::FORMID, '=', Pap_Merchants_Config_AffiliateFormDefinition::FORMID);
        $customs = array();
        $x = $select->toString();
        foreach($select->getAllRows() as $row) {
            $customs[] = array(
                'name' => str_replace(' ', '_', Gpf_Lang::_localizeRuntime($row->get(Gpf_Db_Table_FormFields::NAME))),
                'content' => $user->getData(str_replace('data', '', $row->get(Gpf_Db_Table_FormFields::CODE)))
            );
        }
        return $customs;
    }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:21,代码来源:Main.class.php

示例8: getSql

 /**
  * @return String
  */
 protected function getSql(Gpf_SqlBuilder_SelectBuilder $select, $prefix = '')
 {
     return $prefix . $select->toString();
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:7,代码来源:UnionBuilder.class.php

示例9: buildFrom

    protected function buildFrom() {
        $this->_selectBuilder->from->add(Pap_Db_Table_Users::getName(), 'u');
        $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(),
            'gu', 'u.accountuserid=gu.accountuserid AND u.' . Pap_Db_Table_Users::DELETED . ' = \'' . Gpf::NO . '\''.
        ' AND u.' .Pap_Db_Table_Users::TYPE . ' = \'' . Pap_Application::ROLETYPE_AFFILIATE . '\'');
        $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(),
            'au', 'au.authid=gu.authid');

        $this->_selectBuilder->from->addLeftJoin(Pap_Db_Table_Users::getName(),
            'pu', 'u.parentuserid=pu.userid');
        $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_Users::getName(),
            'pgu', 'pu.accountuserid=pgu.accountuserid');
        $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_AuthUsers::getName(),
            'pau', 'pau.authid=pgu.authid');

        $this->_selectBuilder->from->addLeftJoin(Gpf_Db_Table_FieldGroups::getName(),
            'pay', 'pay.fieldgroupid=u.payoutoptionid AND pay.rtype=\'P\' AND pay.rstatus=\'' .
        Gpf_Db_FieldGroup::ENABLED . '\'');


        if ($this->areColumnsRequiredOrInFilter(array('lastlogin', 'loginscount', 'loginsnr'))) {
            $select = new Gpf_SqlBuilder_SelectBuilder();
            $select->select->add('MAX(login)', 'lastlogin');
            $select->select->add('accountuserid');
            $select->select->add('COUNT(*)', 'loginsnr');
            $select->from->add(Gpf_Db_Table_LoginsHistory::getName());
            $select->groupBy->add(Gpf_Db_Table_LoginsHistory::ACCOUNTUSERID);

            $this->_selectBuilder->from->addLeftJoin('('.$select->toString().')',
                    'lo', 'u.' . Gpf_Db_Table_LoginsHistory::ACCOUNTUSERID . '=lo.'.Gpf_Db_Table_LoginsHistory::ACCOUNTUSERID);
        }
        $this->buildStatsFrom();
    }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:33,代码来源:AffiliatesGrid.class.php

示例10: addJoinSelectToSelectBuilder

 /**
  * @param Pap_Stats_Params $statParams
  * @param $tableAlias
  */
 protected function addJoinSelectToSelectBuilder(Gpf_SqlBuilder_SelectBuilder $select, $tableAlias) {
     $this->_selectBuilder->from->addRightJoin('('.$select->toString().')',
                 $tableAlias, $tableAlias.'.'.self::GROUP_COLUMN_ALIAS.'='.$this->mainTablePreffix. '.'. $this->mainTableColumn);
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:8,代码来源:TopUrlGridBase.class.php

示例11: getCountryCodes

 protected function getCountryCodes() {
     $subSelect = new Gpf_SqlBuilder_SelectBuilder();
     $subSelect->select->add('GROUP_CONCAT(DISTINCT ct.'.Pap_Db_Table_CommissionTypes::COUNTRYCODES.')','countrycode');
     $subSelect->from->add(Pap_Db_Table_CommissionTypes::getName(),'ct');
     $subSelect->where->add('ct.'.Pap_Db_Table_CommissionTypes::CAMPAIGNID,'=','c.'.Pap_Db_Table_Campaigns::ID,'AND',false);
     return $subSelect->toString();
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:7,代码来源:CampaignsGrid.class.php

示例12: createChannelsWithEmptyRow

    /**
     * @return String
     */
    protected function createChannelsWithEmptyRow(Gpf_SqlBuilder_SelectBuilder $select) {
        $selectNullRow = new Gpf_SqlBuilder_SelectClause();
        $selectNullRow->add('\'\'', Pap_Db_Table_Channels::ID);
        $selectNullRow->add('\' ' . $this->_('None channel') . '\'', Pap_Db_Table_Channels::NAME);

        return $select->toString() . ' UNION ' . $selectNullRow->toString();
    }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:10,代码来源:ChannelStatsGrid.class.php

示例13: fromSelect

 public function fromSelect(Gpf_SqlBuilder_SelectBuilder $selectBuilder)
 {
     $this->fromSelect = $selectBuilder->toString();
     foreach ($selectBuilder->select->getColumns() as $column) {
         if ($this->table !== null && !$this->table->hasColumn($column->getAlias())) {
             throw new Gpf_Exception('Column ' . $column->getAlias() . " doesn't exist in {$this->tableName}.");
         }
         $i = count($this->columns);
         $this->columns[$i]['column'] = $column->getAlias();
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:11,代码来源:InsertBuilder.class.php

示例14: getAllCount

 public function getAllCount()
 {
     try {
         $select = new Gpf_SqlBuilder_SelectBuilder();
         $select->select->add('count(*)');
         $select->from->addSubselect($this->createSelect(), 's');
         $sth = $this->createDatabase()->execute($select->toString());
         $row = $sth->fetchRow();
         return min(array($row[0], $this->getRecordsPerPage() * 3));
     } catch (Exception $e) {
         return 0;
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:13,代码来源:SearchEngine.class.php

示例15: getCount

 protected function getCount(Gpf_SqlBuilder_SelectBuilder $selectBuilder) {
 	$sth = $this->createDatabase()->execute($selectBuilder->toString());
     return $sth->rowCount();
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:4,代码来源:RichListBoxService.class.php


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