Client spamming server hotfix

svn path=/trunk/boinc/; revision=3726
This commit is contained in:
Rom Walton 2004-06-30 18:25:14 +00:00
parent 7cd5c7911a
commit 7ab5c16f17
2 changed files with 8 additions and 7 deletions

View File

@ -15,7 +15,6 @@
DB_CONN::DB_CONN() { DB_CONN::DB_CONN() {
mysql = 0; mysql = 0;
is_high_priority = false;
} }
int DB_CONN::open(char* db_name, char* db_host, char* db_user, char* dbpassword) { int DB_CONN::open(char* db_name, char* db_host, char* db_user, char* dbpassword) {
@ -44,7 +43,7 @@ int DB_CONN::insert_id() {
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES* rp; MYSQL_RES* rp;
if (mysql && is_high_priority) { if (mysql) {
retval = do_query("select HIGH_PRIORITY LAST_INSERT_ID()"); retval = do_query("select HIGH_PRIORITY LAST_INSERT_ID()");
} else { } else {
retval = do_query("select LAST_INSERT_ID()"); retval = do_query("select LAST_INSERT_ID()");
@ -70,6 +69,7 @@ const char* DB_CONN::error_string() {
DB_BASE::DB_BASE(DB_CONN& p, char *tn) : db(&p), table_name(tn) { DB_BASE::DB_BASE(DB_CONN& p, char *tn) : db(&p), table_name(tn) {
cursor.active = false; cursor.active = false;
is_high_priority = false;
} }
int DB_BASE::get_id() { return 0;} int DB_BASE::get_id() { return 0;}
@ -108,7 +108,7 @@ int DB_BASE::lookup(char* clause) {
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES* rp; MYSQL_RES* rp;
if (db->mysql && db->is_high_priority) { if (db->mysql && is_high_priority) {
sprintf(query, "select HIGH_PRIORITY * from %s %s", table_name, clause); sprintf(query, "select HIGH_PRIORITY * from %s %s", table_name, clause);
} else { } else {
sprintf(query, "select * from %s %s", table_name, clause); sprintf(query, "select * from %s %s", table_name, clause);
@ -136,7 +136,7 @@ int DB_BASE::lookup_id(int id) {
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES* rp; MYSQL_RES* rp;
if (db->mysql && db->is_high_priority) { if (db->mysql && is_high_priority) {
sprintf(query, "select HIGH_PRIORITY * from %s where id=%d", table_name, id); sprintf(query, "select HIGH_PRIORITY * from %s where id=%d", table_name, id);
} else { } else {
sprintf(query, "select * from %s where id=%d", table_name, id); sprintf(query, "select * from %s where id=%d", table_name, id);
@ -163,7 +163,7 @@ int DB_BASE::enumerate(char* clause) {
if (!cursor.active) { if (!cursor.active) {
cursor.active = true; cursor.active = true;
if (db->mysql && db->is_high_priority) { if (db->mysql && is_high_priority) {
sprintf(query, "select HIGH_PRIORITY * from %s %s", table_name, clause); sprintf(query, "select HIGH_PRIORITY * from %s %s", table_name, clause);
} else { } else {
sprintf(query, "select * from %s %s", table_name, clause); sprintf(query, "select * from %s %s", table_name, clause);
@ -232,7 +232,7 @@ int DB_BASE::get_double(char* query, double& x) {
int DB_BASE::count(int& n, char* clause) { int DB_BASE::count(int& n, char* clause) {
char query[MAX_QUERY_LEN]; char query[MAX_QUERY_LEN];
if (db->mysql && db->is_high_priority) { if (db->mysql && is_high_priority) {
sprintf(query, "select HIGH_PRIORITY count(*) from %s %s", table_name, clause); sprintf(query, "select HIGH_PRIORITY count(*) from %s %s", table_name, clause);
} else { } else {
sprintf(query, "select count(*) from %s %s", table_name, clause); sprintf(query, "select count(*) from %s %s", table_name, clause);
@ -244,7 +244,7 @@ int DB_BASE::count(int& n, char* clause) {
int DB_BASE::sum(double& x, char* field, char* clause) { int DB_BASE::sum(double& x, char* field, char* clause) {
char query[MAX_QUERY_LEN]; char query[MAX_QUERY_LEN];
if (db->mysql && db->is_high_priority) { if (db->mysql && is_high_priority) {
sprintf(query, "select HIGH_PRIORITY sum(%s) from %s %s", field, table_name, clause); sprintf(query, "select HIGH_PRIORITY sum(%s) from %s %s", field, table_name, clause);
} else { } else {
sprintf(query, "select sum(%s) from %s %s", field, table_name, clause); sprintf(query, "select sum(%s) from %s %s", field, table_name, clause);

View File

@ -60,6 +60,7 @@ public:
int sum(double&, char* field, char* clause=""); int sum(double&, char* field, char* clause="");
int get_double(char* query, double&); int get_double(char* query, double&);
int get_integer(char* query, int&); int get_integer(char* query, int&);
bool is_high_priority;
DB_CONN* db; DB_CONN* db;
const char *table_name; const char *table_name;