mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=2345
This commit is contained in:
parent
dd4d6d2594
commit
9e75c1a30a
|
@ -6333,3 +6333,11 @@ David Sept 21 2003
|
||||||
feeder.C
|
feeder.C
|
||||||
handle_request.C
|
handle_request.C
|
||||||
show_shmem.C
|
show_shmem.C
|
||||||
|
|
||||||
|
Eric K 9/22/03
|
||||||
|
|
||||||
|
Modified DB_CONN::open() to support "db_name@host" syntax for remote
|
||||||
|
database connections.
|
||||||
|
|
||||||
|
db/db_base.C
|
||||||
|
|
||||||
|
|
16
db/db_base.C
16
db/db_base.C
|
@ -11,9 +11,23 @@ DB_CONN::DB_CONN() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int DB_CONN::open(char* dbname, char* dbpassword) {
|
int DB_CONN::open(char* dbname, char* dbpassword) {
|
||||||
|
char buf[256],*db_name,*db_host,*p;
|
||||||
|
if (dbname) {
|
||||||
|
strncpy(buf,dbname,254);
|
||||||
|
buf[255]=0;
|
||||||
|
db_name=buf;
|
||||||
|
} else {
|
||||||
|
db_name=0;
|
||||||
|
}
|
||||||
|
if ((p=strchr(buf,'@'))) {
|
||||||
|
db_host=p+1;
|
||||||
|
*p=0;
|
||||||
|
} else {
|
||||||
|
db_host=0;
|
||||||
|
}
|
||||||
mysql = mysql_init(0);
|
mysql = mysql_init(0);
|
||||||
if (!mysql) return 0;
|
if (!mysql) return 0;
|
||||||
mysql = mysql_real_connect(mysql, 0, 0, dbpassword, dbname, 0, 0, 0);
|
mysql = mysql_real_connect(mysql, db_host, 0, dbpassword, db_name, 0, 0, 0);
|
||||||
return (mysql == 0);
|
return (mysql == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue