本文整理汇总了PHP中Gpf_SqlBuilder_SelectBuilder::getOneRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_SqlBuilder_SelectBuilder::getOneRow方法的具体用法?PHP Gpf_SqlBuilder_SelectBuilder::getOneRow怎么用?PHP Gpf_SqlBuilder_SelectBuilder::getOneRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gpf_SqlBuilder_SelectBuilder
的用法示例。
在下文中一共展示了Gpf_SqlBuilder_SelectBuilder::getOneRow方法的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);
}
示例2: computeCommissions
public function computeCommissions() {
$this->sqlBuilder = new Gpf_SqlBuilder_SelectBuilder();
$this->sqlBuilder->select->add("SUM(".self::TRANSACTION_ALIAS.'.'.Pap_Db_Table_Transactions::COMMISSION.")", self::VALUE);
$this->buildSql();
$record = $this->sqlBuilder->getOneRow();
return $record->get(self::VALUE);
}
示例3: load
/**
* @service pay_affiliate read
* @param $data
*/
public function load(Gpf_Rpc_Params $params) {
$data = new Gpf_Rpc_Data($params);
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add("au.username","userName");
$select->select->add("au.firstname","firstName");
$select->select->add("au.lastname","lastname");
$select->select->add("SUM(t.".Pap_Db_Table_Transactions::COMMISSION.")", "payout");
$select->select->add("pu.".Pap_Db_Table_Users::MINIMUM_PAYOUT, "minimumPayout");
$select->select->add("IFNULL(po.".Gpf_Db_Table_FieldGroups::NAME.", 'undefined')", "payoutMethod");
$select->from->add(Pap_Db_Table_Transactions::getName(), "t");
$select->from->addInnerJoin(Pap_Db_Table_Users::getName(), "pu", "t.userid = pu.userid");
$select->from->addInnerJoin(Gpf_Db_Table_Users::getName(), "gu", "pu.accountuserid = gu.accountuserid");
$select->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), "au", "gu.authid = au.authid");
$select->groupBy->add("t.".Pap_Db_Table_Transactions::USER_ID);
$select->from->addLeftJoin(Gpf_Db_Table_FieldGroups::getName(), "po", "pu.payoutoptionid = po.fieldgroupid");
$select->where->add("t.".Pap_Db_Table_Transactions::USER_ID, "=", $params->get("id"));
$row = $select->getOneRow();
$data->setValue("userName", $row->get("userName"));
$data->setValue("firstName", $row->get("firstName"));
$data->setValue("lastname", $row->get("lastname"));
$data->setValue("payout", $row->get("payout"));
$data->setValue("minimumPayout", $row->get("minimumPayout"));
$data->setValue("payoutMethod", $row->get("payoutMethod"));
return $data;
}
示例4: execute
public function execute() {
$task = new Gpf_Db_Task();
$task->setClassName('Gpf_Mail_OutboxRunner');
$task->loadFromData(array(Gpf_Db_Table_Tasks::CLASSNAME));
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add(Gpf_Db_Table_MailOutbox::ID);
$select->from->add(Gpf_Db_Table_MailOutbox::getName());
$select->orderBy->add(Gpf_Db_Table_MailOutbox::ID);
$select->limit->set(0,1);
try {
$row = $select->getOneRow();
$begining = $row->get(Gpf_Db_Table_MailOutbox::ID);
} catch (Gpf_Exception $e) {
$begining = 1;
}
try {
$task->load();
$task->setParams($begining);
$task->setWorkingAreaFrom($begining);
$task->setWorkingAreaTo(Gpf_Mail_OutboxRunner::MAX_MAIL_WORKERS_COUNT);
$task->update(array(Gpf_Db_Table_Tasks::WORKING_AREA_FROM, Gpf_Db_Table_Tasks::WORKING_AREA_TO, Gpf_Db_Table_Tasks::PARAMS));
} catch (Gpf_Exception $e) {
throw new Gpf_Exception('Cannot update Gpf_Mail_OutboxRunner task to paralel version');
}
}
示例5: load
/**
*
* @service affiliate_stats read
* @param $data
*/
public function load(Gpf_Rpc_Params $params) {
$data = new Gpf_Rpc_Data($params);
$filters = $data->getFilters();
$statsParams = new Pap_Stats_Params();
$statsParams->initFrom($filters);
$transactions = new Pap_Stats_Transactions($statsParams);
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->from->add(Pap_Db_Table_Users::getName(), "pu");
$select->from->addInnerJoin(Gpf_Db_Table_Users::getName(), "gu", "gu.accountuserid = pu.accountuserid");
$select->select->add("SUM(IF(pu.rtype = '". Pap_Application::ROLETYPE_AFFILIATE ."', 1, 0))", "countAffiliates");
$select->select->add("SUM(IF(gu.rstatus = 'A', 1, 0))", "approvedAffiliates");
$select->select->add("SUM(IF(gu.rstatus = 'P', 1, 0))", "pendingAffiliates");
$filters->addTo($select->where);
$select->where->add("pu.".Pap_Db_Table_Users::TYPE, "=", Pap_Application::ROLETYPE_AFFILIATE);
$row = $select->getOneRow();
$data->setValue("countAffiliates", $this->checkNullValue($row->get("countAffiliates")));
$data->setValue("approvedAffiliates", $this->checkNullValue($row->get("approvedAffiliates")));
$data->setValue("pendingAffiliates", $this->checkNullValue($row->get("pendingAffiliates")));
$data->setValue("totalSales", $transactions->getTotalCost()->getAll());
$data->setValue("approvedCommissions", $transactions->getCommission()->getApproved());
$data->setValue("pendingCommissions", $transactions->getCommission()->getPending());
return $data;
}
示例6: isMasterMerchant
private function isMasterMerchant($authId) {
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add(Gpf_Db_Table_Users::ROLEID);
$select->from->add(Gpf_Db_Table_AuthUsers::getName(), 'au');
$select->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'u', 'au.' . Gpf_Db_Table_AuthUsers::ID . '=u.' . Gpf_Db_Table_Users::AUTHID);
$select->where->add('au.' . Gpf_Db_Table_AuthUsers::ID, '=', $authId);
return $select->getOneRow()->get(Gpf_Db_Table_Users::ROLEID) == Pap_Application::DEFAULT_ROLE_MERCHANT;
}
示例7: getLogsCount
private function getLogsCount()
{
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add('count(*)', 'numrows');
$select->from->add(Gpf_Db_Table_Logs::getName());
$row = $select->getOneRow();
return $row->get('numrows');
}
示例8: getChildAffiliateTransactionsCount
protected function getChildAffiliateTransactionsCount($userId){
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add('count('.Pap_Db_Table_Transactions::USER_ID.')','numberOfTransactions');
$select->from->add(Pap_Db_Table_Transactions::getName());
$select->where->add(Pap_Db_Table_Transactions::USER_ID,'=',$userId);
$row = $select->getOneRow();
return $row->get('numberOfTransactions');
}
示例9: getOldestEntry
private function getOldestEntry($table) {
$selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
$selectBuilder->select->add('day');
$selectBuilder->from->add($table);
$selectBuilder->orderBy->add('day');
$selectBuilder->limit->set(0, 1);
$row = $selectBuilder->getOneRow();
return $row->get('day');
}
示例10: getNameFromCode
/**
* @param String $code
* @return String $name
*/
public static function getNameFromCode($code)
{
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add(Gpf_Db_Table_ImportExports::NAME);
$select->from->add(Gpf_Db_Table_ImportExports::getName());
$select->where->add(Gpf_Db_Table_ImportExports::CODE, "=", $code);
$className = $select->getOneRow();
return $className->get(Gpf_Db_Table_ImportExports::NAME);
}
示例11: getBanner
/**
* Returns banner object
*
* @throws Gpf_DbEngine_NoRowException
* @param string $bannerId banner ID
* @return Pap_Common_Banner
*/
public function getBanner($bannerId) {
if ($bannerId == '') {
throw new Pap_Common_Banner_NotFound($bannerId);
}
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->from->add(Pap_Db_Table_Banners::getName());
$select->select->addAll(Pap_Db_Table_Banners::getInstance());
$select->where->add(Pap_Db_Table_Banners::ID, '=', $bannerId);
return $this->getBannerFromRecord($select->getOneRow());
}
示例12: getCount
public function getCount() {
$selectBuilder = $this->getSelect();
$selectBuilder->select->add('i.affiliateid', 'affiliateid');
$selectBuilderCount = new Gpf_SqlBuilder_SelectBuilder();
$selectBuilderCount->select->add('count(*)', 'count');
$selectBuilderCount->from->addSubselect($selectBuilder, 'sub');
$row = $selectBuilderCount->getOneRow();
return $row->get('count');
}
示例13: typeExists
private function typeExists($type)
{
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add('count(' . Gpf_Db_Table_HierarchicalDataNodes::ID . ') as cnt');
$select->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName());
$select->where->add(Gpf_Db_Table_HierarchicalDataNodes::TYPE, '=', $type);
$row = $select->getOneRow();
if ($row->get('cnt') > 0) {
return true;
}
return false;
}
示例14: getUserId
protected function getUserId($username) {
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add('pu.'.Pap_Db_Table_Users::ID, 'id');
$select->from->add(Pap_Db_Table_Users::getName(), 'pu');
$select->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'gu',
'pu.'.Pap_Db_Table_Users::ACCOUNTUSERID.'=gu.'.Gpf_Db_Table_Users::ID);
$select->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'au',
'gu.'.Gpf_Db_Table_Users::AUTHID.'=au.'.Gpf_Db_Table_AuthUsers::ID);
$select->where->add('pu.'.Pap_Db_Table_Users::TYPE, '=', Pap_Application::ROLETYPE_AFFILIATE);
$select->where->add('pu.'.Pap_Db_Table_Users::DELETED, '<>', Gpf::YES);
$select->where->add('au.'.Gpf_Db_Table_AuthUsers::USERNAME, '=', $username);
return $select->getOneRow()->get('id');
}
示例15: loadRow
protected function loadRow(Gpf_DbEngine_Row $row) {
$selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
$selectBuilder->from->add($row->getTable()->name());
$selectBuilder->select->addAll($row->getTable());
foreach ($this->uniqueColumnNames as $columnName=>$value) {
if ($value === false) {
$selectBuilder->where->add($columnName,'=',$row->get($columnName));
continue;
}
$selectBuilder->where->add($columnName,'=',$value);
}
return $selectBuilder->getOneRow();
}