File MySQL-python-1.2.2-reconnect.patch of Package python-mysql

*** MySQL-python-1.2.1_p2/_mysql.c	2006-04-05 12:55:44.000000000 -0500
--- mysql/_mysql.c	2006-05-06 12:16:10.000000000 -0500
***************
*** 477,486 ****
  				  "named_pipe", "init_command",
  				  "read_default_file", "read_default_group",
  				  "client_flag", "ssl",
! 				  "local_infile",
  				  NULL } ;
  	int connect_timeout = 0;
! 	int compress = -1, named_pipe = -1, local_infile = -1;
  	char *init_command=NULL,
  	     *read_default_file=NULL,
  	     *read_default_group=NULL;
--- 477,486 ----
  				  "named_pipe", "init_command",
  				  "read_default_file", "read_default_group",
  				  "client_flag", "ssl",
! 				  "local_infile", "reconnect", 
  				  NULL } ;
  	int connect_timeout = 0;
! 	int compress = -1, named_pipe = -1, local_infile = -1, reconnect = -1;
  	char *init_command=NULL,
  	     *read_default_file=NULL,
  	     *read_default_group=NULL;
***************
*** 488,494 ****
  	self->converter = NULL;
  	self->open = 0;
  	check_server_init(-1);
! 	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssssisOiiisssiOi:connect",
  					 kwlist,
  					 &host, &user, &passwd, &db,
  					 &port, &unix_socket, &conv,
--- 488,494 ----
  	self->converter = NULL;
  	self->open = 0;
  	check_server_init(-1);
! 	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssssisOiiisssiOii:connect",
  					 kwlist,
  					 &host, &user, &passwd, &db,
  					 &port, &unix_socket, &conv,
***************
*** 497,503 ****
  					 &init_command, &read_default_file,
  					 &read_default_group,
  					 &client_flag, &ssl,
! 					 &local_infile
  					 ))
  		return -1;
  
--- 497,503 ----
  					 &init_command, &read_default_file,
  					 &read_default_group,
  					 &client_flag, &ssl,
! 					 &local_infile, &reconnect
  					 ))
  		return -1;
  
***************
*** 541,546 ****
--- 541,547 ----
  		mysql_options(&(self->connection), MYSQL_OPT_COMPRESS, 0);
  		client_flag |= CLIENT_COMPRESS;
  	}
+ 
  	if (named_pipe != -1)
  		mysql_options(&(self->connection), MYSQL_OPT_NAMED_PIPE, 0);
  	if (init_command != NULL)
***************
*** 562,567 ****
--- 563,574 ----
  	conn = mysql_real_connect(&(self->connection), host, user, passwd, db,
  				  port, unix_socket, client_flag);
  
+ 	/* Needs to come after real_connect per mysql API manual */
+ 	if (conn && (reconnect > 0)) {
+ 		my_bool bool = reconnect;
+ 		mysql_options(conn, MYSQL_OPT_RECONNECT, &bool);
+ 	}
+ 
  	Py_END_ALLOW_THREADS ;
  
  	if (!conn) {
openSUSE Build Service is sponsored by