xbmc/xbmc — pull request #569 by fetzerch (2011-12-12 21:37:51+00:00)
Title: Bugfix: MySql reconnect (in query_with_reconnect)

The MySql reconnect in query_with_reconnect is broken. Thus after a longer suspend/resume or server restart, the MySql connection fails with "ERROR: SQL: The MySQL server has gone away".

Function mysql-real-query does not return the error code itself. Instead it only returns 0 (success) or a non zero value (always 1 in 5.5.19) on failiure. To get the actual error code, we have to call mysql_errno on the connection.

see http://dev.mysql.com/doc/refman/5.5/en/mysql-real-query.html and http://dev.mysql.com/doc/refman/5.5/en/mysql-errno.html