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


PHP SQL::PrepareFieldsForSelect方法代码示例

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


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

示例1: SetSelectValues

 public function SetSelectValues()
 {
     if ($this->TryToApplyUsualScheme()) {
         return;
     }
     $this->CheckSearch();
     $fields = array();
     switch ($this->samplingScheme) {
         case static::REGISTRATION_CHECK_SCHEME:
             $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->idField, $this->GetFieldByName(static::LOGIN_FLD)]);
             break;
         case static::LOGIN_SCHEME:
             $fields = SQL::PrepareFieldsForSelect(static::TABLE, array($this->idField, $this->GetFieldByName(static::PASS_FLD), $this->GetFieldByName(static::SALT_FLD)));
             break;
         case static::PROFILE_INFO_SCHEME:
             $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->idField, $this->GetFieldByName(static::NAME_FLD), $this->GetFieldByName(static::SURNAME_FLD), $this->GetFieldByName(static::PHONE_FLD), $this->GetFieldByName(static::ROOM_FLD), $this->GetFieldByName(static::DESCRIPTION_FLD), $this->GetFieldByName(static::REGISTER_DATE_FLD), $this->GetFieldByName(static::LAST_UPDATE_FLD), $this->GetFieldByName(static::PROFILE_VIEWS_FLD)]);
             $fields[] = ImageWithFlagSelectSQL(static::TABLE, $this->GetFieldByName(static::PHOTO_FLD));
             $fields[] = sprintf("(SELECT get_user_ad_amount_by_id(%s)) as ad_amount", $this->accSelf ? SQL::ToTblNm(Session::TABLE, Session::USER_FLD) : SQL::ToTblNm(static::TABLE, static::ID_FLD));
             break;
         case static::EXTRA_DATA_SCHEME:
             $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->GetFieldByName(static::DESCRIPTION_FLD)]);
             break;
         case static::CONTACT_INFO_SCHEME:
             $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->GetFieldByName(static::ROOM_FLD), $this->GetFieldByName(static::PHONE_FLD)]);
             break;
         case static::NAME_INFO_SCHEME:
             $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->GetFieldByName(static::NAME_FLD), $this->GetFieldByName(static::SURNAME_FLD)]);
             break;
     }
     $this->selectFields = SQL::GetListFieldsForSelect($fields);
 }
开发者ID:koninka,项目名称:Hackathon,代码行数:31,代码来源:class.User.php

示例2: SetSelectValues

 public function SetSelectValues()
 {
     $fields = array();
     $this->CheckSearch();
     switch ($this->samplingScheme) {
         case static::INIT_SCHEME:
             $fields = SQL::PrepareFieldsForSelect(static::TABLE, [$this->idField, $this->GetFieldByName(static::NUMBER_FLD), $this->GetFieldByName(static::POLYGON_FLD), $this->GetFieldByName(static::TYPE_FLD)]);
             $this->initFields = $fields;
             $this->search->AddClause(CCond(CF(static::TABLE, $this->GetFieldByName(static::FLOOR_FLD)), CVP($this->GetFieldByName(static::FLOOR_FLD)->GetValue()), cAND))->AddClause(CCond(CF(static::TABLE, $this->GetFieldByName(static::HOSTEL_FLD)), CVP($this->GetFieldByName(static::HOSTEL_FLD)->GetValue()), cAND, opEQ));
             break;
         case static::AVAILABLE_SCHEME:
             // SELECT
             //    places.id  as places_id,
             //    places.number  as places_number,
             //    places.polygon  as places_polygon,
             //    places.place_type  as places_place_type
             // FROM places
             // WHERE
             //    places.floor = 1 AND
             //    (
             //       (
             //          places.place_type = 1 AND
             //          places.number = (SELECT users.room FROM users INNER JOIN sessions ON sessions.user_id = users.id WHERE sessions.sid = '153382469192f1')
             //       )
             //       OR places.place_type <> 1
             //    )
             $fields = $this->initFields;
             global $_user, $_session;
             $this->search->AddClause(CCond(CF(static::TABLE, $this->GetFieldByName(static::TYPE_FLD)), CVP(1), cAND, opEQ, '(('))->AddClause(CCond(CF(static::TABLE, $this->GetFieldByName(static::NUMBER_FLD)), CVS('(' . SQL::SimpleQuerySelect($_user->ToTblNm(User::ROOM_FLD), sprintf('%s %s', User::TABLE, SQL::MakeJoin(User::TABLE, [Session::TABLE => [null, [User::ID_FLD, Session::USER_FLD]]])), new Clause(CCond(CF(Session::TABLE, $_session->GetFieldByName(Session::SID_FLD)), CVS(sprintf("'%s'", $_SESSION['sid']))))) . ')'), cAND, opEQ, null, ')'))->AddClause(CCond(CF(static::TABLE, $this->GetFieldByName(static::TYPE_FLD)), CVP(1), cOR, opNE, null, ')'));
             break;
     }
     $this->selectFields = SQL::GetListFieldsForSelect($fields);
 }
开发者ID:koninka,项目名称:Hackathon,代码行数:33,代码来源:class.Place.php

示例3: GetBySID

 public function GetBySID($sid)
 {
     $this->CheckSearch();
     $this->selectFields = SQL::GetListFieldsForSelect(SQL::PrepareFieldsForSelect(static::TABLE, [$this->idField, $this->GetFieldByName(static::USER_FLD)]));
     $this->search->AddClause(CCond(CF(static::TABLE, $this->GetFieldByName(static::SID_FLD)), CVP($sid), cAND));
     $result = $this->GetPart();
     $this->search->RemoveClause();
     return $result;
 }
开发者ID:koninka,项目名称:Hackathon,代码行数:9,代码来源:class.Session.php

示例4: SetSelectValues

 public function SetSelectValues()
 {
     $this->selectFields = SQL::GetListFieldsForSelect(SQL::PrepareFieldsForSelect(static::TABLE, array($this->idField, $this->GetFieldByName(static::LOGIN_FLD))));
 }
开发者ID:koninka,项目名称:Hackathon,代码行数:4,代码来源:class.Admin.php

示例5: SetSelectValues

 public function SetSelectValues()
 {
     if ($this->samplingScheme == static::USUAL_SCHEME) {
         $this->selectFields = SQL::GetListFieldsForSelect(SQL::PrepareFieldsForSelect(static::TABLE, $this->fields));
     }
 }
开发者ID:koninka,项目名称:Hackathon,代码行数:6,代码来源:class.Entity.php

示例6: GenQueryForList

 private function GenQueryForList($user_id, $limit, $start = 0)
 {
     global $_user, $_place;
     $fields = SQL::GetListFieldsForSelect(array_merge(SQL::PrepareFieldsForSelect(static::TABLE, [$this->idField, $this->GetFieldByName(static::HEAD_FLD), $this->GetFieldByName(static::CREATION_DATE_FLD), $this->GetFieldByName(static::DUE_DATE_FLD), $this->GetFieldByName(static::TYPE_FLD), $this->GetFieldByName(static::DESCRIPTION_FLD)]), SQL::PrepareFieldsForSelect(User::TABLE, [$_user->idField, $_user->GetFieldByName(User::NAME_FLD), $_user->GetFieldByName(User::SURNAME_FLD), $_user->GetFieldByName(User::PHOTO_FLD)]), SQL::PrepareFieldsForSelect(Place::TABLE, [$_place->GetFieldByName(Place::TYPE_FLD), $_place->GetFieldByName(Place::NUMBER_FLD)])));
     return sprintf('SELECT %s FROM %s %s WHERE %s = %s %s ORDER BY %s DESC LIMIT %d, %d', $fields, static::TABLE, SQL::MakeJoin(static::TABLE, [User::TABLE => [null, [static::OWNER_FLD, User::ID_FLD]], Place::TABLE => [null, [static::PLACE_FLD, Place::ID_FLD]]]), $this->ToTblNm(static::TYPE_FLD), '%d', !empty($user_id) ? sprintf('AND %s = ?', $_user->ToTblNm(User::ID_FLD)) : '', $this->ToTblNm(static::CREATION_DATE_FLD), $start, $limit);
 }
开发者ID:koninka,项目名称:Hackathon,代码行数:6,代码来源:class.Event.php


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