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


PHP Query类代码示例

本文整理汇总了PHP中Query的典型用法代码示例。如果您正苦于以下问题:PHP Query类的具体用法?PHP Query怎么用?PHP Query使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: sort

 /**
  * Data retreival
  */
 public function sort(array $fields = array())
 {
     $fields_query = new Query($fields, $this->collection);
     $fields_query->compress();
     $this->native->sort($fields_query->compressed);
     return $this;
 }
开发者ID:marcqualie,项目名称:mongominify,代码行数:10,代码来源:Cursor.php

示例2: updateDate

 function updateDate($catalogue_id, $msgid)
 {
     $q = new Query();
     $q->sql("UPDATE {messages} SET updated_at = NOW() WHERE msgid=? AND catalogue_id=?", $msgid, $catalogue_id)->execute();
     //var_dump($catalogue_id);
     //echo "true";
 }
开发者ID:siran,项目名称:simplepo,代码行数:7,代码来源:message_service.php

示例3: save

 /**
  * Save model data.
  * If model is new PK is null - we generate INSERT SQL request.
  * If model data already exists in DB, PK > 0 - we generate UPDATE request.
  * Method return true if model data saved successfully. False if error.
  */
 public function save($validate = true)
 {
     if ($validate === true && $this->validate() === false) {
         return false;
     }
     $columns = $this->getClearColumns();
     $values = array();
     foreach ($columns as $column) {
         $values[] = $this->{$column};
     }
     $keyPosition = array_search($this->pkColumnName(), $columns);
     array_splice($columns, $keyPosition, 1);
     array_splice($values, $keyPosition, 1);
     if ((int) $this->{$this->pkColumnName()} > 0) {
         $query = new Query("update");
         $query->addTable($this->tableName());
         foreach ($columns as $key => $column) {
             $query->addField($column, $values[$key]);
         }
         $query->where->add($this->pkColumnName() . " = " . $this->{$this->pkColumnName()});
         $result = $query->exec();
     } else {
         $query = new Query("insert");
         $query->addTable($this->tableName());
         foreach ($columns as $key => $column) {
             $query->addField($column, $values[$key]);
         }
         $result = $query->exec();
         $this->ADDRESSID = $query->last_insert_id();
     }
     return $result;
 }
开发者ID:zahar-g,项目名称:small_mvc_frmwrk,代码行数:38,代码来源:Model.php

示例4: filterQuery

 /**
  * Filters a query object
  *
  * @param Query		$query
  * @param Eloquent	$model
  *
  * @return void
  */
 public function filterQuery(&$query, $model)
 {
     //if the field is
     if ($this->value !== '') {
         $query->where($model->table() . '.' . $this->field, '=', $this->value);
     }
 }
开发者ID:ajb,项目名称:rfpez,代码行数:15,代码来源:Bool.php

示例5: testExecuteQueryFailed

 public function testExecuteQueryFailed()
 {
     self::$functions->expects($this->once())->method('ldap_search')->with($this->equalTo('my_ldap_resource'), $this->equalTo('ou=People,dc=kanboard,dc=local'), $this->equalTo('uid=my_user'), $this->equalTo(array('displayname')))->will($this->returnValue(false));
     $query = new Query();
     $query->execute('my_ldap_resource', 'ou=People,dc=kanboard,dc=local', 'uid=my_user', array('displayname'));
     $this->assertFalse($query->hasResult());
 }
开发者ID:Folcky,项目名称:kanboard,代码行数:7,代码来源:QueryTest.php

示例6: matchRelationship

 /**
  * Add clause to match the relationship we want to delete
  *
  * @param IdentityInterface $identity
  * @param $object $entity
  * @param Query  $query
  *
  * @return Query
  */
 private function matchRelationship(IdentityInterface $identity, $entity, Query $query) : Query
 {
     $meta = $this->metadatas->get(get_class($entity));
     $name = $this->name->sprintf(md5($identity->value()));
     $this->variables = $this->variables->add((string) $name);
     return $query->match()->linkedTo()->through((string) $meta->type(), (string) $name)->withProperty($meta->identity()->property(), (string) $name->prepend('{')->append('_identity}'))->withParameter((string) $name->append('_identity'), $identity->value());
 }
开发者ID:innmind,项目名称:neo4j-onm,代码行数:16,代码来源:RemovePersister.php

示例7: Query

 /**
  * Gets the classes whose objects the user can execute certain action
  *
  * @param $action object - The action that the user should be allowed to do
  * @param $user User - The user that holds de permissions
  * @return Array - an array of class objects
  */
 function &findByPermission($action, $user)
 {
     $classQuery = new Query("Class");
     // Navigate relationships
     $folderClassQuery =& $classQuery->queryRelationedClass("FolderClass");
     $permissionQuery =& $folderClassQuery->queryRelationedClass("Permission");
     $actionQuery =& $permissionQuery->queryRelationedClass("Action", Relationship::ManyToOneType());
     $roleQuery =& $permissionQuery->queryRelationedClass("Role", Relationship::ManyToOneType());
     $roleUserQuery =& $roleQuery->queryRelationedClass("RoleUser");
     $userQuery =& $roleUserQuery->queryRelationedClass("User", Relationship::ManyToOneType());
     // Criterias
     $criteriaGroup = new CriteriaGroup();
     $actionCriteria = new Criteria($actionQuery, "action", $action->getAction());
     $userCriteria = new Criteria($userQuery, "ID", $user->getId());
     $criteriaGroup->addCriterion($actionCriteria);
     $criteriaGroup->addCriterion($userCriteria);
     $classQuery->setCriterion($criteriaGroup);
     // sorting
     $order = new Order($classQuery, "title", "ASC");
     $classQuery->addOrder($order);
     // Execute the query
     $recordset =& $classQuery->execute();
     $array = $this->mapAll($recordset);
     return $array;
 }
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:32,代码来源:baseClassMapper.php

示例8: setContent

 /**
  * Inenhåller menun som passar till Art
  * subkategprierna ordnas efter orderNo i matrushkan.
  */
 public function setContent()
 {
     $q = new Query("matruschkaShowAtPlaces");
     $q->showAt($this->title, $this->m->lang, "msapOrderNo", "ASC", 100);
     $i = 1;
     while ($row = mysql_fetch_object($q->getResult())) {
         $this->content .= '<div class="leftMenu">';
         $this->content .= '<span class="subSecTitle">' . $row->mButtonTitle . '</span>';
         $qq = new Query("matruschka");
         $qq->whereCustom("mButtonTitle, mRowid", "mParent = '" . $row->mRowid . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'  ", "mOrderNo", "ASC", 0);
         if ($qq->getNumRows()) {
             // om det finns nån som har denna som parent
             $this->content .= '<div class="subSection">';
             while ($row2 = mysql_fetch_object($qq->getResult())) {
                 /** Svart om aktiv **/
                 if ($this->getActive($this->m->ID, $row2->mRowid) == 1) {
                     $this->content .= '<span  class="sideMenuActive"><a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . '</a></span><br/>';
                 } else {
                     $this->content .= '<a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . '</a><br/>';
                 }
             }
             $this->content .= '</div>';
         }
         $this->content .= '</div>';
         if ($i != $q->getNumRows()) {
             $this->content .= '<img src="' . Settings::$graphics . 'stripes.gif" />' . "\n";
         }
         $i++;
     }
 }
开发者ID:rocafuerte,项目名称:standard2,代码行数:34,代码来源:ItaMenu.class.php

示例9: add_error

 function add_error($_id)
 {
     $c = new Query();
     $c->where_eq('id', $_id);
     $c->value('error_cnt', 'error_cnt+1', true);
     $this->update($c);
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:7,代码来源:model.php

示例10: check

 function check($_type)
 {
     $c = new Query();
     $c->where_eq("name", $_type);
     $res = $this->fetch_one("id", $c);
     return $res;
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:7,代码来源:Event_type.php

示例11: __construct

 public function __construct($settings)
 {
     $query = new Query($settings, array('xtimes' => 1, 'ytimes' => 1));
     $query->acceptInteger('xtimes', '/^[1-9][0-9]*$/');
     $query->acceptInteger('ytimes', '/^[1-9][0-9]*$/');
     $this->settings = $query->results();
 }
开发者ID:psychoticmeowArchives,项目名称:Imaje,代码行数:7,代码来源:tile.php

示例12: getData

 /**
  * get an array of data to use in the response
  * @param Query $query the query to use to retrieve the data
  * @param Paginator $paginator
  * @param array $additionalData an associative array of data to merge with the data array
  */
 protected function getData($query, $additionalData = array())
 {
     //use this hook to alter the parameters
     $paginator = null;
     if (Input::get('page') || $this->paginate) {
         $beforePagination = Event::fire('before.pagination', array(&$query));
         //check if $object is a model or a relation
         $model = $query->getModel();
         $model = method_exists($model, 'getRelated') ? $model->getRelated() : $model;
         $perPage = Input::get('pp') ?: $model->getPerPage();
         $paginator = $query->paginate($perPage);
         //preserve the url query in the paginator
         $paginator->appends(Input::except('page'));
     }
     $results = isset($paginator) ? $paginator->getCollection() : $query->get();
     $data = array();
     $data[$this->resultsKey] = $this->isAjaxRequest() ? $results->toArray() : $results;
     $data['total'] = isset($paginator) ? $paginator->getTotal() : $data->{$this->resultsKey}->count();
     if ($paginator) {
         $data['paginator'] = $paginator;
     }
     if (is_array($additionalData)) {
         $data = array_merge($data, $additionalData);
     }
     return $data;
 }
开发者ID:whitegolem,项目名称:laracrud,代码行数:32,代码来源:CrudController.php

示例13: setContent

 public function setContent()
 {
     $q = new Query("matruschkaShowAtPlaces");
     $q->showAt("Menubar", $this->m->lang, "mOrderNo", "ASC", 10);
     $a = array();
     $i = 0;
     while ($row = mysql_fetch_object($q->getResult())) {
         // Get the id and image
         $a[$i][0] = $row->mRowid;
         $a[$i][1] = $row->mButtonTitle;
         $a[$i][2] = $row->mButtonImage;
         $i++;
     }
     for ($i = 0; $i < count($a); $i++) {
         $im = split(',', $a[$i][2]);
         $this->content .= '<span class="menuItem">' . "\n";
         $this->content .= "<a href=\"?ID=" . $a[$i][0] . "\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('" . $im[1] . "','','" . Settings::$graphics . "menu/" . $this->m->lang . "/" . $im[1] . "',1)\">";
         // Den man är inne på blir röd
         $image = $this->getActive($this->m->ID, $a[$i][0]) ? $im[1] : $im[0];
         $this->content .= '<img src="' . Settings::$graphics . 'menu/' . $this->m->lang . '/' . $image . '" alt="' . $im[1] . '" name="' . $im[1] . '"  border="0" id="' . $im[1] . '" />';
         $this->content .= '</a>';
         if ($i < count($a) - 1) {
             $this->content .= '<img src="' . Settings::$graphics . 'menu/' . $this->m->lang . '/stripe.gif" width="7" height="12" />';
         }
         $this->content .= "</span>\n";
     }
 }
开发者ID:rocafuerte,项目名称:standard2,代码行数:27,代码来源:SiteMenubar.class.php

示例14: edit

 function edit($_id, $_state)
 {
     $c = new Query();
     $c->value("visible", $_state);
     $c->where_eq("id", $_id);
     $this->update($c);
 }
开发者ID:byyeong,项目名称:dc2016,代码行数:7,代码来源:Member_grade.php

示例15: startQuery

 public function startQuery($sql, $parameters = null, $stack = array())
 {
     if (!$this->enabled) {
         return null;
     }
     // try to detect the query type
     switch (strtolower(substr(ltrim($sql), 0, 6))) {
         case 'select':
             $queryType = static::SELECT;
             break;
         case 'insert':
             $queryType = static::INSERT;
             break;
         case 'update':
             $queryType = static::UPDATE;
             break;
         case 'delete':
             $queryType = static::DELETE;
             break;
         default:
             $queryType = static::QUERY;
             break;
     }
     $profile = new Query($sql, $queryType, $parameters, $stack);
     $this->profiles[] = $profile;
     $profile->start();
     end($this->profiles);
     return key($this->profiles);
 }
开发者ID:Baft,项目名称:Zend-Form,代码行数:29,代码来源:Profiler.php


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