mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=807
This commit is contained in:
parent
12dc09d651
commit
0945912d40
|
@ -50,7 +50,7 @@ static char* boinc_table_name[] = {
|
|||
"workseq",
|
||||
};
|
||||
|
||||
class BOINC_MYSQL_DB : virtual public MYSQL_DB {
|
||||
class BOINC_MYSQL_DB : public MYSQL_DB {
|
||||
public:
|
||||
BOINC_MYSQL_DB();
|
||||
void struct_to_str(void* vp, char* q, int type);
|
||||
|
|
|
@ -129,9 +129,9 @@ int MYSQL_DB::db_update(void* vp, int type) {
|
|||
char buf[MAX_QUERY_LEN], sbuf[MAX_QUERY_LEN];
|
||||
struct_to_str(vp, sbuf, type);
|
||||
sprintf(
|
||||
buf,
|
||||
"update %s set %s where id=%d",
|
||||
table_name[type], sbuf, *id(vp, type)
|
||||
buf,
|
||||
"update %s set %s where id=%d",
|
||||
table_name[type], sbuf, *id(vp, type)
|
||||
);
|
||||
return mysql_query(mp, buf);
|
||||
}
|
||||
|
@ -139,43 +139,43 @@ int MYSQL_DB::db_update(void* vp, int type) {
|
|||
int MYSQL_DB::db_enum(ENUM& e, void* p, int type, char* clause, int limit) {
|
||||
char buf[MAX_QUERY_LEN], buf2[256];
|
||||
if (!e.active) {
|
||||
e.active = 1;
|
||||
sprintf(buf, "select * from %s %s", table_name[type], clause?clause:"");
|
||||
e.active = 1;
|
||||
sprintf(buf, "select * from %s %s", table_name[type], clause?clause:"");
|
||||
if (limit) {
|
||||
sprintf(buf2, " limit %d", limit);
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
mysql_query(mp, buf);
|
||||
e.rp = mysql_store_result(mp);
|
||||
if (!e.rp) return -1;
|
||||
mysql_query(mp, buf);
|
||||
e.rp = mysql_store_result(mp);
|
||||
if (!e.rp) return -1;
|
||||
}
|
||||
row = mysql_fetch_row(e.rp);
|
||||
if (!row) {
|
||||
mysql_free_result(e.rp);
|
||||
e.active = 0;
|
||||
return 1;
|
||||
mysql_free_result(e.rp);
|
||||
e.active = 0;
|
||||
return 1;
|
||||
} else {
|
||||
row_to_struct(row, p, type);
|
||||
return 0;
|
||||
row_to_struct(row, p, type);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int MYSQL_DB::db_enum_field(ENUM& e, int type, char* field, char* clause) {
|
||||
char buf[MAX_QUERY_LEN];
|
||||
if (!e.active) {
|
||||
e.active = 1;
|
||||
sprintf(buf, "select %s from %s %s", field, table_name[type], clause);
|
||||
mysql_query(mp, buf);
|
||||
e.rp = mysql_store_result(mp);
|
||||
if (!e.rp) return -1;
|
||||
e.active = 1;
|
||||
sprintf(buf, "select %s from %s %s", field, table_name[type], clause);
|
||||
mysql_query(mp, buf);
|
||||
e.rp = mysql_store_result(mp);
|
||||
if (!e.rp) return -1;
|
||||
}
|
||||
row = mysql_fetch_row(e.rp);
|
||||
if (!row) {
|
||||
mysql_free_result(e.rp);
|
||||
e.active = 0;
|
||||
return 1;
|
||||
mysql_free_result(e.rp);
|
||||
e.active = 0;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
<p>
|
||||
Workunits and results can be created using either a utility program
|
||||
or a C++ function.
|
||||
<p>
|
||||
In either case you must first <a href=key_setup.html>generate a key pair</a>
|
||||
for file upload authentication.
|
||||
<hr>
|
||||
The utility program is
|
||||
<pre>
|
||||
create_work
|
||||
|
@ -37,7 +39,7 @@ the filename, download URL, MD5 checksum, and size.
|
|||
file.
|
||||
<li>
|
||||
Within a <file_ref> element,
|
||||
<file_number>x</number> is replaced with the filename.
|
||||
<file_number>x</file_number> is replaced with the filename.
|
||||
</ul>
|
||||
<p>
|
||||
The result file template is macro-substituted as follows:
|
||||
|
@ -52,22 +54,37 @@ the ordinal number of the result (0, 1, ...).
|
|||
<p>
|
||||
<hr>
|
||||
<p>
|
||||
The C++ library (backend_lib.C,h) provides the function:
|
||||
The C++ library (backend_lib.C,h) provides the functions:
|
||||
<pre>
|
||||
int read_key_file(char* path, R_RSA_PRIVATE_KEY& key);
|
||||
|
||||
int create_work(
|
||||
WORKUNIT&,
|
||||
char* wu_template,
|
||||
char* result_template_filename,
|
||||
char* wu_template, // contents, not path
|
||||
char* result_template_filename, // path
|
||||
int nresults,
|
||||
char* infile_dir,
|
||||
char** infiles,
|
||||
char* infile_dir, // where input files are
|
||||
char** infiles, // array of input file names
|
||||
int ninfiles
|
||||
R_RSA_PRIVATE_KEY& key,
|
||||
R_RSA_PRIVATE_KEY& key, // upload authentication key
|
||||
char* upload_url,
|
||||
char* download_url
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
This creates a workunit and one or more results.
|
||||
<b>read_key_file()</b> reads a private key from a file.
|
||||
Use this to read the file upload authentication key.
|
||||
<p>
|
||||
<b>create_work()</b>
|
||||
creates a workunit and one or more results.
|
||||
The arguments are similar to those of the utility program;
|
||||
some of the information is passed in the WORKUNIT structure.
|
||||
some of the information is passed in the WORKUNIT structure,
|
||||
namely the following fields:
|
||||
<pre>
|
||||
name
|
||||
rsc_fpops
|
||||
rsc_iops
|
||||
rsc_memory
|
||||
rsc_disk
|
||||
delay_bound
|
||||
</pre>
|
||||
|
|
|
@ -162,7 +162,7 @@ void make_work() {
|
|||
while (p) {
|
||||
if (parse_str(p, "<name>", file_name, sizeof(file_name))) {
|
||||
sprintf(
|
||||
new_file_name, "%s_%d_%d", file_name, start_time, seqno++
|
||||
new_file_name, "%s__%d_%d", file_name, start_time, seqno++
|
||||
);
|
||||
sprintf(pathname, "%s/%s", config.download_dir, file_name);
|
||||
sprintf(
|
||||
|
|
Loading…
Reference in New Issue