Lines 46-59
Link Here
|
46 |
#ifdef HAVE_STRFTIME |
46 |
#ifdef HAVE_STRFTIME |
47 |
length = strftime(*ptr, 40, "\'%Y-%m-%d %H:%M:%S\'", pgmt); |
47 |
length = strftime(*ptr, 40, "\'%Y-%m-%d %H:%M:%S\'", pgmt); |
48 |
#else |
48 |
#else |
49 |
sprintf(*ptr, "\'%04d-%02d-%02d %02d:%02d:%02d\'", |
49 |
length = sprintf(*ptr, "\'%04d-%02d-%02d %02d:%02d:%02d\'", |
50 |
pgmt->tm_year + 1900, |
50 |
pgmt->tm_year + 1900, |
51 |
pgmt->tm_mon + 1, |
51 |
pgmt->tm_mon + 1, |
52 |
pgmt->tm_wday + 1, |
52 |
pgmt->tm_wday + 1, |
53 |
pgmt->tm_hour, |
53 |
pgmt->tm_hour, |
54 |
pgmt->tm_min, |
54 |
pgmt->tm_min, |
55 |
pgmt->tm_sec); |
55 |
pgmt->tm_sec); |
56 |
length = strlen(*ptr); |
|
|
57 |
#endif /* HAVE_STRFTIME */ |
56 |
#endif /* HAVE_STRFTIME */ |
58 |
|
57 |
|
59 |
/* Remove the trailing zero */ |
58 |
/* Remove the trailing zero */ |
Lines 183-191
Link Here
|
183 |
{ |
182 |
{ |
184 |
if (me && me->host) { |
183 |
if (me && me->host) { |
185 |
HTTRACE(SQL_TRACE, "SQL connect. Open a link to server `%s\'\n" _ me->host); |
184 |
HTTRACE(SQL_TRACE, "SQL connect. Open a link to server `%s\'\n" _ me->host); |
186 |
if ((me->psvr = mysql_connect(&(me->server), me->host, |
185 |
if ((me->psvr = mysql_real_connect(&(me->server), me->host, |
187 |
me->user ? me->user : "", |
186 |
me->user ? me->user : "", |
188 |
me->password ? me->password : "")) == NULL) { |
187 |
me->password ? me->password : "", |
|
|
188 |
"",0,0,0)) == NULL) { |
189 |
HTTRACE(SQL_TRACE, "SQL connect. `%s\' errno %d\n" _ |
189 |
HTTRACE(SQL_TRACE, "SQL connect. `%s\' errno %d\n" _ |
190 |
mysql_error(&me->server) _ mysql_errno(&me->server)); |
190 |
mysql_error(&me->server) _ mysql_errno(&me->server)); |
191 |
return NO; |
191 |
return NO; |
Lines 241-247
Link Here
|
241 |
|
241 |
|
242 |
/* If the database couldn't be found then create a new one */ |
242 |
/* If the database couldn't be found then create a new one */ |
243 |
if (err == 1049) { |
243 |
if (err == 1049) { |
244 |
if (mysql_create_db(me->psvr, db) < 0) { |
244 |
char query[1024]; |
|
|
245 |
sprintf (query, "CREATE DATABASE %s", db); |
246 |
if (mysql_query(me->psvr, query) < 0) { |
245 |
HTTRACE(SQL_TRACE, "SQL error... `%s\', errno %d\n" _ |
247 |
HTTRACE(SQL_TRACE, "SQL error... `%s\', errno %d\n" _ |
246 |
mysql_error(me->psvr) _ err); |
248 |
mysql_error(me->psvr) _ err); |
247 |
return NO; |
249 |
return NO; |