Hello, first of all thanks for your comment.
I am sorry that I discussed this problem with Sinisa in private (not = via [EMAIL PROTECTED]). So, once more I would like to summarize it: My opinion is that there is/(at least) was a bug in your API because: > *mysql=3Dtmp_mysql; //especialy this is the point. You assign = value of tmp_mysql into *mysql. But MYSQL is defined as structure, = which contains several pointers and is evident, that after return from = this function the pointers are corrupted. I would expect dynamicaly = allocated tmp_mysql and assign in this manner obtained pointer to = mysql. Something like: >=20 > MYSQL *tmp_mysql; > tmp_mysql =3D (MYSQL *) my_alloc(...); > .... > mysql=3Dtmp_mysql; After this email I received new body of the method (mysql_reconnect()) = from Sinisa: ... *mysql=3Dtmp_mysql; mysql_fix_pointers(mysql, &tmp_mysql); /* adjust connection pointers = */ =20 ... this method contains (unlike version known to me) function call = mysql_fix_pointers(), which probably handles pointers of MYSQL struct. = Am I right? I would like to know the body of this new method to be = sure. Also, I would like to know, which version comes this method with? = Because I could not find it in = http://www.mysql.com/downloads/mysql-3.23.html. Maybe version 4.0.0 and = later? Regards Gregor > -----Urspr> =FCngliche Nachricht----- > Von: Michael Widenius [SMTP:[EMAIL PROTECTED]] > Gesendet am: Sonntag, 10. Februar 2002 19:19 > An: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Betreff: Re: Bug in MySQL API ?!? >=20 >=20 > Hi! >=20 > I have a couple of small comments to Sinisa answer. >=20 > >>>>> "Sinisa" =3D=3D Sinisa Milivojevic <[EMAIL PROTECTED]> writes: >=20 > Sinisa> Skriniar Gregor writes: > >> Dear all, > >>=20 > >> I experienced some problems with using MySQL API: > >> My problem is that if I don't use database a long time it is = disconnected and when I try to connect again at first I use method = mysql_ping(), which reopens connection and that's the point. Please see = next code of MySQL API: > >>=20 > >> static my_bool mysql_reconnect(MYSQL *mysql) > >> { > >> MYSQL tmp_mysql; = //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!= !!!!!!!!!!! local variable > >> DBUG_ENTER("mysql_reconnect"); > >>=20 > >> if (!mysql->reconnect || > >> (mysql->server_status & SERVER_STATUS_IN_TRANS) || = !mysql->host_info) > >> { > >> /* Allov reconnect next time */ > mysql-> server_status&=3D ~SERVER_STATUS_IN_TRANS; > >> DBUG_RETURN(1); > >> } > >> mysql_init(&tmp_mysql); > >> tmp_mysql.options=3Dmysql->options; > >> bzero((char*) &mysql->options,sizeof(mysql->options)); > >> if = (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, > mysql-> db, mysql->port, mysql->unix_socket, > mysql-> client_flag)) > >> DBUG_RETURN(1); > >> tmp_mysql.free_me=3Dmysql->free_me; > mysql-> free_me=3D0; > >> mysql_close(mysql); > >> *mysql=3Dtmp_mysql; = //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!= !!!!!!!!!!! the in/out param is pointed to local variable. What's a = wilderness?!? >=20 > No, 'mysql' is not set to point to a local variable; We copy the > content (=3D the new connection) of the local variable to the in/out > parameter. This is perfectly ok and safe to do! >=20 > <cut> >=20 > Sinisa> I also do not see why should you use mysql_ping to reconnect. >=20 > It's actually quite ok to use mysql_ping() to reconnect... >=20 > Regards, > Monty --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php