*** empty log message ***

svn path=/trunk/boinc/; revision=2345
This commit is contained in:
Eric J. Korpela 2003-09-22 16:08:32 +00:00
parent dd4d6d2594
commit 9e75c1a30a
2 changed files with 23 additions and 1 deletions

View File

@ -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

View File

@ -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);
} }