db: Add consent_type table to C++ database API.

This commit is contained in:
Shawn Kwang 2018-08-28 13:24:20 -05:00
parent 74a545460a
commit 06ba429ca4
3 changed files with 48 additions and 0 deletions

View File

@ -112,6 +112,7 @@ void BADGE_USER::clear() {memset(this, 0, sizeof(*this));}
void BADGE_TEAM::clear() {memset(this, 0, sizeof(*this));}
void CREDIT_USER::clear() {memset(this, 0, sizeof(*this));}
void CREDIT_TEAM::clear() {memset(this, 0, sizeof(*this));}
void CONSENT_TYPE::clear() {memset(this, 0, sizeof(*this));}
DB_PLATFORM::DB_PLATFORM(DB_CONN* dc) :
DB_BASE("platform", dc?dc:&boinc_db){}
@ -2865,4 +2866,33 @@ void DB_CREDIT_TEAM::db_parse(MYSQL_ROW &r) {
credit_type = atoi(r[i++]);
}
void DB_CONSENT_TYPE::db_print(char *buf) {
sprintf(buf,
"id=%lu, "
"shortname='%s', "
"description='%s', "
"enabled=%d, "
"protected=%d, "
"privacypref=%d, ",
id,
shortname,
description,
enabled,
protectedct,
privacypref
);
}
void DB_CONSENT_TYPE::db_parse(MYSQL_ROW &r) {
int i=0;
clear();
id = atol(r[i++]);
strcpy2(shortname, r[i++]);
strcpy2(description, r[i++]);
enabled = atoi(r[i++]);
protectedct = atoi(r[i++]);
privacypref = atoi(r[i++]);
}
const char *BOINC_RCSID_ac374386c8 = "$Id$";

View File

@ -568,4 +568,12 @@ struct DB_CREDIT_TEAM : public DB_BASE, public CREDIT_TEAM {
void db_parse(MYSQL_ROW&);
};
struct DB_CONSENT_TYPE : public DB_BASE, public CONSENT_TYPE {
DB_CONSENT_TYPE(DB_CONN* p=0);
DB_ID_TYPE get_id();
void db_print(char *);
void db_parse(MYSQL_ROW &row);
};
#endif

View File

@ -849,4 +849,14 @@ struct CREDIT_TEAM {
void clear();
};
struct CONSENT_TYPE {
DB_ID_TYPE id;
char shortname[256];
char description[256];
int enabled;
int protectedct;
int privacypref;
void clear();
};
#endif