本文整理汇总了PHP中sql_query::fetch_affected_rows方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_query::fetch_affected_rows方法的具体用法?PHP sql_query::fetch_affected_rows怎么用?PHP sql_query::fetch_affected_rows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql_query
的用法示例。
在下文中一共展示了sql_query::fetch_affected_rows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
function log_retention_clean()
{
log_write("debug", "changelog", "Executing log_retention_clean()");
log_write("debug", "changelog", "A retention clean is required - last one was more than 24 hours ago.");
// calc date to clean up to
$clean_time = time() - $GLOBALS["config"]["LOG_RETENTION_PERIOD"] * 86400;
$clean_date = time_format_humandate($clean_time);
// clean
$obj_sql_clean = new sql_query();
$obj_sql_clean->string = "DELETE FROM logs WHERE timestamp <= '{$clean_time}'";
$obj_sql_clean->execute();
$clean_removed = $obj_sql_clean->fetch_affected_rows();
unset($obj_sql_clean);
// update rentention time check
$obj_sql_clean = new sql_query();
$obj_sql_clean->string = "UPDATE `config` SET value='" . time() . "' WHERE name='LOG_RETENTION_CHECKTIME' LIMIT 1";
$obj_sql_clean->execute();
unset($obj_sql_clean);
// add audit entry - we have to set the LOG_RETENTION_CHECKTIME variable here to avoid
// looping the program, as the SQL change above won't be applied until the current transaction
// is commited.
$GLOBALS["config"]["LOG_RETENTION_CHECKTIME"] = time();
$this->log_post("audit", "Automated log retention clean completed, removed {$clean_removed} records order than {$clean_date}");
// complete
log_write("debug", "changelog", "Completed retention log clean, removed {$clean_removed} log records older than {$clean_date}");
return 1;
}