本文整理汇总了PHP中ConnectionFactory::CreateEngCommandImp方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionFactory::CreateEngCommandImp方法的具体用法?PHP ConnectionFactory::CreateEngCommandImp怎么用?PHP ConnectionFactory::CreateEngCommandImp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionFactory
的用法示例。
在下文中一共展示了ConnectionFactory::CreateEngCommandImp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetUserGrants
/**
* @param int $userId
* @param Captions $captions
* @return array
*/
public function GetUserGrants($userId, Captions $captions)
{
$queryBuilder = new SelectCommand($this->connectionFactory->CreateEngCommandImp());
$queryBuilder->AddField($this->usersTable, $this->users_UserId, FieldType::Number, 'users_user_id');
$queryBuilder->AddField($this->usersTable, $this->users_UserName, FieldType::String, 'users_user_name');
$queryBuilder->AddField($this->userPermsTable, $this->userPerms_UserId, FieldType::Number, 'userperms_user_id');
$queryBuilder->AddField($this->userPermsTable, $this->userPerms_PageName, FieldType::String, 'userperms_pagename');
$queryBuilder->AddField($this->userPermsTable, $this->userPerms_Grant, FieldType::String, 'userperms_grant');
$queryBuilder->SetSourceTableName($this->userPermsTable);
$queryBuilder->AddJoin(JoinKind::LeftOuter, $this->usersTable, 'userperms_user_id', $this->users_UserId);
$queryBuilder->AddFieldFilter('userperms_user_id', new FieldFilter($userId, '='));
$dataset = new QueryDataset($this->connectionFactory, $this->connectionOptions, $queryBuilder->GetSQL(), array(), array(), array(), 'user_grants');
$dataset->AddField(new StringField('userperms_grant'), false);
$dataset->AddField(new StringField('userperms_pagename'), false);
$dataset->Open();
$pages = array();
$pages[''] = array('name' => '', 'caption' => $captions->GetMessageString('Application'), 'selectGrant' => false, 'updateGrant' => false, 'insertGrant' => false, 'deleteGrant' => false, 'adminGrant' => false);
foreach ($this->tableCaptions as $name => $caption) {
$pages[$name] = array('name' => $name, 'caption' => $captions->RenderText($caption), 'selectGrant' => false, 'updateGrant' => false, 'insertGrant' => false, 'deleteGrant' => false, 'adminGrant' => false);
}
while ($dataset->Next()) {
$grant = $dataset->GetFieldValueByName('userperms_grant');
$pageName = $dataset->GetFieldValueByName('userperms_pagename');
if (isset($pages[$pageName])) {
$pages[$pageName]['selectGrant'] = $pages[$pageName]['selectGrant'] || StringUtils::SameText($grant, 'select');
$pages[$pageName]['updateGrant'] = $pages[$pageName]['updateGrant'] || StringUtils::SameText($grant, 'update');
$pages[$pageName]['insertGrant'] = $pages[$pageName]['insertGrant'] || StringUtils::SameText($grant, 'insert');
$pages[$pageName]['deleteGrant'] = $pages[$pageName]['deleteGrant'] || StringUtils::SameText($grant, 'delete');
$pages[$pageName]['adminGrant'] = $pages[$pageName]['adminGrant'] || StringUtils::SameText($grant, 'admin');
}
}
$dataset->Close();
return array_values($pages);
}
示例2: GetCommandImp
/**
* @return EngCommandImp
*/
public function GetCommandImp()
{
if (!isset($this->commandImp)) {
$this->commandImp = $this->connectionFactory->CreateEngCommandImp();
}
return $this->commandImp;
}