• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CDBResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetLastByID

	public static function GetLastByID($ID)
	{
		$DB = CDatabase::GetModuleConnection('statistic');
		$ID = intval($ID);
		if($ID>0)
		{
			$strSql = "
				SELECT
					G.ID,
					G.FAVORITES,
					G.LAST_USER_ID,
					A.ID as LAST_ADV_ID,
					if(to_days(curdate())=to_days(G.LAST_DATE), 'Y', 'N') LAST
				FROM b_stat_guest G
				LEFT JOIN b_stat_adv A ON A.ID = G.LAST_ADV_ID
				WHERE G.ID='$ID'
				";
			$res = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		}
		else
		{
			$res = new CDBResult;
			$res->InitFromArray(array());
		}
		return $res;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:26,代码来源:guest.php


示例2: getData

 /** @return \CDBResult */
 public function getData()
 {
     $groupId = $this->getFieldValue('GROUP_ID', null);
     $dateRegister = $this->getFieldValue('DATE_REGISTER', null);
     $active = $this->getFieldValue('ACTIVE', null);
     $filter = array();
     if ($groupId) {
         $filter['GROUP_ID'] = $groupId;
     }
     if (strlen($dateRegister) > 0) {
         if (\Bitrix\Main\Type\Date::isCorrect($dateRegister)) {
             $dateRegister = new \Bitrix\Main\Type\Date($dateRegister);
             $filter['><USER.DATE_REGISTER'] = array($dateRegister->toString(), $dateRegister->add('1 DAY')->toString());
         } else {
             $result = new \CDBResult();
             $result->InitFromArray(array());
             return $result;
         }
     }
     if ($active == 'Y') {
         $filter['USER.ACTIVE'] = $active;
     } elseif ($active == 'N') {
         $filter['USER.ACTIVE'] = $active;
     }
     $userDb = \Bitrix\Main\UserGroupTable::getList(array('select' => array('NAME' => 'USER.NAME', 'EMAIL' => 'USER.EMAIL', 'USER_ID'), 'filter' => $filter, 'group' => array('NAME', 'EMAIL', 'USER_ID'), 'order' => array('USER_ID' => 'ASC')));
     return new \CDBResult($userDb);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:28,代码来源:senderconnector.php


示例3: GetNotifyList

 public function GetNotifyList($arParams)
 {
     global $DB;
     $iNumPage = 1;
     if (isset($arParams['PAGE']) && intval($arParams['PAGE']) > 0) {
         $iNumPage = intval($arParams['PAGE']);
     }
     $bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N' ? false : true;
     $sqlStr = "\n\t\t\tSELECT COUNT(M.ID) as CNT\n\t\t\tFROM b_im_relation R\n\t\t\tINNER JOIN b_im_message M ON M.NOTIFY_READ = 'Y' AND M.CHAT_ID = R.CHAT_ID\n\t\t\tWHERE R.USER_ID = " . $this->user_id . " AND R.MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "'\n\t\t";
     $res_cnt = $DB->Query($sqlStr);
     $res_cnt = $res_cnt->Fetch();
     $cnt = $res_cnt["CNT"];
     $arNotify = array();
     if ($cnt > 0) {
         if (!$bTimeZone) {
             CTimeZone::Disable();
         }
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tM.ID,\n\t\t\t\t\tM.CHAT_ID,\n\t\t\t\t\tM.MESSAGE,\n\t\t\t\t\tM.MESSAGE_OUT,\n\t\t\t\t\t" . $DB->DateToCharFunction('M.DATE_CREATE') . " DATE_CREATE,\n\t\t\t\t\tM.NOTIFY_TYPE,\n\t\t\t\t\tM.NOTIFY_MODULE,\n\t\t\t\t\tM.NOTIFY_TITLE,\n\t\t\t\t\tM.NOTIFY_BUTTONS,\n\t\t\t\t\tM.NOTIFY_TAG,\n\t\t\t\t\tM.NOTIFY_SUB_TAG,\n\t\t\t\t\tM.NOTIFY_READ,\n\t\t\t\t\tR.LAST_ID,\n\t\t\t\t\tR.USER_ID TO_USER_ID,\n\t\t\t\t\tM.AUTHOR_ID FROM_USER_ID\n\t\t\t\tFROM b_im_relation R\n\t\t\t\tINNER JOIN b_im_message M ON M.NOTIFY_READ = 'Y' AND M.CHAT_ID = R.CHAT_ID\n\t\t\t\tWHERE R.USER_ID = " . $this->user_id . " AND R.MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "'\n\t\t\t\tORDER BY M.DATE_CREATE DESC, ID DESC\n\t\t\t";
         if (!$bTimeZone) {
             CTimeZone::Enable();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, array('iNumPage' => $iNumPage, 'nPageSize' => 20));
         while ($arRes = $dbRes->Fetch()) {
             if ($this->bHideLink) {
                 $arRes['HIDE_LINK'] = 'Y';
             }
             $arNotify[$arRes['ID']] = self::GetFormatNotify($arRes);
         }
     }
     return $arNotify;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:32,代码来源:im_notify.php


示例4: GetAdvGuestHost

	public static function GetAdvGuestHost($ADV_ID, $GUEST_ID, $IP_NUMBER, $BACK="")
	{
		$err_mess = "File: ".__FILE__."<br>Line: ";
		$DB = CDatabase::GetModuleConnection('statistic');
		$ADV_ID = intval($ADV_ID);
		$GID = intval($GUEST_ID);

		$strSql = "
			SELECT
				count(1) ADV_HOSTS,
				".$DB->DateToCharFunction("max(DATE_HOST_HIT)","SHORT")." MAX_DATE_HOST_HIT
			FROM	b_stat_adv_guest
			WHERE	ADV_ID=$ADV_ID and IP_NUMBER='".$DB->ForSQL($IP_NUMBER)."'
			$BACK
		";
		$rsResult=$DB->Query($strSql, false, $err_mess.__LINE__);
		if(!($arHost = $rsResult->Fetch()))
			$arHost = array("ADV_HOSTS"=>0,"MAX_DATE_HOST_HIT"=>false);

		$strSql = "
			SELECT
				count(1) ADV_GUESTS,
				".$DB->DateToCharFunction("max(DATE_GUEST_HIT)","SHORT")." MAX_DATE_GUEST_HIT
			FROM	b_stat_adv_guest
			WHERE	ADV_ID=$ADV_ID and GUEST_ID=$GID
			$BACK
		";
		$rsResult=$DB->Query($strSql, false, $err_mess.__LINE__);
		if(!($arGuest = $rsResult->Fetch()))
			$arGuest = array("ADV_GUESTS"=>0,"MAX_DATE_GUEST_HIT"=>false);

		$rsResult = new CDBResult;
		$rsResult->InitFromArray(array(array_merge($arGuest,$arHost)));
		return $rsResult;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:35,代码来源:statistic.php


示例5: NavQuery

 function NavQuery($arNavParams, $arQuerySelect, $strTableName, $strQueryWhere, $arQueryOrder)
 {
     global $DB;
     if (IntVal($arNavParams["nTopCount"]) <= 0) {
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tcount(1) C\n\t\t\t\tFROM\n\t\t\t\t\t" . $strTableName . " t\n\t\t\t";
         if ($strQueryWhere) {
             $strSql .= "\n\t\t\t\t\tWHERE\n\t\t\t\t\t" . $strQueryWhere . "\n\t\t\t\t";
         }
         $res_cnt = $DB->Query($strSql);
         $res_cnt = $res_cnt->Fetch();
         $cnt = $res_cnt["C"];
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t" . implode(", ", $arQuerySelect) . "\n\t\t\t\tFROM\n\t\t\t\t\t" . $strTableName . " t\n\t\t\t";
         if ($strQueryWhere) {
             $strSql .= "\n\t\t\t\t\tWHERE\n\t\t\t\t\t" . $strQueryWhere . "\n\t\t\t\t";
         }
         if (count($arQueryOrder) > 0) {
             $strSql .= "\n\t\t\t\t\tORDER BY\n\t\t\t\t\t" . implode(", ", $arQueryOrder) . "\n\t\t\t\t";
         }
         $res = new CDBResult();
         $res->NavQuery($strSql, $cnt, $arNavParams);
         return $res;
     } else {
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t" . implode(", ", $arQuerySelect) . "\n\t\t\t\tFROM\n\t\t\t\t\t" . $strTableName . " t\n\t\t\t";
         if ($strQueryWhere) {
             $strSql .= "\n\t\t\t\t\tWHERE\n\t\t\t\t\t" . $strQueryWhere . "\n\t\t\t\t";
         }
         if (count($arQueryOrder) > 0) {
             $strSql .= "\n\t\t\t\t\tORDER BY\n\t\t\t\t\t" . implode(", ", $arQueryOrder) . "\n\t\t\t\t";
         }
         return $DB->Query($DB->TopSql($strSql, intval($arNavParams["nTopCount"])));
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:table.php


示例6: GetDropDown

	public static function GetDropDown($type="C", $siteID=false, $sla_id=false)
	{
		$err_mess = (CAllTicketDictionary::err_mess())."<br>Function: GetDropDown<br>Line: ";
		global $DB;
		if ($siteID==false || $siteID=="all")
		{
			$siteID = "";
		}
		$arFilter = array("TYPE" => $type, "SITE" => $siteID);
		$v2 = $v3 = null;
		$rs = CTicketDictionary::GetList(($v1="s_dropdown"), $v2, $arFilter, $v3);
		
		$oldFunctionality = COption::GetOptionString( "support", "SUPPORT_OLD_FUNCTIONALITY", "Y" );
		if( intval( $sla_id ) <= 0 || $oldFunctionality != "Y" || ( $type != "C" && $type!="K" && $type!="M" ) ) return $rs;
		
		switch($type)
		{
			case "C": $strSql = "SELECT CATEGORY_ID as DID FROM b_ticket_sla_2_category WHERE SLA_ID=" . intval( $sla_id ); break;
			case "K": $strSql = "SELECT CRITICALITY_ID as DID FROM b_ticket_sla_2_criticality WHERE SLA_ID=" . intval( $sla_id ); break;
			case "M": $strSql = "SELECT MARK_ID as DID FROM b_ticket_sla_2_mark WHERE SLA_ID=" . intval( $sla_id ); break;
		}
		$r = $DB->Query( $strSql, false, $err_mess . __LINE__ );
		while( $a = $r->Fetch() ) $arDID[] = $a["DID"];
		$arRecords = array();
		while( $ar = $rs->Fetch() ) if( is_array( $arDID ) && ( in_array( $ar["ID"], $arDID ) || in_array( 0,$arDID ) ) ) $arRecords[] = $ar;
		
		$rs = new CDBResult;
		$rs->InitFromArray($arRecords);
		
		return $rs;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:31,代码来源:dictionary.php


示例7: getList

function getList($blockId, $fields, $order, $filers)
{
    $entity_requests_data_class = connectToBlock($blockId);
    $main_query_requests = new Entity\Query($entity_requests_data_class);
    $main_query_requests->setSelect($fields);
    //$main_query_requests->setSelect(array('ID','UF_TITLE'));
    if (!empty($order)) {
        $main_query_requests->setOrder($order);
    }
    if (!empty($filers)) {
        $main_query_requests->setFilter($filers);
        /*$main_query_requests->setFilter(
              array(
                  'UF_NAME'=>'Александр',
              )
          );*/
    }
    $result_requests = $main_query_requests->exec();
    $result_requests = new CDBResult($result_requests);
    $requests = array();
    while ($row_requests = $result_requests->Fetch()) {
        $requests[] = $row_requests;
        //массив выбранных элементов
    }
    return $requests;
}
开发者ID:spas-viktor,项目名称:books,代码行数:26,代码来源:block_funcs.php


示例8: SelectBoxM

/**
 * Returns HTML multiple "select"
 *
 * @param string $strBoxName Input name
 * @param CDBResult $a DB result with items
 * @param array $arr Selected values
 * @param string $strDetText Empty item text
 * @param bool $strDetText_selected Allow to choose an empty item
 * @param string $size Size attribute
 * @param string $field1 Additional attributes
 * @return string
 */
function SelectBoxM($strBoxName, $a, $arr, $strDetText = "", $strDetText_selected = false, $size = "5", $field1 = "class=\"typeselect\"")
{
    $strReturnBox = "<select " . $field1 . " multiple name=\"" . $strBoxName . "\" id=\"" . $strBoxName . "\" size=\"" . $size . "\">";
    if ($strDetText != '') {
        $strReturnBox = $strReturnBox . "<option ";
        if ($strDetText_selected) {
            $strReturnBox = $strReturnBox . " selected ";
        }
        $strReturnBox = $strReturnBox . " value='NOT_REF'>" . $strDetText . "</option>";
    }
    while ($ar = $a->Fetch()) {
        $reference_id = $ar["REFERENCE_ID"];
        $reference = $ar["REFERENCE"];
        if ($reference_id == '') {
            $reference_id = $ar["reference_id"];
        }
        if ($reference == '') {
            $reference = $ar["reference"];
        }
        $sel = is_array($arr) && in_array($reference_id, $arr) ? "selected" : "";
        $strReturnBox = $strReturnBox . "<option " . $sel;
        $strReturnBox = $strReturnBox . " value=\"" . htmlspecialcharsbx($reference_id) . "\">" . htmlspecialcharsbx($reference) . "</option>";
    }
    return $strReturnBox . "</select>";
}
开发者ID:gitkv,项目名称:bash,代码行数:37,代码来源:tools.php


示例9: getData

 /** @return \CDBResult */
 public function getData()
 {
     $formId = $this->getFieldValue('FORM', null);
     $propertyNameId = $this->getFieldValue('PROPERTY_NAME', null);
     $propertyEmailId = $this->getFieldValue('PROPERTY_EMAIL', null);
     $formResultsDb = new \CDBResult();
     if ($formId && $propertyEmailId) {
         $dataResult = array();
         $filter = array();
         $formResultDb = \CFormResult::GetList($formId, $by = "s_timestamp", $order = "asc", $filter, $filtered, "N");
         while ($formResult = $formResultDb->Fetch()) {
             $answerList = \CFormResult::GetDataByID($formResult['ID'], array(), $formResult, $answerList2);
             $data = array();
             foreach ($answerList as $fieldCode => $arFieldsAnswer) {
                 if ($arFieldsAnswer[0]['TITLE_TYPE'] == 'text') {
                     if ($arFieldsAnswer[0]['FIELD_ID'] == $propertyNameId) {
                         $data['NAME'] = $arFieldsAnswer[0]['USER_TEXT'];
                     }
                     if ($arFieldsAnswer[0]['FIELD_ID'] == $propertyEmailId) {
                         $data['EMAIL'] = $arFieldsAnswer[0]['USER_TEXT'];
                     }
                 }
             }
             if (!empty($data['EMAIL'])) {
                 if (intval($formResult['USER_ID']) > 0) {
                     $data['USER_ID'] = intval($formResult['USER_ID']);
                 }
                 $dataResult[] = $data;
             }
         }
         $formResultsDb->InitFromArray($dataResult);
     }
     return $formResultsDb;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:35,代码来源:senderconnector.php


示例10: GetList

 function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "CPG.ID", "TYPE" => "int"), "PRODUCT_ID" => array("FIELD" => "CPG.PRODUCT_ID", "TYPE" => "int"), "GROUP_ID" => array("FIELD" => "CPG.GROUP_ID", "TYPE" => "int"), "ACCESS_LENGTH" => array("FIELD" => "CPG.ACCESS_LENGTH", "TYPE" => "int"), "ACCESS_LENGTH_TYPE" => array("FIELD" => "CPG.ACCESS_LENGTH_TYPE", "TYPE" => "char"), "GROUP_ACTIVE" => array("FIELD" => "G.ACTIVE", "TYPE" => "char", "FROM" => "INNER JOIN b_group G ON (CPG.GROUP_ID = G.ID)"), "GROUP_NAME" => array("FIELD" => "G.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_group G ON (CPG.GROUP_ID = G.ID)"));
     $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (is_array($arGroupBy) && empty($arGroupBy)) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_product2group CPG " . "\t" . $arSqls["FROM"] . " ";
         if (!empty($arSqls["WHERE"])) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (!empty($arSqls["GROUPBY"])) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_product2group CPG " . "\t" . $arSqls["FROM"] . " ";
     if (!empty($arSqls["WHERE"])) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (!empty($arSqls["GROUPBY"])) {
         $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
     }
     if (!empty($arSqls["ORDERBY"])) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) <= 0) {
         $strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_catalog_product2group CPG " . "\t" . $arSqls["FROM"] . " ";
         if (!empty($arSqls["WHERE"])) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (!empty($arSqls["GROUPBY"])) {
             $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (empty($arSqls["GROUPBY"])) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             $cnt = $dbRes->SelectedRowsCount();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:product_group.php


示例11: getList

 static function getList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "DE.ID", "TYPE" => "int"), "DOC_ID" => array("FIELD" => "DE.DOC_ID", "TYPE" => "int"), "STORE_FROM" => array("FIELD" => "DE.STORE_FROM", "TYPE" => "int"), "STORE_TO" => array("FIELD" => "DE.STORE_TO", "TYPE" => "int"), "ELEMENT_ID" => array("FIELD" => "DE.ELEMENT_ID", "TYPE" => "int"), "AMOUNT" => array("FIELD" => "DE.AMOUNT", "TYPE" => "double"), "PURCHASING_PRICE" => array("FIELD" => "DE.PURCHASING_PRICE", "TYPE" => "double"), "IS_MULTIPLY_BARCODE" => array("FIELD" => "CP.BARCODE_MULTI", "TYPE" => "int", "FROM" => "INNER JOIN b_catalog_product CP ON (DE.ELEMENT_ID = CP.ID)"));
     $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (is_array($arGroupBy) && count($arGroupBy) == 0) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_docs_element DE " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return false;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_docs_element DE " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["GROUPBY"]) > 0) {
         $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) <= 0) {
         $strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_catalog_docs_element DE " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             $cnt = $dbRes->SelectedRowsCount();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:store_docs_element.php


示例12: GetList

 static function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "CP.ID", "TYPE" => "int"), "PRODUCT_ID" => array("FIELD" => "CP.PRODUCT_ID", "TYPE" => "int"), "STORE_ID" => array("FIELD" => "CP.STORE_ID", "TYPE" => "int"), "AMOUNT" => array("FIELD" => "CP.AMOUNT", "TYPE" => "double"), "STORE_NAME" => array("FIELD" => "CS.TITLE", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_ADDR" => array("FIELD" => "CS.ADDRESS", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_DESCR" => array("FIELD" => "CS.DESCRIPTION", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_GPS_N" => array("FIELD" => "CS.GPS_N", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_GPS_S" => array("FIELD" => "CS.GPS_S", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_IMAGE" => array("FIELD" => "CS.IMAGE_ID", "TYPE" => "int", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_LOCATION" => array("FIELD" => "CS.LOCATION_ID", "TYPE" => "int", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"));
     $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (is_array($arGroupBy) && count($arGroupBy) == 0) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_store_product CP " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return false;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_store_product CP " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["GROUPBY"]) > 0) {
         $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) <= 0) {
         $strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_catalog_store_product CP " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             $cnt = $dbRes->SelectedRowsCount();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:store_product.php


示例13: CDBResultToArray

 /**
  * Convert CDBResult to array.
  *
  */
 public static function CDBResultToArray(CDBResult $CDBResult)
 {
     if ($CDBResult->SelectedRowsCount() == 0) {
         return array();
     }
     $ret = array();
     while ($row = $CDBResult->Fetch()) {
         $ret[] = $row;
     }
     return $ret;
 }
开发者ID:ASDAFF,项目名称:bitrix-adapter,代码行数:15,代码来源:db.php


示例14: GetList

 public static function GetList($arOrder = array('CREATED_DATE' => 'DESC'), $arFilter = array(), $arSelect = array(), $nPageTop = false)
 {
     // Fix for #27449
     if (!CModule::IncludeModule('calendar')) {
         $obRes = new CDBResult();
         $obRes->InitFromArray(array());
         return $obRes;
     }
     global $USER;
     $ENTITY_ID = 'CALENDAR_EVENT';
     $arElement = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields($ENTITY_ID, 0, LANGUAGE_ID);
     if ($arElement == false || !isset($arElement['UF_CRM_CAL_EVENT'])) {
         $arFields = array();
         $arFields['ENTITY_ID'] = $ENTITY_ID;
         $arFields['FIELD_NAME'] = 'UF_CRM_CAL_EVENT';
         $arFields['USER_TYPE_ID'] = 'crm';
         $arFields['EDIT_FORM_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
         $arFields['LIST_COLUMN_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
         $arFields['LIST_FILTER_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
         $arFields['SETTINGS']['LEAD'] = 'Y';
         $arFields['SETTINGS']['CONTACT'] = 'Y';
         $arFields['SETTINGS']['COMPANY'] = 'Y';
         $arFields['SETTINGS']['DEAL'] = 'Y';
         $arFields['MULTIPLE'] = 'Y';
         $CAllUserTypeEntity = new CUserTypeEntity();
         $CAllUserTypeEntity->Add($arFields);
     }
     if (isset($arFilter['ENTITY_TYPE']) && isset($arFilter['ENTITY_ID'])) {
         $arFilter['ENTITY_TYPE'] = CUserTypeCrm::GetShortEntityType($arFilter['ENTITY_TYPE']);
         $arFilter['UF_CRM_CAL_EVENT'] = $arFilter['ENTITY_TYPE'] . '_' . $arFilter['ENTITY_ID'];
         unset($arFilter['ENTITY_TYPE'], $arFilter['ENTITY_ID']);
     } else {
         if (!empty($arFilter['ENTITY_TYPE'])) {
             $arFilter['ENTITY_TYPE'] = CUserTypeCrm::GetShortEntityType($arFilter['ENTITY_TYPE']);
             $arFilter['%UF_CRM_CAL_EVENT'] = $arFilter['ENTITY_TYPE'] . '_';
             unset($arFilter['ENTITY_TYPE']);
         } else {
             $arFilter['!=UF_CRM_CAL_EVENT'] = '';
         }
     }
     $arFilter['CAL_TYPE'] = 'user';
     $arFilter['DELETED'] = 'N';
     if (isset($arFilter['OWNER_ID']) && is_array($arFilter['OWNER_ID'])) {
         $arFilter['OWNER_ID'] = current($arFilter['OWNER_ID']);
     }
     $arCal = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'parseRecursion' => false, 'userId' => $USER->GetID(), 'fetchAttendees' => false, 'fetchMeetings' => true));
     $obRes = new CDBResult();
     $obRes->InitFromArray($arCal);
     return $obRes;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:50,代码来源:crm_activity_calendar.php


示例15: GetList

 public static function GetList($arOrder = array("ID" => "ASC"), $arFilter = array(), $arAddParams = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "BPP.ID", "TYPE" => "int"), "POST_ID" => array("FIELD" => "BPP.POST_ID", "TYPE" => "int"), "USER_ID" => array("FIELD" => "BPP.USER_ID", "TYPE" => "int"), "NAME" => array("FIELD" => "BPP.NAME", "TYPE" => "string"), "VALUE" => array("FIELD" => "BPP.VALUE", "TYPE" => "string"), "RANK" => $arOrder["OWNER_ID"] > 0 ? array("FIELD" => "RV0.RANK", "TYPE" => "int", "FROM" => "\n\tLEFT JOIN (\n\t\t" . "SELECT MAX(RV2.VOTE_WEIGHT) as VOTE_WEIGHT, RV2.ENTITY_ID \n\t\t" . "FROM b_rating_user RV2 \n\t\t" . "GROUP BY RV2.ENTITY_ID) RV ON (RV.ENTITY_ID = BPP.USER_ID)\n\t" . "LEFT JOIN (\n\t\t" . "SELECT RV1.OWNER_ID, SUM(case when RV1.ID is not null then 1 else 0 end) as RANK \n\t\t" . "FROM b_rating_vote RV1 \n\t\t" . "WHERE RV1.USER_ID = " . $arOrder["OWNER_ID"] . "\n\t\t" . "GROUP BY RV1.OWNER_ID) RV0 ON (RV0.OWNER_ID = BPP.USER_ID)") : array("FIELD" => "RV.RANK", "TYPE" => "string", "FROM" => "\n\tLEFT JOIN (" . "\n\t\tSELECT MAX(RV2.VOTE_WEIGHT) as VOTE_WEIGHT, RV2.ENTITY_ID, 0 as RANK " . "\n\t\tFROM b_rating_user RV2" . "\n\t\tGROUP BY RV2.ENTITY_ID) RV ON (RV.ENTITY_ID = BPP.USER_ID)"), "USER_ACTIVE" => array("FIELD" => "U.ACTIVE", "TYPE" => "string", "FROM" => "\n\tINNER JOIN b_user U ON (BPP.USER_ID = U.ID)"), "USER_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "\n\tINNER JOIN b_user U ON (BPP.USER_ID = U.ID)"), "USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "\n\tINNER JOIN b_user U ON (BPP.USER_ID = U.ID)"), "USER_SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string", "FROM" => "\n\tINNER JOIN b_user U ON (BPP.USER_ID = U.ID)"), "USER_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "\n\tINNER JOIN b_user U ON (BPP.USER_ID = U.ID)"), "USER_PERSONAL_PHOTO" => array("FIELD" => "U.PERSONAL_PHOTO", "TYPE" => "string", "FROM" => "\n\tINNER JOIN b_user U ON (BPP.USER_ID = U.ID)"));
     $arSelect = array_diff(array_keys($arFields), array("RANK"));
     $arSelect = is_array($arAddParams["SELECT"]) && !empty($arAddParams["SELECT"]) ? array_intersect($arAddParams["SELECT"], $arSelect) : $arSelect;
     $arSql = CBlog::PrepareSql($arFields, array(), $arFilter, false, $arSelect);
     $arSql["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSql["SELECT"]);
     $iCnt = 0;
     if ($arAddParams["bCount"] || array_key_exists("bDescPageNumbering", $arAddParams)) {
         $strSql = "SELECT COUNT(BPP.ID) AS CNT  \n" . "FROM b_blog_post_param BPP " . $arSql["FROM"] . "\n" . (empty($arSql["GROUPBY"]) ? "" : "GROUP BY " . $arSql["GROUPBY"] . "\n") . "WHERE " . (empty($arSql["WHERE"]) ? "1 = 1" : $arSql["WHERE"]);
         $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arAddParams["bCount"]) {
             return $db_res;
         }
         $iCnt = $db_res && ($res = $db_res->Fetch()) ? intval($res["CNT"]) : 0;
     }
     // ORDER BY -->
     $arSqlOrder = array();
     foreach ($arOrder as $by => $order) {
         $by = strtoupper($by);
         $order = strtoupper($order) != "ASC" ? "DESC" : "ASK";
         if (array_key_exists($by, $arFields) && !array_key_exists($by, $arSqlOrder)) {
             if (strtoupper($DB->type) == "ORACLE") {
                 $order .= $order == "ASC" ? " NULLS FIRST" : " NULLS LAST";
             }
             if (isset($arFields[$by]["FROM"]) && !empty($arFields[$by]["FROM"]) && strpos($arSql["FROM"], $arFields[$by]["FROM"]) === false) {
                 $arSql["FROM"] .= " " . $arFields[$by]["FROM"];
             }
             if ($by == "RANK") {
                 $arSql["SELECT"] .= ", " . $arFields["RANK"]["FIELD"];
                 $arSqlOrder[$by] = IsModuleInstalled("intranet") ? "RV.VOTE_WEIGHT " . $order . ", RANK " . $order : "RANK " . $order . ", RV.VOTE_WEIGHT " . $order;
             } else {
                 $arSqlOrder[$by] = (array_key_exists("ORDER", $arFields[$by]) ? $arFields[$by]["ORDER"] : $arFields[$by]["FIELD"]) . " " . $order;
             }
         }
     }
     DelDuplicateSort($arSqlOrder);
     $arSql["ORDERBY"] = implode(", ", $arSqlOrder);
     // <-- ORDER BY
     $strSql = "SELECT " . $arSql["SELECT"] . "\n" . "FROM b_blog_post_param BPP" . $arSql["FROM"] . "\n" . "WHERE " . (empty($arSql["WHERE"]) ? "1 = 1" : $arSql["WHERE"]) . (empty($arSql["ORDERBY"]) ? "" : "\nORDER BY " . $arSql["ORDERBY"]);
     if (is_set($arAddParams, "bDescPageNumbering")) {
         $db_res = new CDBResult();
         $db_res->NavQuery($strSql, $iCnt, $arAddParams);
     } else {
         $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $db_res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:blog_post_param.php


示例16: fetch

 /**
  * Gets array with one row of selected data.
  * Calls CDBResult->Fetch()
  * 
  * @return array|false
  */
 public function fetch()
 {
     if (is_null($this->selectResult)) {
         $this->getResult();
     }
     return $this->selectResult->Fetch();
 }
开发者ID:BxSolutions,项目名称:Bitrix-Helpers,代码行数:13,代码来源:AbstractQuery.php


示例17: GetList

 /**
  * @param $by
  * @param $order
  * @param $arFilter
  *
  * @return CDBResult
  *
  * пока не знаю для чего эта функция, но может пригодиться
  */
 function GetList($by, $order, $arFilter)
 {
     global $DB;
     $query = $DB->Query('SELECT "NAME, CHANGED" FROM p_parser_res_list');
     while ($res = $query->Fetch()) {
         $elem['ID'] = $res['ID'];
         $elem['NAME'] = $res['NAME'];
         $elem['ACTIVE'] = $res['ACTIVE'];
         $elem['DATE_ACTIVE_FROM'] = $res['DATE_ACTIVE_FROM'];
         $elem['DATE_ACTIVE_TO'] = $res['DATE_ACTIVE_TO'];
         $arResult[] = $elem;
     }
     $result = new CDBResult();
     $result->InitFromArray($arResult);
     return $result;
 }
开发者ID:dtvs01,项目名称:Parser,代码行数:25,代码来源:parser_class.php


示例18: elemGetEx

 function elemGetEx($elemId = false)
 {
     $hlHandler = $this->hlHandler;
     $getList = new Entity\Query($hlHandler);
     $getList->setSelect(array('*'));
     $getList->setOrder(array("ID" => "ASC"));
     if (!empty($elemId)) {
         $getList->setFilter(array("ID" => $elemId));
     }
     $result = $getList->exec();
     $result = new CDBResult($result);
     $arRes = array();
     while ($row = $result->Fetch()) {
         $arRes[] = $row;
     }
     return $arRes;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:17,代码来源:highloadblocks.php


示例19: __construct


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CDOMElement类代码示例发布时间:2022-05-23
下一篇:
PHP CCurrencyRates类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap