Patch for Bug 608032 - MySQL timeout and no attempt reconnect
janssens-geert at telenet.be
Thu Feb 4 10:03:48 EST 2010
On Thursday 4 February 2010, Tom Van Braeckel wrote:
> Hi guys,
> Here's another patch - my first *code* patch to GnuCash !
> Rationale: When we try to open a database transaction, and the database
> reports that the "server has gone away", we try to reconnect before failing
Thanks you for your patch. It looks like a good start, but to my limited
knowledge of the sql backend, it seems incomplete.
Here are my thoughts on the patch:
* you test for an error by comparing with a string. I think it would probably
be safer and definitely be more efficient to simply test for the error number
returned by dbi_conn_error. It's possible that the error strings returned by
MySQL are translated into other languages on other systems, so your string
wouldn't always match.
* what happens if not only the connection had timed out, but something else
changed as well (an administrator changed the login password for example) ? I
mean you don't check the results of dbi_connect or the second dbi_conn_queryf.
* I also think there may be more useful places to check for a connection
timeout, not only at the beginning of transactions. I found several occurences
of dbi_conn_query and dbi_conn_queryf some of which could be called passed a
As said in the beginning, I'm not the dbi expert, so maybe my comments are off
mark or plain silly.
> I've also attached it to the bug report, and taken the liberty to add
> myself to the AUTHORS file.
> I hope that's customary here, and I apologise if it's not...
I think this is quite ok. I would just like to ask you to put your name in
alpabetical order which I think would put you between Richard -Gilligan-
Uschold and Matthew Vanecek.
> Thanks again for this great software,
Keep submitting patches !
> Tom Van Braeckel
> GSM: 0032 (0) 486 63 58 04
More information about the gnucash-devel