--- old/Library/src/HTSQL.c 2005-03-18 15:54:48.170275368 +0100 +++ w3c-libwww-5.4.0/Library/src/HTSQL.c 2005-03-18 17:11:38.895338616 +0100 @@ -182,11 +182,25 @@ { if (me && me->host) { HTTRACE(SQL_TRACE, "SQL connect. Open a link to server `%s\'\n" _ me->host); +#if MYSQL_VERSION_ID>=32200 + if (!mysql_init(&(me->server))) { + return NO; + } +#endif + +#if MYSQL_VERSION_ID>=40103 + if ((me->psvr = mysql_real_connect(&(me->server), me->host, + me->user ? me->user : "", + me->password ? me->password : "", + "", 0 , 0 , 0)) == NULL) { +#else + if ((me->psvr = mysql_connect(&(me->server), me->host, me->user ? me->user : "", me->password ? me->password : "")) == NULL) { - HTTRACE(SQL_TRACE, "SQL connect. `%s\' errno %d\n" _ - mysql_error(&me->server) _ mysql_errno(&me->server)); +#endif + HTTRACE(SQL_TRACE, "SQL connect. `%s\' errno %d\n" _ + mysql_error(&me->server) _ mysql_errno(&me->server)); return NO; } return YES; @@ -230,6 +244,7 @@ PUBLIC BOOL HTSQL_selectDB (HTSQL * me, const char * db) { BOOL created = NO; + char query[1024]; if (me && me->psvr && db) { HTTRACE(SQL_TRACE, "SQL select.. Database `%s\'\n" _ db); me->db = NULL; @@ -240,7 +255,12 @@ /* If the database couldn't be found then create a new one */ if (err == 1049) { +#if MYSQL_VERSION_ID>=40103 + sprintf (query, "CREATE DATABASE %s", db); + if (mysql_query(me->psvr, query) != 0) { +#else if (mysql_create_db(me->psvr, db) < 0) { +#endif HTTRACE(SQL_TRACE, "SQL error... `%s\', errno %d\n" _ mysql_error(me->psvr) _ err); return NO;