本文整理汇总了PHP中CDBResult::Fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CDBResult::Fetch方法的具体用法?PHP CDBResult::Fetch怎么用?PHP CDBResult::Fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDBResult
的用法示例。
在下文中一共展示了CDBResult::Fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* @return Array|null
*/
public function fetch()
{
$result = null;
if ($this->resource) {
$result = $this->resource->fetch();
} elseif ($this->resourceCDBResult) {
$result = $this->resourceCDBResult->Fetch();
}
if ($result) {
$result = $this->fetchModifierFields($result);
}
return $result && count($result) > 0 ? $result : null;
}
示例2: 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;
}
示例3: 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();
}
示例4: 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>";
}
示例5: Fetch
function Fetch()
{
static $arSite = array();
$r = parent::Fetch();
if ($r) {
$site_id = $r["SITE_ID"];
if (!isset($arSite[$site_id])) {
$rsSite = CSite::GetList($b, $o, array("ID" => $site_id));
$arSite[$site_id] = $rsSite->Fetch();
}
$r["DIR"] = $arSite[$site_id]["DIR"];
$r["SERVER_NAME"] = $arSite[$site_id]["SERVER_NAME"];
if (strlen($r["SITE_URL"]) > 0) {
$r["URL"] = $r["SITE_URL"];
}
if (substr($r["URL"], 0, 1) == "=") {
foreach (GetModuleEvents("search", "OnSearchGetURL", true) as $arEvent) {
$r["URL"] = ExecuteModuleEventEx($arEvent, array($r));
}
}
$r["URL"] = str_replace(array("#LANG#", "#SITE_DIR#", "#SERVER_NAME#"), array($r["DIR"], $r["DIR"], $r["SERVER_NAME"]), $r["URL"]);
$r["URL"] = preg_replace("'(?<!:)/+'s", "/", $r["URL"]);
unset($r["SITE_URL"]);
}
return $r;
}
示例6: Fetch
public static function Fetch()
{
global $DB;
$res = parent::Fetch();
if (!is_object($this)) {
return $res;
}
if ($res) {
if (isset($res["USER_ID"])) {
$USER_ID = intval($res["USER_ID"]);
} elseif (isset($res["LAST_USER_ID"])) {
$USER_ID = intval($res["LAST_USER_ID"]);
} else {
$USER_ID = 0;
}
if ($USER_ID > 0 && !isset($res["LOGIN"])) {
$rsUser = $DB->Query("\n\t\t\t\t\tSELECT LOGIN, " . $DB->Concat($DB->IsNull("NAME", "''"), "' '", $DB->IsNull("LAST_NAME", "''")) . " USER_NAME\n\t\t\t\t\tFROM b_user\n\t\t\t\t\tWHERE ID = " . $USER_ID . "\n\t\t\t\t");
$arUser = $rsUser->Fetch();
if (is_array($arUser)) {
$res["LOGIN"] = $arUser["LOGIN"];
$res["USER_NAME"] = $arUser["USER_NAME"];
} else {
$res["LOGIN"] = "";
$res["USER_NAME"] = " ";
}
}
}
return $res;
}
示例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;
}
示例8: Fetch
function Fetch()
{
$a = parent::Fetch();
if ($a && defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("iblock_property_enum_" . $a["PROPERTY_ID"]);
}
return $a;
}
示例9: Fetch
function Fetch()
{
$r = parent::Fetch();
if($r)
{
$r["ID"] = $r["CITY_ID"];
$r["NAME"] = $r["CITY_NAME"];
}
return $r;
}
示例10: Fetch
public function Fetch()
{
$r = parent::Fetch();
if($r)
{
if(strlen($r["SITE_URL"])>0)
$r["URL"] = $r["SITE_URL"];
if(substr($r["URL"], 0, 1)=="=")
{
$events = GetModuleEvents("search", "OnSearchGetURL");
while ($arEvent = $events->Fetch())
$r["URL"] = ExecuteModuleEventEx($arEvent, array($r));
}
$r["URL"] = str_replace(
array("#LANG#", "#SITE_DIR#", "#SERVER_NAME#"),
array($r["DIR"], $r["DIR"], $r["SERVER_NAME"]),
$r["URL"]
);
$r["URL"] = preg_replace("'(?<!:)/+'s", "/", $r["URL"]);
$r["NAME"] = htmlspecialcharsex($r["TITLE"]);
$preg_template = "/(^|[^".$this->_arStemFunc["pcre_letters"]."])(".str_replace("/", "\\/", implode("|", array_map('preg_quote', array_keys($this->_arPhrase)))).")/i".BX_UTF_PCRE_MODIFIER;
if(preg_match_all($preg_template, ToUpper($r["NAME"]), $arMatches, PREG_OFFSET_CAPTURE))
{
$c = count($arMatches[2]);
if(defined("BX_UTF"))
{
for($j = $c-1; $j >= 0; $j--)
{
$prefix = mb_substr($r["NAME"], 0, $arMatches[2][$j][1], 'latin1');
$instr = mb_substr($r["NAME"], $arMatches[2][$j][1], mb_strlen($arMatches[2][$j][0], 'latin1'), 'latin1');
$suffix = mb_substr($r["NAME"], $arMatches[2][$j][1] + mb_strlen($arMatches[2][$j][0], 'latin1'), mb_strlen($r["NAME"], 'latin1'), 'latin1');
$r["NAME"] = $prefix."<b>".$instr."</b>".$suffix;
}
}
else
{
for($j = $c-1; $j >= 0; $j--)
{
$prefix = substr($r["NAME"], 0, $arMatches[2][$j][1]);
$instr = substr($r["NAME"], $arMatches[2][$j][1], strlen($arMatches[2][$j][0]));
$suffix = substr($r["NAME"], $arMatches[2][$j][1]+strlen($arMatches[2][$j][0]));
$r["NAME"] = $prefix."<b>".$instr."</b>".$suffix;
}
}
}
}
return $r;
}
示例11: 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;
}
示例12: Fetch
public static function Fetch()
{
global $DB;
$ar = parent::Fetch();
if ($ar) {
if (isset($ar["Tables_in_" . $DB->DBName])) {
$ar = array("TABLE_NAME" => $ar["Tables_in_" . $DB->DBName], "ENGINE_TYPE" => "", "NUM_ROWS" => "", "BYTES" => "");
} else {
$ar = array("TABLE_NAME" => $ar["Name"], "ENGINE_TYPE" => $ar["Comment"] === "VIEW" ? "VIEW" : $ar["Engine"], "NUM_ROWS" => $ar["Rows"], "BYTES" => $ar["Data_length"]);
}
}
return $ar;
}
示例13: 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;
}
示例14: GetCityList
public static function GetCityList() {
$arResult = array();
$rsData = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter'=>array('NAME'=>CITY_LIST_HLB)));
if ( !($arData = $rsData->fetch()) ){
echo 'Инфоблок не найден';
} else {
$Entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($arData);
$Query = new \Bitrix\Main\Entity\Query($Entity);
$Query->setSelect(array('*'));
$result = $Query->exec();
$result = new CDBResult($result);
while ($row = $result->Fetch()){
$arResult[$row['UF_CITY_CODE']] = $row['UF_CITY_NAME'];
}
}
return $arResult;
}
示例15: GetMoreChatMessage
function GetMoreChatMessage($pageId, $chatId, $bTimeZone = true)
{
global $DB;
$iNumPage = 1;
if (intval($pageId) > 0) {
$iNumPage = intval($pageId);
}
$chatId = IntVal($chatId);
$limitById = '';
$ar = \CIMChat::GetRelationById($chatId, $this->user_id);
if ($ar && $ar['START_ID'] > 0) {
$limitById = 'AND M.ID >= ' . intval($ar['START_ID']);
}
$strSql = "\n\t\t\tSELECT COUNT(M.ID) as CNT\n\t\t\tFROM b_im_message M\n\t\t\tINNER JOIN b_im_relation R1 ON M.CHAT_ID = R1.CHAT_ID\n\t\t\tWHERE R1.CHAT_ID = " . $chatId . " AND R1.USER_ID = " . $this->user_id . " " . $limitById . "\n\t\t";
$res_cnt = $DB->Query($strSql);
$res_cnt = $res_cnt->Fetch();
$cnt = $res_cnt["CNT"];
$arMessages = array();
$arMessageFiles = array();
$arMessageId = array();
$usersMessage = array();
if ($cnt > 0 && ceil($cnt / 20) >= $iNumPage) {
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\t" . $DB->DatetimeToTimestampFunction('M.DATE_CREATE') . " DATE_CREATE,\n\t\t\t\t\tM.AUTHOR_ID\n\t\t\t\tFROM b_im_message M\n\t\t\t\tINNER JOIN b_im_relation R1 ON M.CHAT_ID = R1.CHAT_ID\n\t\t\t\tWHERE R1.CHAT_ID = " . $chatId . " AND R1.USER_ID = " . $this->user_id . " " . $limitById . "\n\t\t\t\tORDER BY M.DATE_CREATE DESC, M.ID DESC\n\t\t\t";
if (!$bTimeZone) {
CTimeZone::Enable();
}
$dbRes = new CDBResult();
$dbRes->NavQuery($strSql, $cnt, array('iNumPage' => $iNumPage, 'nPageSize' => 20));
$CCTP = new CTextParser();
$CCTP->MaxStringLen = 200;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => $this->bHideLink ? "N" : "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => $this->bHideLink ? "N" : "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
while ($arRes = $dbRes->Fetch()) {
$arMessages[$arRes['ID']] = array('id' => $arRes['ID'], 'chatId' => $arRes['CHAT_ID'], 'senderId' => $arRes['AUTHOR_ID'], 'recipientId' => $arRes['CHAT_ID'], 'date' => $arRes['DATE_CREATE'], 'system' => $arRes['AUTHOR_ID'] > 0 ? 'N' : 'Y', 'text' => $CCTP->convertText(htmlspecialcharsbx($arRes['MESSAGE'])));
$usersMessage[$arRes['CHAT_ID']][] = $arRes['ID'];
$arMessageId[] = $arRes['ID'];
}
$params = CIMMessageParam::Get($arMessageId);
$arFiles = array();
foreach ($params as $messageId => $param) {
$arMessages[$messageId]['params'] = $param;
if (isset($param['FILE_ID'])) {
foreach ($param['FILE_ID'] as $fileId) {
$arFiles[$fileId] = $fileId;
}
}
}
$arMessageFiles = CIMDisk::GetFiles($chatId, $arFiles);
}
return array('chatId' => $chatId, 'message' => $arMessages, 'usersMessage' => $usersMessage, 'files' => $arMessageFiles);
}