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


PHP CSQLWhere::GetQuery方法代码示例

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


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

示例1: GetList

 function GetList($arSelect, $arFilter, $arOrder = array(), $arNavParams = false)
 {
     global $DB;
     $arFields = $this->GetTableFields();
     if (!is_array($arSelect)) {
         $arSelect = array();
     }
     if (count($arSelect) < 1) {
         $arSelect = array_keys($arFields);
     }
     if (!is_array($arOrder)) {
         $arOrder = array();
     }
     $arQueryOrder = array();
     foreach ($arOrder as $strColumn => $strDirection) {
         $strDirection = strtoupper($strDirection) == "ASC" ? "ASC" : "DESC";
         if (array_key_exists($strColumn, $arFields)) {
             $arSelect[] = $strColumn;
             if ($arFields[$strColumn] == "datetime") {
                 $arQueryOrder[$strColumn] = $this->escapeColumn("TMP_" . $strColumn) . " " . $strDirection;
             } else {
                 $arQueryOrder[$strColumn] = $this->escapeColumn($strColumn) . " " . $strDirection;
             }
         }
     }
     $arQuerySelect = array();
     foreach ($arSelect as $strColumn) {
         if (array_key_exists($strColumn, $arFields)) {
             if ($arFields[$strColumn] == "datetime" || $arFields[$strColumn] == "date") {
                 $arQuerySelect["TMP_" . $strColumn] = "t." . $strColumn . " TMP_" . $strColumn;
                 $arQuerySelect[$strColumn] = $DB->DateToCharFunction("t." . $strColumn, "SHORT") . " " . $strColumn;
                 $arQuerySelect["FULL_" . $strColumn] = $DB->DateToCharFunction("t." . $strColumn, "FULL") . " FULL_" . $strColumn;
                 $arQuerySelect["SHORT_" . $strColumn] = $DB->DateToCharFunction("t." . $strColumn, "SHORT") . " SHORT_" . $strColumn;
             } else {
                 $arQuerySelect[$strColumn] = "t." . $strColumn;
             }
         }
     }
     foreach ($arFields as $FIELD_NAME => $FIELD_TYPE) {
         $arFields[$FIELD_NAME] = array("TABLE_ALIAS" => "t", "FIELD_NAME" => $FIELD_NAME, "FIELD_TYPE" => $FIELD_TYPE, "JOIN" => false);
     }
     $obQueryWhere = new CSQLWhere();
     $obQueryWhere->SetFields($arFields);
     if (count($arQuerySelect) < 1) {
         $arQuerySelect = array("*" => "t.*");
     }
     if (is_array($arNavParams)) {
         return $this->NavQuery($arNavParams, $arQuerySelect, $this->TABLE_NAME, $obQueryWhere->GetQuery($arFilter), $arQueryOrder);
     } 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" . $this->TABLE_NAME . " t\n\t\t\t";
         if ($strQueryWhere = $obQueryWhere->GetQuery($arFilter)) {
             $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";
         }
         //echo "<pre>",htmlspecialcharsbx($strSql),"</pre><hr>";
         return $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
 }
开发者ID:spas-viktor,项目名称:books,代码行数:60,代码来源:table.php

示例2: GetList

 public static function GetList($arOrder = array(), $arFilter = array())
 {
     global $DB;
     $arFields = array('ID' => array('TABLE_ALIAS' => 'G', 'FIELD_NAME' => 'ID', 'FIELD_TYPE' => 'int', 'JOIN' => false), 'NAME' => array('TABLE_ALIAS' => 'G', 'FIELD_NAME' => 'NAME', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'XML_ID' => array('TABLE_ALIAS' => 'G', 'FIELD_NAME' => 'XML_ID', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'SORT' => array('TABLE_ALIAS' => 'G', 'FIELD_NAME' => 'SORT', 'FIELD_TYPE' => 'int', 'JOIN' => false), 'IS_TEAM_GROUP' => array('TABLE_ALIAS' => 'G', 'FIELD_NAME' => 'IS_TEAM_GROUP', 'FIELD_TYPE' => 'string', 'JOIN' => false));
     $strOrder = '';
     if (is_array($arOrder) && count($arOrder) > 0) {
         foreach ($arOrder as $k => $v) {
             if (array_key_exists($k, $arFields)) {
                 $v = strtoupper($v);
                 if ($v != 'DESC') {
                     $v = 'ASC';
                 }
                 if (strlen($strOrder) > 0) {
                     $strOrder .= ', ';
                 }
                 $strOrder .= $arFields[$k]['TABLE_ALIAS'] . '.' . $arFields[$k]['FIELD_NAME'] . ' ' . $v;
             }
         }
     }
     $obQueryWhere = new CSQLWhere();
     $obQueryWhere->SetFields($arFields);
     $where = $obQueryWhere->GetQuery($arFilter);
     $strQuery = 'SELECT G.* FROM b_ticket_ugroups G';
     if (strlen($where) > 0) {
         $strQuery .= ' WHERE ' . $where;
     }
     if (strlen($strOrder) > 0) {
         $strQuery .= ' ORDER BY ' . $strOrder;
     }
     return $DB->Query($strQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
 }
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:usergroup.php

示例3: GetList

 function GetList($arOrder = array(), $arFilter = array())
 {
     global $DB;
     $arFields = array('GROUP_ID' => array('TABLE_ALIAS' => 'UG', 'FIELD_NAME' => 'UG.GROUP_ID', 'FIELD_TYPE' => 'int', 'JOIN' => false), 'USER_ID' => array('TABLE_ALIAS' => 'UG', 'FIELD_NAME' => 'UG.USER_ID', 'FIELD_TYPE' => 'int', 'JOIN' => false), 'CAN_VIEW_GROUP_MESSAGES' => array('TABLE_ALIAS' => 'UG', 'FIELD_NAME' => 'UG.CAN_VIEW_GROUP_MESSAGES', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'CAN_MAIL_GROUP_MESSAGES' => array('TABLE_ALIAS' => 'UG', 'FIELD_NAME' => 'UG.CAN_MAIL_GROUP_MESSAGES', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'CAN_MAIL_UPDATE_GROUP_MESSAGES' => array('TABLE_ALIAS' => 'UG', 'FIELD_NAME' => 'UG.CAN_MAIL_UPDATE_GROUP_MESSAGES', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'GROUP_NAME' => array('TABLE_ALIAS' => 'G', 'FIELD_NAME' => 'G.NAME', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'IS_TEAM_GROUP' => array('TABLE_ALIAS' => 'G', 'FIELD_NAME' => 'G.IS_TEAM_GROUP', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'LOGIN' => array('TABLE_ALIAS' => 'U', 'FIELD_NAME' => 'U.LOGIN', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'FIRST_NAME' => array('TABLE_ALIAS' => 'U', 'FIELD_NAME' => 'U.NAME', 'FIELD_TYPE' => 'string', 'JOIN' => false), 'LAST_NAME' => array('TABLE_ALIAS' => 'U', 'FIELD_NAME' => 'U.LAST_NAME', 'FIELD_TYPE' => 'string', 'JOIN' => false));
     $strOrder = '';
     if (is_array($arOrder) && count($arOrder) > 0) {
         foreach ($arOrder as $k => $v) {
             if (array_key_exists($k, $arFields)) {
                 $v = strtoupper($v);
                 if ($v != 'DESC') {
                     $v = 'ASC';
                 }
                 if (strlen($strOrder) > 0) {
                     $strOrder .= ', ';
                 }
                 $strOrder .= $arFields[$k]['FIELD_NAME'] . ' ' . $v;
             }
         }
     }
     $obQueryWhere = new CSQLWhere();
     $obQueryWhere->SetFields($arFields);
     $where = $obQueryWhere->GetQuery($arFilter);
     $strQuery = 'SELECT ' . 'UG.*, G.NAME GROUP_NAME, G.IS_TEAM_GROUP, ' . 'U.LOGIN, U.NAME FIRST_NAME, U.LAST_NAME ' . 'FROM b_ticket_user_ugroup UG ' . 'INNER JOIN b_ticket_ugroups G ON (UG.GROUP_ID=G.ID) ' . 'INNER JOIN b_user U ON (UG.USER_ID=U.ID) ';
     if (strlen($where) > 0) {
         $strQuery .= ' WHERE ' . $where;
     }
     if (strlen($strOrder) > 0) {
         $strQuery .= ' ORDER BY ' . $strOrder;
     }
     return $DB->Query($strQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:usertousergroup.php

示例4: GetList

 public static function GetList($arFilter = array(), $arOrder = array())
 {
     global $DB;
     if (!is_array($arOrder)) {
         $arOrder = array();
     }
     if (count($arOrder) < 1) {
         $arOrder = array("TABLE_NAME" => "ASC");
     }
     $arQueryOrder = array();
     foreach ($arOrder as $strColumn => $strDirection) {
         $strColumn = strtoupper($strColumn);
         $strDirection = strtoupper($strDirection) == "ASC" ? "ASC" : "DESC";
         switch ($strColumn) {
             case "ID":
             case "TABLE_NAME":
                 $arSelect[] = $strColumn;
                 $arQueryOrder[$strColumn] = $strColumn . " " . $strDirection;
                 break;
         }
     }
     $obQueryWhere = new CSQLWhere();
     $obQueryWhere->SetFields(array("ID" => array("TABLE_ALIAS" => "s", "FIELD_NAME" => "ID", "FIELD_TYPE" => "int", "JOIN" => false)));
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     $strQueryWhere = $obQueryWhere->GetQuery($arFilter);
     $strSql = "\n\t\t\tSELECT *\n\t\t\tFROM b_perf_index_complete s\n\t\t\t" . ($strQueryWhere ? "WHERE " . $strQueryWhere : "") . "\n\t\t\t" . (count($arQueryOrder) ? "ORDER BY " . implode(", ", $arQueryOrder) : "") . "\n\t\t";
     $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     return $res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:index_complete.php

示例5: GetList

 function GetList($arOrder, $arFilter = array())
 {
     global $DB;
     if (!is_array($arOrder)) {
         $arOrder = array();
     }
     if (count($arOrder) < 1) {
         $arOrder = array("ID" => "DESC");
     }
     $arQueryOrder = array();
     foreach ($arOrder as $strColumn => $strDirection) {
         $strColumn = strtoupper($strColumn);
         $strDirection = strtoupper($strDirection) == "ASC" ? "ASC" : "DESC";
         switch ($strColumn) {
             case "ID":
                 $arQueryOrder[$strColumn] = $strColumn . " " . $strDirection;
                 break;
         }
     }
     static $arWhereFields = array("ID" => array("TABLE_ALIAS" => "h", "FIELD_NAME" => "ID", "FIELD_TYPE" => "int", "JOIN" => false));
     $obQueryWhere = new CSQLWhere();
     $obQueryWhere->SetFields($arWhereFields);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\th.*\n\t\t\t\t," . $DB->DateToCharFunction("h.TIMESTAMP_X") . " TIMESTAMP_X\n\t\t\tFROM\n\t\t\t\tb_perf_history h\n\t\t";
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     if ($strQueryWhere = $obQueryWhere->GetQuery($arFilter)) {
         $strSql .= "\n\t\t\t\tWHERE\n\t\t\t\t" . $strQueryWhere . "\n\t\t\t";
     }
     if (count($arQueryOrder) > 0) {
         $strSql .= "\n\t\t\t\tORDER BY\n\t\t\t\t" . implode(", ", $arQueryOrder) . "\n\t\t\t";
     }
     //echo "<pre>",htmlspecialcharsbx($strSql),"</pre><hr>";
     return $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
 }
开发者ID:spas-viktor,项目名称:books,代码行数:35,代码来源:history.php

示例6: GetList

 /**
  * @param boolean|array[] $arOrder
  * @param boolean|array[] $arFilter
  * @param boolean|array[] $arSelect
  *
  * @return boolean|CDBResult
  */
 public static function GetList($arOrder = false, $arFilter = false, $arSelect = false)
 {
     global $DB;
     if (!is_array($arSelect)) {
         $arSelect = array();
     }
     if (count($arSelect) < 1) {
         $arSelect = array("ID", "TIMESTAMP_X", "THREADS", "HITS", "ERRORS", "PAGES_PER_SECOND", "PAGE_EXEC_TIME", "PAGE_RESP_TIME");
     }
     if (!is_array($arOrder)) {
         $arOrder = array();
     }
     $arQueryOrder = array();
     foreach ($arOrder as $strColumn => $strDirection) {
         $strColumn = strtoupper($strColumn);
         $strDirection = strtoupper($strDirection) == "ASC" ? "ASC" : "DESC";
         switch ($strColumn) {
             case "ID":
                 $arSelect[] = $strColumn;
                 $arQueryOrder[$strColumn] = $strColumn . " " . $strDirection;
                 break;
         }
     }
     $arQuerySelect = array();
     foreach ($arSelect as $strColumn) {
         $strColumn = strtoupper($strColumn);
         switch ($strColumn) {
             case "ID":
             case "TIMESTAMP_X":
             case "THREADS":
             case "HITS":
             case "ERRORS":
             case "PAGES_PER_SECOND":
             case "PAGE_EXEC_TIME":
             case "PAGE_RESP_TIME":
                 $arQuerySelect[$strColumn] = "p." . $strColumn;
                 break;
         }
     }
     if (count($arQuerySelect) < 1) {
         $arQuerySelect = array("ID" => "p.ID");
     }
     $obQueryWhere = new CSQLWhere();
     $arFields = array("ID" => array("TABLE_ALIAS" => "p", "FIELD_NAME" => "p.ID", "FIELD_TYPE" => "int", "JOIN" => false));
     $obQueryWhere->SetFields($arFields);
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     $strQueryWhere = $obQueryWhere->GetQuery($arFilter);
     $bDistinct = $obQueryWhere->bDistinctReqired;
     $strSql = "\n\t\t\tSELECT " . ($bDistinct ? "DISTINCT" : "") . "\n\t\t\t" . implode(", ", $arQuerySelect) . "\n\t\t\tFROM\n\t\t\t\tb_perf_cluster p\n\t\t\t" . $obQueryWhere->GetJoins() . "\n\t\t";
     if ($strQueryWhere) {
         $strSql .= "\n\t\t\t\tWHERE\n\t\t\t\t" . $strQueryWhere . "\n\t\t\t";
     }
     if (count($arQueryOrder) > 0) {
         $strSql .= "\n\t\t\t\tORDER BY\n\t\t\t\t" . implode(", ", $arQueryOrder) . "\n\t\t\t";
     }
     return $DB->Query($strSql, false, '', array('fixed_connection' => true));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:66,代码来源:cluster.php

示例7: GetList

 public static function GetList($arOrder = array('ID' => 'DESC'), $arFilter = array())
 {
     global $DB;
     // where
     $arWhereFields = array('ID' => array('TABLE_ALIAS' => 'R', 'FIELD_NAME' => 'R.ID', 'FIELD_TYPE' => 'int', 'JOIN' => false), 'NAME' => array('TABLE_ALIAS' => 'R', 'FIELD_NAME' => 'R.NAME', 'FIELD_TYPE' => 'string', 'JOIN' => false));
     $obQueryWhere = new CSQLWhere();
     $obQueryWhere->SetFields($arWhereFields);
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     $sQueryWhereFields = $obQueryWhere->GetQuery($arFilter);
     $sSqlSearch = '';
     if (!empty($sQueryWhereFields)) {
         $sSqlSearch .= "\n\t\t\t\tAND ({$sQueryWhereFields}) ";
     }
     // order
     $arSqlOrder = array();
     if (!is_array($arOrder)) {
         $arOrder = array('ID' => 'DESC');
     }
     foreach ($arOrder as $by => $order) {
         $by = strtoupper($by);
         $order = strtolower($order);
         if ($order != 'asc') {
             $order = 'desc';
         }
         if (isset($arWhereFields[$by])) {
             $arSqlOrder[$by] = " R.{$by} {$order} ";
         } else {
             $by = 'id';
             $arSqlOrder[$by] = " R.ID {$order} ";
         }
     }
     if (count($arSqlOrder) > 0) {
         $sSqlOrder = "\n\t\t\t\tORDER BY " . implode(', ', $arSqlOrder);
     } else {
         $sSqlOrder = '';
     }
     $sSql = "\n\t\t\tSELECT\n\t\t\t\tID, NAME\n\t\t\tFROM\n\t\t\t\tb_crm_role R\n\t\t\tWHERE\n\t\t\t\t1=1 {$sSqlSearch}\n\t\t\t{$sSqlOrder}";
     $obRes = $DB->Query($sSql, false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
     return $obRes;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:42,代码来源:crm_role.php

示例8: GetList

	public static function GetList($arOrder = Array(), $arFilter = Array())
	{
		global $DB;

		static $arFields = array(
			"ID" => Array("FIELD_NAME" => "G.ID", "FIELD_TYPE" => "int"),
			"NAME" => Array("FIELD_NAME" => "G.NAME", "FIELD_TYPE" => "string"),
			"TIMESTAMP_X" => Array("FIELD_NAME" => "G.TIMESTAMP_X", "FIELD_TYPE" => "datetime"),
			"MODIFIED_BY" => Array("FIELD_NAME" => "G.MODIFIED_BY", "FIELD_TYPE" => "int"),
			"UPDATE_PERIOD" => Array("FIELD_NAME" => "G.UPDATE_PERIOD", "FIELD_TYPE" => "int"),
			"MODIFIED_BY_USER" => Array("FIELD_TYPE" => "string"),
			"DATE_CREATE" => Array("FIELD_NAME" => "G.DATE_CREATE", "FIELD_TYPE" => "datetime"),
			"CREATED_BY" => Array("FIELD_NAME" => "G.CREATED_BY", "FIELD_TYPE" => "int"),
			"CREATED_BY_USER" => Array("FIELD_TYPE" => "string"),
			"TRIAL_PERIOD" => Array("FIELD_NAME" => "G.TRIAL_PERIOD", "FIELD_TYPE" => "int"),
			"COUNTER_UPDATE_PERIOD" => Array("FIELD_NAME" => "G.COUNTER_UPDATE_PERIOD", "FIELD_TYPE" => "int"),
			"CHECK_COUNTER_FREE_SPACE" => Array("FIELD_NAME" => "G.CHECK_COUNTER_FREE_SPACE", "FIELD_TYPE" => "string"),
			"CHECK_COUNTER_SITES" => Array("FIELD_NAME" => "G.CHECK_COUNTER_SITES", "FIELD_TYPE" => "string"),
			"CHECK_COUNTER_USERS" => Array("FIELD_NAME" => "G.CHECK_COUNTER_USERS", "FIELD_TYPE" => "string"),
			"CHECK_COUNTER_LAST_AUTH" => Array("FIELD_NAME" => "G.CHECK_COUNTER_LAST_AUTH", "FIELD_TYPE" => "string"),
		);

		$arFields["MODIFIED_BY_USER"]["FIELD_NAME"] = $DB->Concat("UM.LOGIN", "UM.NAME", "UM.LAST_NAME");
		$arFields["CREATED_BY_USER"]["FIELD_NAME"] = $DB->Concat("UC.LOGIN", "UC.NAME", "UC.LAST_NAME");

		$obWhere = new CSQLWhere;
		$obWhere->SetFields($arFields);

		$arFilterNew = Array();
		foreach($arFilter as $k=>$value)
			if(strlen($value)>0 || $value === false)
				$arFilterNew[$k]=$value;

		$strWhere = $obWhere->GetQuery($arFilterNew);

		$strSql =
			"SELECT G.*, ".
			"	UC.LOGIN as CREATED_BY_LOGIN, UC.NAME as CREATED_BY_NAME, UC.LAST_NAME as CREATED_BY_LAST_NAME, ".
			"	UM.LOGIN as MODIFIED_BY_LOGIN, UM.NAME as MODIFIED_BY_NAME, UM.LAST_NAME as MODIFIED_BY_LAST_NAME, ".
			"	".$DB->DateToCharFunction("G.TIMESTAMP_X")."	as TIMESTAMP_X, ".
			"	".$DB->DateToCharFunction("G.DATE_CREATE")."	as DATE_CREATE ".
			"FROM b_controller_group G  ".
			"	LEFT JOIN b_user UC ON UC.ID=G.CREATED_BY ".
			"	LEFT JOIN b_user UM ON UM.ID=G.MODIFIED_BY ".
			(strlen($strWhere)<=0 ? "" : "WHERE ".$strWhere)." ".
			CControllerAgent::_OrderBy($arOrder, $arFields);

		$dbr = $DB->Query($strSql);
		$dbr->is_filtered = (strlen($strWhere)>0);
		return $dbr;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:51,代码来源:controllergroup.php

示例9: GetList


//.........这里部分代码省略.........

				if($bGroup)
					$arQueryGroup[$strColumn] = "sph.".$strColumn;
			}
			elseif($strColumn == "COUNT" && $bGroup)
			{
				$arQuerySelect[$strColumn] = "count(*) ".$strColumn;
			}
		}

		$obQueryWhere = new CSQLWhere;
		$obQueryWhere->SetFields(array(
			"ID" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.ID",
				"FIELD_TYPE" => "int", //int, double, file, enum, int, string, date, datetime
				"JOIN" => false,
			),
			"PHRASE" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.PHRASE",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"TAGS" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.TAGS",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"TIMESTAMP_X" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.TIMESTAMP_X",
				"FIELD_TYPE" => "datetime",
				"JOIN" => false,
			),
			"SITE_ID" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.SITE_ID",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"URL_TO" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.URL_TO",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"URL_TO_404" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.URL_TO_404",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"STAT_SESS_ID" => array(
				"TABLE_ALIAS" => "sph",
				"FIELD_NAME" => "sph.STAT_SESS_ID",
				"FIELD_TYPE" => "int",
				"JOIN" => false,
			),
		));

		if(count($arQuerySelect) < 1)
			$arQuerySelect = array("ID"=>"sph.ID");

		$strSql = "
			SELECT
			".implode(", ", $arQuerySelect)."
			FROM
				b_search_phrase sph
		";

		if(!is_array($arFilter))
			$arFilter = array();
		if($strQueryWhere = $obQueryWhere->GetQuery($arFilter))
		{
			$strSql .= "
				WHERE
				".$strQueryWhere."
			";
		}

		if($bGroup && count($arQueryGroup) > 0)
		{
			$strSql .= "
				GROUP BY
				".implode(", ", $arQueryGroup)."
			";
		}

		if(count($arQueryOrder) > 0)
		{
			$strSql .= "
				ORDER BY
				".implode(", ", $arQueryOrder)."
			";
		}

		return $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:101,代码来源:statistic.php

示例10: GetList


//.........这里部分代码省略.........
					{
						$arQuerySelect[$strColumn] = "COUNT(s.ID) ".$strColumn;
					}
					break;
			}
		}

		$obQueryWhere = new CSQLWhere;
		$obQueryWhere->SetFields(array(
			"HIT_ID" => array(
				"TABLE_ALIAS" => "s",
				"FIELD_NAME" => "s.HIT_ID",
				"FIELD_TYPE" => "int", //int, double, file, enum, int, string, date, datetime
				"JOIN" => false,
				//"LEFT_JOIN" => "lt",
			),
			"COMPONENT_ID" => array(
				"TABLE_ALIAS" => "s",
				"FIELD_NAME" => "s.COMPONENT_ID",
				"FIELD_TYPE" => "int",
				"JOIN" => false,
			),
			"ID" => array(
				"TABLE_ALIAS" => "s",
				"FIELD_NAME" => "s.ID",
				"FIELD_TYPE" => "int",
				"JOIN" => false,
			),
			"QUERY_TIME" => array(
				"TABLE_ALIAS" => "s",
				"FIELD_NAME" => "s.QUERY_TIME",
				"FIELD_TYPE" => "double",
				"JOIN" => false,
			),
			"SUGGEST_ID" => array(
				"TABLE_ALIAS" => "iss",
				"FIELD_NAME" => "iss.SUGGEST_ID",
				"FIELD_TYPE" => "int",
				"JOIN" => "INNER JOIN b_perf_index_suggest_sql iss on iss.SQL_ID = s.ID",
				"LEFT_JOIN" => "LEFT JOIN b_perf_index_suggest_sql is on is.SQL_ID = s.ID",
			),
		));

		if(count($arQuerySelect) < 1)
			$arQuerySelect = array("ID"=>"s.ID");

		if(!is_array($arFilter))
			$arFilter = array();
		$strQueryWhere = $obQueryWhere->GetQuery($arFilter);

		if(is_array($arNavStartParams) && $arNavStartParams["nTopCount"] > 0)
		{
			$strSql = $DB->TopSQL("
				SELECT ".implode(", ", $arQuerySelect)."
				FROM b_perf_sql s
				".$obQueryWhere->GetJoins()."
				".($strQueryWhere? "WHERE ".$strQueryWhere: "")."
				".($bGroup? "GROUP BY ".implode(", ", $arQueryGroup): "")."
				".(count($arQueryOrder)? "ORDER BY ".implode(", ", $arQueryOrder): "")."
			", $arNavStartParams["nTopCount"] );
			$res = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		}
		elseif(is_array($arNavStartParams))
		{
			$strSql = "
				SELECT count('x') CNT
				FROM b_perf_sql s
				".$obQueryWhere->GetJoins()."
				".($strQueryWhere? "WHERE ".$strQueryWhere: "")."
				".($bGroup? "GROUP BY ".implode(", ", $arQueryGroup): "")."
			";
			$res_cnt = $DB->Query($strSql);
			$ar_cnt = $res_cnt->Fetch();

			$strSql = "
				SELECT ".implode(", ", $arQuerySelect)."
				FROM b_perf_sql s
				".$obQueryWhere->GetJoins()."
				".($strQueryWhere? "WHERE ".$strQueryWhere: "")."
				".($bGroup? "GROUP BY ".implode(", ", $arQueryGroup): "")."
				".(count($arQueryOrder)? "ORDER BY ".implode(", ", $arQueryOrder): "")."
			";
			$res = new CDBResult();
			$res->NavQuery($strSql, $ar_cnt["CNT"], $arNavStartParams);
		}
		else
		{
			$strSql = "
				SELECT ".implode(", ", $arQuerySelect)."
				FROM b_perf_sql s
				".$obQueryWhere->GetJoins()."
				".($strQueryWhere? "WHERE ".$strQueryWhere: "")."
				".($bGroup? "GROUP BY ".implode(", ", $arQueryGroup): "")."
				".(count($arQueryOrder)? "ORDER BY ".implode(", ", $arQueryOrder): "")."
			";
			$res = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		}

		return $res;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:sql.php

示例11: GetList

 function GetList($arOrder = array(), $arFilter = array(), $bCnt = false)
 {
     global $DB;
     static $arFields = array("ID" => array("FIELD_NAME" => "T.ID", "FIELD_TYPE" => "int"), "TIMESTAMP_X" => array("FIELD_NAME" => "T.TIMESTAMP_X", "FIELD_TYPE" => "datetime"), "DATE_CREATE" => array("FIELD_NAME" => "T.DATE_CREATE", "FIELD_TYPE" => "datetime"), "TASK_ID" => array("FIELD_NAME" => "T.TASK_ID", "FIELD_TYPE" => "string"), "CONTROLLER_MEMBER_ID" => array("FIELD_NAME" => "T.CONTROLLER_MEMBER_ID", "FIELD_TYPE" => "int"), "CONTROLLER_MEMBER_NAME" => array("FIELD_NAME" => "M.NAME", "FIELD_TYPE" => "string"), "CONTROLLER_MEMBER_URL" => array("FIELD_NAME" => "M.URL", "FIELD_TYPE" => "string"), "STATUS" => array("FIELD_NAME" => "T.STATUS", "FIELD_TYPE" => "string"), "DATE_EXECUTE" => array("FIELD_NAME" => "T.DATE_EXECUTE", "FIELD_TYPE" => "datetime"));
     $obWhere = new CSQLWhere();
     $obWhere->SetFields($arFields);
     $arFilterNew = array();
     foreach ($arFilter as $k => $value) {
         if (is_array($value) || strlen($value) > 0 || $value === false) {
             $arFilterNew[$k] = $value;
         }
     }
     $strWhere = $obWhere->GetQuery($arFilterNew);
     if ($bCnt) {
         $strSql = "SELECT COUNT('x') as C, MIN(T.ID) as MIN_ID, MAX(T.ID) as MAX_ID ";
     } else {
         $strSql = "SELECT T.*, " . "\tM.NAME as CONTROLLER_MEMBER_NAME, M.URL as CONTROLLER_MEMBER_URL, " . "\t" . $DB->DateToCharFunction("T.TIMESTAMP_X") . "\tas TIMESTAMP_X, " . "\t" . $DB->DateToCharFunction("T.DATE_EXECUTE") . "\tas DATE_EXECUTE, " . "\t" . $DB->DateToCharFunction("T.DATE_CREATE") . "\tas DATE_CREATE ";
     }
     $strSql .= "FROM b_controller_task T  " . "\tINNER JOIN b_controller_member M ON T.CONTROLLER_MEMBER_ID=M.ID " . (strlen($strWhere) <= 0 ? "" : "WHERE " . $strWhere) . " " . CControllerAgent::_OrderBy($arOrder, $arFields);
     $dbr = $DB->Query($strSql);
     $dbr->is_filtered = strlen($strWhere) > 0;
     return $dbr;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:23,代码来源:controllertask.php

示例12: GetList

 /**
  * @param array[string]string $arOrder
  * @param array[string]string $arFilter
  * @param array[string]string $arSelect
  * @return CDBResult
  */
 static function GetList($arOrder = false, $arFilter = false, $arSelect = false)
 {
     global $DB;
     if (!is_array($arSelect)) {
         $arSelect = array();
     }
     if (count($arSelect) < 1) {
         $arSelect = array("ID", "ACTIVE", "READ_ONLY", "SORT", "SERVICE_ID", "LOCATION", "BUCKET", "SETTINGS", "CNAME", "PREFIX", "FILE_COUNT", "FILE_SIZE", "LAST_FILE_ID", "FILE_RULES");
     }
     if (!is_array($arOrder)) {
         $arOrder = array();
     }
     $arQueryOrder = array();
     foreach ($arOrder as $strColumn => $strDirection) {
         $strColumn = strtoupper($strColumn);
         $strDirection = strtoupper($strDirection) === "ASC" ? "ASC" : "DESC";
         switch ($strColumn) {
             case "ID":
             case "SORT":
                 $arSelect[] = $strColumn;
                 $arQueryOrder[$strColumn] = $strColumn . " " . $strDirection;
                 break;
             default:
                 break;
         }
     }
     $arQuerySelect = array();
     foreach ($arSelect as $strColumn) {
         $strColumn = strtoupper($strColumn);
         switch ($strColumn) {
             case "ID":
             case "ACTIVE":
             case "READ_ONLY":
             case "SORT":
             case "SERVICE_ID":
             case "LOCATION":
             case "BUCKET":
             case "SETTINGS":
             case "CNAME":
             case "PREFIX":
             case "FILE_COUNT":
             case "FILE_SIZE":
             case "LAST_FILE_ID":
             case "FILE_RULES":
                 $arQuerySelect[$strColumn] = "s." . $strColumn;
                 break;
         }
     }
     if (count($arQuerySelect) < 1) {
         $arQuerySelect = array("ID" => "s.ID");
     }
     $obQueryWhere = new CSQLWhere();
     $arFields = array("ID" => array("TABLE_ALIAS" => "s", "FIELD_NAME" => "s.ID", "FIELD_TYPE" => "int"), "SERVICE_ID" => array("TABLE_ALIAS" => "s", "FIELD_NAME" => "s.SERVICE_ID", "FIELD_TYPE" => "string"), "BUCKET" => array("TABLE_ALIAS" => "s", "FIELD_NAME" => "s.BUCKET", "FIELD_TYPE" => "string"));
     $obQueryWhere->SetFields($arFields);
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     $strQueryWhere = $obQueryWhere->GetQuery($arFilter);
     $bDistinct = $obQueryWhere->bDistinctReqired;
     $strSql = "\n\t\t\tSELECT " . ($bDistinct ? "DISTINCT" : "") . "\n\t\t\t" . implode(", ", $arQuerySelect) . "\n\t\t\tFROM\n\t\t\t\tb_clouds_file_bucket s\n\t\t\t" . $obQueryWhere->GetJoins() . "\n\t\t";
     if ($strQueryWhere != "") {
         $strSql .= "\n\t\t\t\tWHERE\n\t\t\t\t" . $strQueryWhere . "\n\t\t\t";
     }
     if (count($arQueryOrder) > 0) {
         $strSql .= "\n\t\t\t\tORDER BY\n\t\t\t\t" . implode(", ", $arQueryOrder) . "\n\t\t\t";
     }
     return $DB->Query($strSql);
 }
开发者ID:rasuldev,项目名称:torino,代码行数:74,代码来源:storage_bucket.php

示例13: GetFilter

	function GetFilter()
	{
		return $this->obWhere->GetQuery($this->filter);
	}
开发者ID:nycmic,项目名称:bittest,代码行数:4,代码来源:usertype.php

示例14: GetList

 function GetList($arOrder = array(), $arFilter = array())
 {
     global $DB;
     static $arFields = array("ID" => array("FIELD_NAME" => "L.ID", "FIELD_TYPE" => "int"), "CONTROLLER_MEMBER_ID" => array("FIELD_NAME" => "L.CONTROLLER_MEMBER_ID", "FIELD_TYPE" => "int"), "NAME" => array("FIELD_NAME" => "L.NAME", "FIELD_TYPE" => "string"), "TIMESTAMP_X" => array("FIELD_NAME" => "L.TIMESTAMP_X", "FIELD_TYPE" => "datetime"), "TASK_ID" => array("FIELD_NAME" => "L.TASK_ID", "FIELD_TYPE" => "int"), "TASK_NAME" => array("FIELD_NAME" => "T.TASK_ID", "FIELD_TYPE" => "string"), "USER_ID" => array("FIELD_NAME" => "L.USER_ID", "FIELD_TYPE" => "int"), "USER_NAME" => array("FIELD_NAME" => "L.USER_ID", "FIELD_TYPE" => "string"), "USER_LAST_NAME" => array("FIELD_NAME" => "U.LAST_NAME", "FIELD_TYPE" => "string"), "USER_LOGIN" => array("FIELD_NAME" => "U.LOGIN", "FIELD_TYPE" => "string"), "STATUS" => array("FIELD_NAME" => "L.STATUS", "FIELD_TYPE" => "string"), "CONTROLLER_MEMBER_NAME" => array("FIELD_NAME" => "M.NAME", "FIELD_TYPE" => "string"), "CONTROLLER_MEMBER_URL" => array("FIELD_NAME" => "M.URL", "FIELD_TYPE" => "string"));
     $obWhere = new CSQLWhere();
     $obWhere->SetFields($arFields);
     $arFilterNew = array();
     foreach ($arFilter as $k => $value) {
         if (strlen($value) > 0 || $value === false) {
             $arFilterNew[$k] = $value;
         }
     }
     $strWhere = $obWhere->GetQuery($arFilterNew);
     $strSql = "SELECT L.*, " . "\tM.NAME as CONTROLLER_MEMBER_NAME, M.URL as CONTROLLER_MEMBER_URL, " . "\tU.NAME as USER_NAME, U.LAST_NAME as USER_LAST_NAME, U.LOGIN as USER_LOGIN, " . "\tT.TASK_ID as TASK_NAME, " . "\t" . $DB->DateToCharFunction("L.TIMESTAMP_X") . "\tas TIMESTAMP_X " . "FROM b_controller_log L  " . "\tLEFT JOIN b_controller_member M ON L.CONTROLLER_MEMBER_ID=M.ID " . "\tLEFT JOIN b_controller_task T ON T.ID=L.TASK_ID " . "\tLEFT JOIN b_user U ON U.ID=L.USER_ID " . (strlen($strWhere) <= 0 ? "" : "WHERE " . $strWhere) . " " . CControllerAgent::_OrderBy($arOrder, $arFields);
     $dbr = $DB->Query($strSql);
     $dbr->is_filtered = strlen($strWhere) > 0;
     return $dbr;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:18,代码来源:controllerlog.php

示例15: GetList


//.........这里部分代码省略.........
					break;
			}
		}

		static $arWhereFields = array(
			"SCRIPT_NAME" => array(
				"TABLE_ALIAS" => "h",
				"FIELD_NAME" => "h.SCRIPT_NAME",
				"FIELD_TYPE" => "string", //int, double, file, enum, int, string, date, datetime
				"JOIN" => false,
				//"LEFT_JOIN" => "lt",
			),
			"IS_ADMIN" => array(
				"TABLE_ALIAS" => "h",
				"FIELD_NAME" => "h.IS_ADMIN",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"REQUEST_METHOD" => array(
				"TABLE_ALIAS" => "h",
				"FIELD_NAME" => "h.REQUEST_METHOD",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"ID" => array(
				"TABLE_ALIAS" => "h",
				"FIELD_NAME" => "ID",
				"FIELD_TYPE" => "int",
				"JOIN" => false,
			),
			"CACHE_TYPE" => array(
				"TABLE_ALIAS" => "h",
				"FIELD_NAME" => "h.CACHE_TYPE",
				"FIELD_TYPE" => "string",
				"JOIN" => false,
			),
			"MENU_RECALC" => array(
				"TABLE_ALIAS" => "h",
				"FIELD_NAME" => "h.MENU_RECALC",
				"FIELD_TYPE" => "int",
				"JOIN" => false,
			),
		);

		$obQueryWhere = new CSQLWhere;
		$obQueryWhere->SetFields($arWhereFields);

		if(count($arQuerySelect) < 1)
			$arQuerySelect = array("ID"=>"h.ID");

		$strSql = "
			SELECT
			".implode(", ", $arQuerySelect)."
			FROM
				b_perf_hit h
		";
		if(!is_array($arFilter))
			$arFilter = array();
		if($strQueryWhere = $obQueryWhere->GetQuery($arFilter))
		{
			$strSql .= "
				WHERE
				".$strQueryWhere."
			";
		}
		if($bGroup && count($arQueryGroup) > 0)
		{
			$strSql .= "
				GROUP BY
				".implode(", ", $arQueryGroup)."
			";

			$obQueryHaving = new CSQLWhere;
			$obQueryHaving->SetFields(array(
				"COUNT" => array(
					"TABLE_ALIAS" => "",
					"FIELD_NAME" => "COUNT(h.ID)",
					"FIELD_TYPE" => "int",
					"JOIN" => false,
				),
			));
			$strQueryHaving = $obQueryHaving->GetQuery($arFilter);
			if($strQueryHaving)
			{
				$strSql .= "
					HAVING
					".$strQueryHaving."
				";
			}
		}
		if(count($arQueryOrder) > 0)
		{
			$strSql .= "
				ORDER BY
				".implode(", ", $arQueryOrder)."
			";
		}
		//echo "<pre>",htmlspecialcharsbx($strSql),"</pre><hr>";
		return $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:hit.php


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