Project

General

Profile

Feature #2011 ยป mod_mysql_vhost_2009062102.patch

benbrown, 2009-06-21 16:29

View differences:

mod_mysql_vhost.c (working copy)
259 259

  
260 260
#define FOO(x) (s->x->used ? s->x->ptr : NULL)
261 261

  
262
#if MYSQL_VERSION_ID >= 40100
263
                        /* CLIENT_MULTI_STATEMENTS first appeared in 4.1 */ 
262 264
			if (!mysql_real_connect(s->mysql, FOO(hostname), FOO(myuser), FOO(mypass),
265
						FOO(mydb), s->port, FOO(mysock), CLIENT_MULTI_STATEMENTS)) {
266
#else
267
			if (!mysql_real_connect(s->mysql, FOO(hostname), FOO(myuser), FOO(mypass),
263 268
						FOO(mydb), s->port, FOO(mysock), 0)) {
269
#endif
264 270
				log_error_write(srv, __FILE__, __LINE__, "s", mysql_error(s->mysql));
265 271

  
266 272
				return HANDLER_ERROR;
......
369 375
	if (!row || cols < 1) {
370 376
		/* no such virtual host */
371 377
		mysql_free_result(result);
378
#if MYSQL_VERSION_ID >= 40100
379
		while (mysql_next_result(p->conf.mysql) == 0);
380
#endif
372 381
		return HANDLER_GO_ON;
373 382
	}
374 383

  
......
402 411
		c->fcgi_offset = c->fcgi_arg->used = 0;
403 412
	}
404 413
	mysql_free_result(result);
414
#if MYSQL_VERSION_ID >= 40100
415
	while (mysql_next_result(p->conf.mysql) == 0);
416
#endif
405 417

  
406 418
	/* fix virtual server and docroot */
407 419
GO_ON:	buffer_copy_string_buffer(con->server_name, c->server_name);
......
416 428
	return HANDLER_GO_ON;
417 429

  
418 430
ERR500:	if (result) mysql_free_result(result);
431
#if MYSQL_VERSION_ID >= 40100
432
	while (mysql_next_result(p->conf.mysql) == 0);
433
#endif
419 434
	con->http_status = 500; /* Internal Error */
420 435
	con->mode = DIRECT;
421 436
	return HANDLER_FINISHED;
    (1-1/1)