Documentation

AffectedRowsCount

int
CDBResult::AffectedRowsCount()

The method returns the number of records, modified by such SQL commands as INSERT, UPDATE or DELETE. Non-static method.


Parameters

No parameters.

See also

Examples of use

<?
$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__);
}
?>


© «Bitrix24», 2001-2024