m_database.query("INSERT INTO " + table_name(table_users) + " (u_down_total, u_up_total, " + column_name(column_users_uid) + ", u_up_release, u_up_bonus, max_up_speed, max_down_speed) VALUES "
+ m_users_updates_buffer
+ " on duplicate key update"
+ " u_down_total = u_down_total + values(u_down_total),"
+ " u_up_total = u_up_total + values(u_up_total),"
+ " u_up_release = u_up_release + values(u_up_release),"
+ " u_up_bonus = u_up_bonus + values(u_up_bonus),"
+ " max_up_speed = GREATEST(max_up_speed, values(max_up_speed)),"
+ " max_down_speed = GREATEST(max_down_speed, values(max_down_speed)),"
+ " down_today = down_today + values(ufreetorrent.fr.nf_down_total),"
+ " up_today = up_today + values(up_total),"
+ " release_today = release_today + values(up_release),"
+ " bonus_today = bonus_today + values(up_bonus)");
m_database.query("INSERT INTO " + table_name(table_users) + " (" + column_name(column_users_uid) + ", u_down_total, u_up_total, u_up_release, u_up_bonus) VALUES "
+ m_users_updates_buffer
+ " ON DUPLICATE KEY UPDATE"
+ " u_down_total = u_down_total + values(u_down_total),"
+ " u_up_total = u_up_total + values(u_up_total),"
+ " u_up_release = u_up_release + values(u_up_release),"
+ " u_up_bonus = u_up_bonus + values(u_up_bonus),"
+ " down_today = down_today + values(u_down_total),"
+ " up_today = up_today + values(u_up_total),"
+ " up_release_today = up_release_today + values(u_up_release),"
+ " up_bonus_today = up_bonus_today + values(u_up_bonus)");
if (downloaded_db || uploaded)
{
Csql_query q(m_database, "(?,?,?,?,?),");
q.p(user->uid);
q.p(downloaded_db);
q.p(uploaded);
q.p(rel);
q.p(bonus ? uploaded/bonus : 0);
m_users_updates_buffer += q.read();
}
ALTER TABLE `bb_bt_users` ADD `max_up_speed` mediumint(8) unsigned NOT NULL DEFAULT '0';
ALTER TABLE `bb_bt_users` ADD `max_down_speed` mediumint(8) unsigned NOT NULL DEFAULT '0';
CREATE TABLE `bb_bt_cheat_log` (
`cheat_id` mediumint(8) NOT NULL AUTO_INCREMENT,
`cheat_user_id` mediumint(8) NOT NULL DEFAULT '0',
`cheat_uploaded` bigint(20) unsigned NOT NULL DEFAULT '0',
`cheat_ip` char(32) NOT NULL DEFAULT '',
`cheat_log_time` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`cheat_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
long long cheat = (long long) m_config.m_cheat_upload * 1024 * 1024 * 1024;
long long cheat = (long long) m_config.m_cheat_upload * 1024 * 1024;