本文整理汇总了PHP中queryfx_all函数的典型用法代码示例。如果您正苦于以下问题:PHP queryfx_all函数的具体用法?PHP queryfx_all怎么用?PHP queryfx_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了queryfx_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPage
protected function loadPage()
{
$macro_table = new PhabricatorFileImageMacro();
$conn = $macro_table->establishConnection('r');
$rows = queryfx_all($conn, 'SELECT m.* FROM %T m %Q %Q %Q', $macro_table->getTableName(), $this->buildWhereClause($conn), $this->buildOrderClause($conn), $this->buildLimitClause($conn));
return $macro_table->loadAllFromArray($rows);
}
示例2: loadPage
public function loadPage()
{
$table = new DrydockLease();
$conn_r = $table->establishConnection('r');
$data = queryfx_all($conn_r, 'SELECT lease.* FROM %T lease %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
return $table->loadAllFromArray($data);
}
示例3: loadPage
protected function loadPage()
{
$table = new PhortunePaymentProviderConfig();
$conn = $table->establishConnection('r');
$rows = queryfx_all($conn, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn), $this->buildOrderClause($conn), $this->buildLimitClause($conn));
return $table->loadAllFromArray($rows);
}
示例4: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$offset = $request->getInt('offset', 0);
$pager = new AphrontPagerView();
$pager->setPageSize(250);
$pager->setOffset($offset);
$pager->setURI($request->getRequestURI(), 'offset');
$list = new PhabricatorMetaMTAMailingList();
$conn_r = $list->establishConnection('r');
$data = queryfx_all($conn_r, 'SELECT * FROM %T
ORDER BY name ASC
LIMIT %d, %d', $list->getTableName(), $pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$lists = $list->loadAllFromArray($data);
$rows = array();
foreach ($lists as $list) {
$rows[] = array(phutil_escape_html($list->getName()), phutil_escape_html($list->getEmail()), phutil_render_tag('a', array('class' => 'button grey small', 'href' => $this->getApplicationURI('/edit/' . $list->getID() . '/')), 'Edit'));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Name', 'Email', ''));
$table->setColumnClasses(array(null, 'wide', 'action'));
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader('Mailing Lists');
$panel->setCreateButton('Add New List', $this->getApplicationURI('/edit/'));
$panel->appendChild($pager);
return $this->buildApplicationPage($panel, array('title' => 'Mailing Lists'));
}
示例5: loadPage
public function loadPage()
{
$table = new PhabricatorConduitMethodCallLog();
$conn_r = $table->establishConnection('r');
$data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
return $table->loadAllFromArray($data);
}
示例6: loadPolls
private function loadPolls(AphrontPagerView $pager, $view)
{
$request = $this->getRequest();
$user = $request->getUser();
$poll = new PhabricatorSlowvotePoll();
$conn = $poll->establishConnection('r');
$offset = $pager->getOffset();
$limit = $pager->getPageSize() + 1;
switch ($view) {
case self::VIEW_ALL:
$data = queryfx_all($conn, 'SELECT * FROM %T ORDER BY id DESC LIMIT %d, %d', $poll->getTableName(), $offset, $limit);
break;
case self::VIEW_CREATED:
$data = queryfx_all($conn, 'SELECT * FROM %T WHERE authorPHID = %s ORDER BY id DESC
LIMIT %d, %d', $poll->getTableName(), $user->getPHID(), $offset, $limit);
break;
case self::VIEW_VOTED:
$choice = new PhabricatorSlowvoteChoice();
$data = queryfx_all($conn, 'SELECT p.* FROM %T p JOIN %T o
ON o.pollID = p.id
WHERE o.authorPHID = %s
GROUP BY p.id
ORDER BY p.id DESC
LIMIT %d, %d', $poll->getTableName(), $choice->getTableName(), $user->getPHID(), $offset, $limit);
break;
}
$data = $pager->sliceResults($data);
return $poll->loadAllFromArray($data);
}
示例7: loadPage
protected function loadPage()
{
$table = new NuanceQueue();
$conn = $table->establishConnection('r');
$data = queryfx_all($conn, '%Q FROM %T %Q %Q %Q', $this->buildSelectClause($conn), $table->getTableName(), $this->buildWhereClause($conn), $this->buildOrderClause($conn), $this->buildLimitClause($conn));
return $table->loadAllFromArray($data);
}
示例8: loadPage
public function loadPage()
{
$table = new PhabricatorProject();
$conn_r = $table->establishConnection('r');
// NOTE: Because visibility checks for projects depend on whether or not
// the user is a project member, we always load their membership. If we're
// loading all members anyway we can piggyback on that; otherwise we
// do an explicit join.
$select_clause = '';
if (!$this->needMembers) {
$select_clause = ', vm.dst viewerIsMember';
}
$data = queryfx_all($conn_r, 'SELECT p.* %Q FROM %T p %Q %Q %Q %Q %Q', $select_clause, $table->getTableName(), $this->buildJoinClause($conn_r), $this->buildWhereClause($conn_r), $this->buildGroupClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
$projects = $table->loadAllFromArray($data);
if ($projects) {
$viewer_phid = $this->getViewer()->getPHID();
if ($this->needMembers) {
$etype = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER;
$members = id(new PhabricatorEdgeQuery())->withSourcePHIDs(mpull($projects, 'getPHID'))->withEdgeTypes(array($etype))->execute();
foreach ($projects as $project) {
$phid = $project->getPHID();
$project->attachMemberPHIDs(array_keys($members[$phid][$etype]));
$project->setIsUserMember($viewer_phid, isset($members[$phid][$etype][$viewer_phid]));
}
} else {
foreach ($data as $row) {
$projects[$row['id']]->setIsUserMember($viewer_phid, $row['viewerIsMember'] !== null);
}
}
}
return $projects;
}
示例9: execute
public function execute()
{
$task_table = new PhabricatorWorkerArchiveTask();
$conn_r = $task_table->establishConnection('r');
$rows = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $task_table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
return $task_table->loadAllFromArray($rows);
}
示例10: execute
public function execute()
{
$table = new PhabricatorFlag();
$conn_r = $table->establishConnection('r');
$where = $this->buildWhereClause($conn_r);
$limit = $this->buildLimitClause($conn_r);
$order = $this->buildOrderClause($conn_r);
$data = queryfx_all($conn_r, 'SELECT * FROM %T flag %Q %Q %Q', $table->getTableName(), $where, $order, $limit);
$flags = $table->loadAllFromArray($data);
if ($this->needHandles || $this->needObjects) {
$phids = ipull($data, 'objectPHID');
$query = new PhabricatorObjectHandleData($phids);
if ($this->needHandles) {
$handles = $query->loadHandles();
foreach ($flags as $flag) {
$handle = idx($handles, $flag->getObjectPHID());
if ($handle) {
$flag->attachHandle($handle);
}
}
}
if ($this->needObjects) {
$objects = $query->loadObjects();
foreach ($flags as $flag) {
$object = idx($objects, $flag->getObjectPHID());
if ($object) {
$flag->attachObject($object);
}
}
}
}
return $flags;
}
示例11: executeQuery
protected function executeQuery()
{
$drequest = $this->getRequest();
$repository = $drequest->getRepository();
$commit = $drequest->loadCommit();
$raw_changes = queryfx_all($repository->establishConnection('r'), 'SELECT c.*, p.path pathName, t.path targetPathName
FROM %T c
LEFT JOIN %T p ON c.pathID = p.id
LEFT JOIN %T t on c.targetPathID = t.id
WHERE c.commitID = %d AND isDirect = 1', PhabricatorRepository::TABLE_PATHCHANGE, PhabricatorRepository::TABLE_PATH, PhabricatorRepository::TABLE_PATH, $commit->getID());
$changes = array();
$raw_changes = isort($raw_changes, 'pathName');
foreach ($raw_changes as $raw_change) {
$type = $raw_change['changeType'];
if ($type == DifferentialChangeType::TYPE_CHILD) {
continue;
}
$change = new DiffusionPathChange();
$change->setPath(ltrim($raw_change['pathName'], '/'));
$change->setChangeType($raw_change['changeType']);
$change->setFileType($raw_change['fileType']);
$change->setCommitIdentifier($commit->getCommitIdentifier());
$changes[] = $change;
}
return $changes;
}
示例12: renderListPanel
private function renderListPanel()
{
if (!$this->packagePHID) {
return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle('No package seleted. Please select one from above.');
}
$package = id(new PhabricatorOwnersPackage())->loadOneWhere("phid = %s", $this->packagePHID);
if ($this->view === 'audit' && !$package->getAuditingEnabled()) {
return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle("Package doesn't have auditing enabled. " . "Please choose another one.");
}
$conn_r = id(new PhabricatorOwnersPackageCommitRelationship())->establishConnection('r');
$status_arr = $this->getStatusArr();
$offset = $this->request->getInt('offset', 0);
$pager = new AphrontPagerView();
$pager->setPageSize(50);
$pager->setOffset($offset);
$pager->setURI($this->request->getRequestURI(), 'offset');
$data = queryfx_all($conn_r, 'SELECT commitPHID, auditStatus, auditReasons FROM %T
WHERE packagePHID = %s AND auditStatus in (%Ls)
ORDER BY id DESC
LIMIT %d, %d', id(new PhabricatorOwnersPackageCommitRelationship())->getTableName(), $package->getPHID(), $status_arr, $pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$data = ipull($data, null, 'commitPHID');
$list_panel = $this->renderCommitTable($data, $package);
$list_panel->appendChild($pager);
return $list_panel;
}
示例13: loadPage
protected function loadPage()
{
$table = new PhortuneProduct();
$conn = $table->establishConnection('r');
$rows = queryfx_all($conn, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn), $this->buildOrderClause($conn), $this->buildLimitClause($conn));
$page = $table->loadAllFromArray($rows);
// NOTE: We're loading product implementations here, but also creating any
// products which do not yet exist.
$class_map = mgroup($page, 'getProductClass');
if ($this->refMap) {
$class_map += array_fill_keys(array_keys($this->refMap), array());
}
foreach ($class_map as $class => $products) {
$refs = mpull($products, null, 'getProductRef');
if (isset($this->refMap[$class])) {
$refs += array_fill_keys($this->refMap[$class], null);
}
$implementations = newv($class, array())->loadImplementationsForRefs($this->getViewer(), array_keys($refs));
$implementations = mpull($implementations, null, 'getRef');
foreach ($implementations as $ref => $implementation) {
$product = idx($refs, $ref);
if ($product === null) {
// If this product does not exist yet, create it and add it to the
// result page.
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$product = PhortuneProduct::initializeNewProduct()->setProductClass($class)->setProductRef($ref)->save();
unset($unguarded);
$page[] = $product;
}
$product->attachImplementation($implementation);
}
}
return $page;
}
示例14: loadPage
protected function loadPage()
{
$question = new PonderQuestion();
$conn_r = $question->establishConnection('r');
$data = queryfx_all($conn_r, 'SELECT q.* FROM %T q %Q %Q %Q %Q', $question->getTableName(), $this->buildJoinsClause($conn_r), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
return $question->loadAllFromArray($data);
}
示例15: loadDocuments
private function loadDocuments(AphrontPagerView $pager)
{
// TODO: Do we want/need a query object for this?
$document_dao = new PhrictionDocument();
$content_dao = new PhrictionContent();
$conn = $document_dao->establishConnection('r');
switch ($this->view) {
case 'all':
$data = queryfx_all($conn, 'SELECT * FROM %T ORDER BY id DESC LIMIT %d, %d', $document_dao->getTableName(), $pager->getOffset(), $pager->getPageSize() + 1);
break;
case 'updates':
// TODO: This query is a little suspicious, verify we don't need to key
// or change it once we get more data.
$data = queryfx_all($conn, 'SELECT d.* FROM %T d JOIN %T c ON c.documentID = d.id
GROUP BY c.documentID
ORDER BY MAX(c.id) DESC LIMIT %d, %d', $document_dao->getTableName(), $content_dao->getTableName(), $pager->getOffset(), $pager->getPageSize() + 1);
break;
default:
throw new Exception("Unknown view '{$this->view}'!");
}
$data = $pager->sliceResults($data);
$documents = $document_dao->loadAllFromArray($data);
if ($documents) {
$content = $content_dao->loadAllWhere('documentID IN (%Ld)', mpull($documents, 'getID'));
$content = mpull($content, null, 'getDocumentID');
foreach ($documents as $document) {
$document->attachContent($content[$document->getID()]);
}
}
return $documents;
}