*** empty log message ***

svn path=/trunk/boinc/; revision=4289
This commit is contained in:
David Anderson 2004-10-04 23:23:57 +00:00
parent 5b51f17d3b
commit 4fc2e50397
5 changed files with 61 additions and 32 deletions

View File

@ -18025,3 +18025,18 @@ David 4 Oct 2004
db_base.h
client/
cs_scheduler.C
David 4 Oct 2004
- changed DB code to allow for the use of read-only DB replicas
Here's what you can do now:
DB_CONN replica;
replica.open(name, host, user, passwd);
DB_USER user(replica);
user.enumerate(...)
... and this can be intermixed with access to the master DB (boinc_db).
db/
boinc_db.C,h
db_base.C,h

View File

@ -60,20 +60,34 @@ void MSG_TO_HOST::clear() {memset(this, 0, sizeof(*this));}
void TRANSITIONER_ITEM::clear() {memset(this, 0, sizeof(*this));}
void SCHED_RESULT_ITEM::clear() {memset(this, 0, sizeof(*this));}
DB_PLATFORM::DB_PLATFORM() : DB_BASE(boinc_db, "platform"){}
DB_CORE_VERSION::DB_CORE_VERSION() : DB_BASE(boinc_db, "core_version"){}
DB_APP::DB_APP() : DB_BASE(boinc_db, "app"){}
DB_APP_VERSION::DB_APP_VERSION() : DB_BASE(boinc_db, "app_version"){}
DB_USER::DB_USER() : DB_BASE(boinc_db, "user"){}
DB_TEAM::DB_TEAM() : DB_BASE(boinc_db, "team"){}
DB_HOST::DB_HOST() : DB_BASE(boinc_db, "host"){}
DB_WORKUNIT::DB_WORKUNIT() : DB_BASE(boinc_db, "workunit"){}
DB_RESULT::DB_RESULT() : DB_BASE(boinc_db, "result"){}
DB_MSG_FROM_HOST::DB_MSG_FROM_HOST() : DB_BASE(boinc_db, "msg_from_host"){}
DB_MSG_TO_HOST::DB_MSG_TO_HOST() : DB_BASE(boinc_db, "msg_to_host"){}
DB_TRANSITIONER_ITEM_SET::DB_TRANSITIONER_ITEM_SET() : DB_BASE_SPECIAL(boinc_db){}
DB_WORK_ITEM::DB_WORK_ITEM() : DB_BASE_SPECIAL(boinc_db){}
DB_SCHED_RESULT_ITEM_SET::DB_SCHED_RESULT_ITEM_SET() : DB_BASE_SPECIAL(boinc_db){}
DB_PLATFORM::DB_PLATFORM(DB_CONN* dc) :
DB_BASE("platform", dc?dc:&boinc_db){}
DB_CORE_VERSION::DB_CORE_VERSION(DB_CONN* dc) :
DB_BASE("core_version", dc?dc:&boinc_db){}
DB_APP::DB_APP(DB_CONN* dc) :
DB_BASE("app", dc?dc:&boinc_db){}
DB_APP_VERSION::DB_APP_VERSION(DB_CONN* dc) :
DB_BASE("app_version", dc?dc:&boinc_db){}
DB_USER::DB_USER(DB_CONN* dc) :
DB_BASE("user", dc?dc:&boinc_db){}
DB_TEAM::DB_TEAM(DB_CONN* dc) :
DB_BASE("team", dc?dc:&boinc_db){}
DB_HOST::DB_HOST(DB_CONN* dc) :
DB_BASE("host", dc?dc:&boinc_db){}
DB_WORKUNIT::DB_WORKUNIT(DB_CONN* dc) :
DB_BASE("workunit", dc?dc:&boinc_db){}
DB_RESULT::DB_RESULT(DB_CONN* dc) :
DB_BASE("result", dc?dc:&boinc_db){}
DB_MSG_FROM_HOST::DB_MSG_FROM_HOST(DB_CONN* dc) :
DB_BASE("msg_from_host", dc?dc:&boinc_db){}
DB_MSG_TO_HOST::DB_MSG_TO_HOST(DB_CONN* dc) :
DB_BASE("msg_to_host", dc?dc:&boinc_db){}
DB_TRANSITIONER_ITEM_SET::DB_TRANSITIONER_ITEM_SET(DB_CONN* dc) :
DB_BASE_SPECIAL(dc?dc:&boinc_db){}
DB_WORK_ITEM::DB_WORK_ITEM(DB_CONN* dc) :
DB_BASE_SPECIAL(dc?dc:&boinc_db){}
DB_SCHED_RESULT_ITEM_SET::DB_SCHED_RESULT_ITEM_SET(DB_CONN* dc) :
DB_BASE_SPECIAL(dc?dc:&boinc_db){}
int DB_PLATFORM::get_id() {return id;}
int DB_CORE_VERSION::get_id() {return id;}

View File

@ -466,7 +466,7 @@ struct TRANSITIONER_ITEM {
class DB_PLATFORM : public DB_BASE, public PLATFORM {
public:
DB_PLATFORM();
DB_PLATFORM(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -474,7 +474,7 @@ public:
class DB_CORE_VERSION : public DB_BASE, public CORE_VERSION {
public:
DB_CORE_VERSION();
DB_CORE_VERSION(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -482,7 +482,7 @@ public:
class DB_APP : public DB_BASE, public APP {
public:
DB_APP();
DB_APP(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -490,7 +490,7 @@ public:
class DB_APP_VERSION : public DB_BASE, public APP_VERSION {
public:
DB_APP_VERSION();
DB_APP_VERSION(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -498,7 +498,7 @@ public:
class DB_USER : public DB_BASE, public USER {
public:
DB_USER();
DB_USER(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -507,7 +507,7 @@ public:
class DB_TEAM : public DB_BASE, public TEAM {
public:
DB_TEAM();
DB_TEAM(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -515,7 +515,7 @@ public:
class DB_HOST : public DB_BASE, public HOST {
public:
DB_HOST();
DB_HOST(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -524,7 +524,7 @@ public:
class DB_RESULT : public DB_BASE, public RESULT {
public:
DB_RESULT();
DB_RESULT(DB_CONN* p=0);
int get_id();
int update_subset();
void db_print(char*);
@ -535,7 +535,7 @@ public:
class DB_WORKUNIT : public DB_BASE, public WORKUNIT {
public:
DB_WORKUNIT();
DB_WORKUNIT(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -544,7 +544,7 @@ public:
class DB_MSG_FROM_HOST : public DB_BASE, public MSG_FROM_HOST {
public:
DB_MSG_FROM_HOST();
DB_MSG_FROM_HOST(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -552,7 +552,7 @@ public:
class DB_MSG_TO_HOST : public DB_BASE, public MSG_TO_HOST {
public:
DB_MSG_TO_HOST();
DB_MSG_TO_HOST(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
@ -563,7 +563,7 @@ public:
//
class DB_TRANSITIONER_ITEM_SET : public DB_BASE_SPECIAL {
public:
DB_TRANSITIONER_ITEM_SET();
DB_TRANSITIONER_ITEM_SET(DB_CONN* p=0);
TRANSITIONER_ITEM last_item;
int nitems_this_query;
@ -586,7 +586,7 @@ struct WORK_ITEM {
class DB_WORK_ITEM : public WORK_ITEM, public DB_BASE_SPECIAL {
public:
DB_WORK_ITEM();
DB_WORK_ITEM(DB_CONN* p=0);
// CURSOR cursor;
int enumerate(int limit);
// used by feeder
@ -623,7 +623,7 @@ struct SCHED_RESULT_ITEM {
class DB_SCHED_RESULT_ITEM_SET : public DB_BASE_SPECIAL {
public:
DB_SCHED_RESULT_ITEM_SET();
DB_SCHED_RESULT_ITEM_SET(DB_CONN* p=0);
std::vector<SCHED_RESULT_ITEM> results;
int add_result(char* result_name);

View File

@ -68,7 +68,7 @@ int DB_CONN::commit_transaction() {
return do_query("COMMIT");
}
DB_BASE::DB_BASE(DB_CONN& p, char *tn) : db(&p), table_name(tn) {
DB_BASE::DB_BASE(char *tn, DB_CONN* p) : db(p), table_name(tn) {
is_high_priority = false;
}
@ -290,7 +290,7 @@ int DB_BASE::sum(double& x, char* field, char* clause) {
}
DB_BASE_SPECIAL::DB_BASE_SPECIAL(DB_CONN& p) : db(&p) {
DB_BASE_SPECIAL::DB_BASE_SPECIAL(DB_CONN* p) : db(p) {
}
// convert a string into a form that allows it to be used

View File

@ -77,7 +77,7 @@ public:
//
class DB_BASE {
public:
DB_BASE(DB_CONN&, char *table_name);
DB_BASE(char *table_name, DB_CONN*);
int insert();
int insert_batch(const char*);
int update();
@ -107,7 +107,7 @@ public:
//
class DB_BASE_SPECIAL {
public:
DB_BASE_SPECIAL(DB_CONN&);
DB_BASE_SPECIAL(DB_CONN*);
DB_CONN* db;
CURSOR cursor;