int CDBResult::AffectedRowsCount()
The method AffectedRowsCount returns a number of records modified by executing such SQL commands as "INSERT", "UPDATE" or "DELETE".
Number of records modified.
<?
$strSql = "
INSERT INTO b_stat_day(
ID,
DATE_STAT,
TOTAL_HOSTS)
SELECT
SQ_B_STAT_DAY.NEXTVAL,
trunc(SYSDATE),
nvl(PREV.MAX_TOTAL_HOSTS,0)
FROM
(SELECT max(TOTAL_HOSTS) AS MAX_TOTAL_HOSTS FROM b_stat_day) PREV
WHERE
not exists(SELECT 'x' FROM b_stat_day D WHERE TRUNC(D.DATE_STAT) = TRUNC(SYSDATE))
";
$q = $DB->Query($strSql, true, $err_mess.__LINE__);
if ($q && intval($q->AffectedRowsCount())>0)
{
$arFields = Array("LAST"=>"'N'");
$DB->Update("b_stat_adv_day",$arFields,"WHERE LAST='Y'", $err_mess.__LINE__);
$DB->Update("b_stat_adv_event_day",$arFields,"WHERE LAST='Y'", $err_mess.__LINE__);
$DB->Update("b_stat_searcher_day",$arFields,"WHERE LAST='Y'", $err_mess.__LINE__);
$DB->Update("b_stat_event_day",$arFields,"WHERE LAST='Y'", $err_mess.__LINE__);
$DB->Update("b_stat_country_day",$arFields,"WHERE LAST='Y'", $err_mess.__LINE__);
$DB->Update("b_stat_guest",$arFields,"WHERE LAST='Y'",$err_mess.__LINE__);
$DB->Update("b_stat_session",$arFields,"WHERE LAST='Y'",$err_mess.__LINE__);
}
?>
| © 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |