well, i use mysql_query as ported from libmysql.dll

function mysql_query(_mysql:pmysql;const query:
pchar):integer;stdcall;external 'libmysql.dll';

this function is supposed to return non-zero on failure and zero on succeed
( includes select/update/delete/insert/show etc.etc).

This function behaves entirely normal. Until being idle for a while. The
function then fails after first attempt to connect. But why? i haven't got
any sql error.

So i tested with the console client. Both win32 and linux clients behave the
same. Unfortunately i can only test on a win32 server at "long" distance,
but in fact i'd espect a linux server to behave the same (since i didn't
notice any real difference before)

Normally you'd expect them in the status "ERROR 2006: MySQL server has gone
away
No connection. Trying to reconnect..."

However, i got: "ERROR 2013: Lost connection to MySQL server during query"

Both client and server think the connection is active, but for one reason or
another they fail.

in the server's processlist you'll see the anomalial client for a while. The
client just reconnects using a new socket resource.

So, i can test if the function succeeds, i could test if had a reconnection
error, but: why should i test if the function is supposed to reconnect by
itself... and then fails ???
imho the result should be false because: - the server is really unavailable
or: - the query is invalid.

however it's not only libmysql.dll that suffers from this problem, it's also
the (original) client...

regards,

rene

----- Original Message -----
From: "Boulat Khakimov" <[EMAIL PROTECTED]>
To: "René Tegel" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, March 15, 2001 1:11 AM
Subject: Re: connection lost on long-distance connection


> Hi,
>
> Here is the way I would fix that problem
> (assuming you're a programmer)
>
>
> write a simple function check_connection(MYSQL **conn) for example.
> that will issue a query "SELECT NOW()" to mysql, if that query fails
> that means connection to mySQL has gone away and the function has to
> reconnects to mySQL, if not then life is good and the function
> exits without having to do anything else.
>
> Now after writing that function, call it right before executing
> any query in your program.
>
> Regards,
> SC
>
>
>
> --
> Nothing Like the Sun
>
> ---------------------------------------------------------------------
> 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

Reply via email to