mirror of https://github.com/BOINC/boinc.git
Client spamming server hotfix
svn path=/trunk/boinc/; revision=3777
This commit is contained in:
parent
7ecb260627
commit
35303cae47
|
@ -14586,7 +14586,6 @@ Daniel 2004-07-03
|
|||
Rom 3 July 2004
|
||||
- Introduce basic transaction support for performance DB class.
|
||||
- Implement basic transsction support for the transitioner.
|
||||
NOTE: Creating new results is not currently supported by the transaction.
|
||||
|
||||
db/
|
||||
boinc_db.C
|
||||
|
|
|
@ -717,7 +717,7 @@ int DB_TRANSITIONER_ITEM_SET::update_result(TRANSITIONER_ITEM& ti) {
|
|||
ti.res_file_delete_state,
|
||||
ti.res_id
|
||||
);
|
||||
return append_transaction(query);
|
||||
return db->do_query(query);
|
||||
}
|
||||
|
||||
int DB_TRANSITIONER_ITEM_SET::update_workunit(TRANSITIONER_ITEM& ti) {
|
||||
|
@ -732,7 +732,7 @@ int DB_TRANSITIONER_ITEM_SET::update_workunit(TRANSITIONER_ITEM& ti) {
|
|||
ti.transition_time,
|
||||
ti.id
|
||||
);
|
||||
return append_transaction(query);
|
||||
return db->do_query(query);
|
||||
}
|
||||
|
||||
void WORK_ITEM::parse(MYSQL_ROW& r) {
|
||||
|
|
47
db/db_base.C
47
db/db_base.C
|
@ -41,9 +41,9 @@ int DB_CONN::insert_id() {
|
|||
MYSQL_RES* rp;
|
||||
|
||||
if (mysql) {
|
||||
retval = do_query("select HIGH_PRIORITY LAST_INSERT_ID()");
|
||||
retval = do_query("select HIGH_PRIORITY LAST_INSERT_ID();");
|
||||
} else {
|
||||
retval = do_query("select LAST_INSERT_ID()");
|
||||
retval = do_query("select LAST_INSERT_ID();");
|
||||
}
|
||||
|
||||
if (retval) return retval;
|
||||
|
@ -77,7 +77,7 @@ void DB_BASE::db_parse(MYSQL_ROW&) {}
|
|||
int DB_BASE::insert() {
|
||||
char vals[MAX_QUERY_LEN], query[MAX_QUERY_LEN];
|
||||
db_print(vals);
|
||||
sprintf(query, "insert into %s set %s", table_name, vals);
|
||||
sprintf(query, "insert into %s set %s;", table_name, vals);
|
||||
return db->do_query(query);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ int DB_BASE::insert() {
|
|||
int DB_BASE::update() {
|
||||
char vals[MAX_QUERY_LEN], query[MAX_QUERY_LEN];
|
||||
db_print(vals);
|
||||
sprintf(query, "update %s set %s where id=%d", table_name, vals, get_id());
|
||||
sprintf(query, "update %s set %s where id=%d;", table_name, vals, get_id());
|
||||
return db->do_query(query);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ int DB_BASE::update() {
|
|||
//
|
||||
int DB_BASE::update_field(char* clause) {
|
||||
char query[MAX_QUERY_LEN];
|
||||
sprintf(query, "update %s set %s where id=%d", table_name, clause, get_id());
|
||||
sprintf(query, "update %s set %s where id=%d;", table_name, clause, get_id());
|
||||
return db->do_query(query);
|
||||
}
|
||||
|
||||
|
@ -106,9 +106,9 @@ int DB_BASE::lookup(char* clause) {
|
|||
MYSQL_RES* rp;
|
||||
|
||||
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 {
|
||||
sprintf(query, "select * from %s %s", table_name, clause);
|
||||
sprintf(query, "select * from %s %s;", table_name, clause);
|
||||
}
|
||||
|
||||
retval = db->do_query(query);
|
||||
|
@ -134,9 +134,9 @@ int DB_BASE::lookup_id(int id) {
|
|||
MYSQL_RES* rp;
|
||||
|
||||
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 {
|
||||
sprintf(query, "select * from %s where id=%d", table_name, id);
|
||||
sprintf(query, "select * from %s where id=%d;", table_name, id);
|
||||
}
|
||||
|
||||
retval = db->do_query(query);
|
||||
|
@ -161,9 +161,9 @@ int DB_BASE::enumerate(char* clause) {
|
|||
cursor.active = true;
|
||||
|
||||
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 {
|
||||
sprintf(query, "select * from %s %s", table_name, clause);
|
||||
sprintf(query, "select * from %s %s;", table_name, clause);
|
||||
}
|
||||
|
||||
x = db->do_query(query);
|
||||
|
@ -230,9 +230,9 @@ int DB_BASE::count(int& n, char* clause) {
|
|||
char query[MAX_QUERY_LEN];
|
||||
|
||||
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 {
|
||||
sprintf(query, "select count(*) from %s %s", table_name, clause);
|
||||
sprintf(query, "select count(*) from %s %s;", table_name, clause);
|
||||
}
|
||||
|
||||
return get_integer(query, n);
|
||||
|
@ -242,9 +242,9 @@ int DB_BASE::sum(double& x, char* field, char* clause) {
|
|||
char query[MAX_QUERY_LEN];
|
||||
|
||||
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 {
|
||||
sprintf(query, "select sum(%s) from %s %s", field, table_name, clause);
|
||||
sprintf(query, "select sum(%s) from %s %s;", field, table_name, clause);
|
||||
}
|
||||
|
||||
return get_double(query, x);
|
||||
|
@ -256,24 +256,11 @@ DB_BASE_SPECIAL::DB_BASE_SPECIAL(DB_CONN& p) : db(&p) {
|
|||
}
|
||||
|
||||
int DB_BASE_SPECIAL::start_transaction() {
|
||||
if (!strcpy(transactional_query, "START TRANSACTION;")) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DB_BASE_SPECIAL::append_transaction(char* next_query) {
|
||||
if (!strcat(transactional_query, next_query)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
return db->do_query("START TRANSACTION;");;
|
||||
}
|
||||
|
||||
int DB_BASE_SPECIAL::commit_transaction() {
|
||||
if (!strcat(transactional_query, "COMMIT;")) {
|
||||
return -1;
|
||||
}
|
||||
return db->do_query(transactional_query);
|
||||
return db->do_query("COMMIT;");
|
||||
}
|
||||
|
||||
// convert a string into a form that allows it to be used
|
||||
|
|
|
@ -105,12 +105,8 @@ public:
|
|||
|
||||
DB_CONN* db;
|
||||
CURSOR cursor;
|
||||
char transactional_query[MAX_QUERY_LEN];
|
||||
|
||||
// NOTE: This transaction implementation does NOT
|
||||
// ssuport nested transactions.
|
||||
int start_transaction();
|
||||
int append_transaction(char* next_query);
|
||||
int commit_transaction();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue