Restructured code

git-svn-id: http://svn.code.sf.net/p/mrbs/code/mrbs/trunk@2897 25f7e783-145e-4f2d-a9f8-dd7182bfe9c7
Added rollback of outstanding transactions to the shutdown function in an attempt to prevent duplicate bookings when using persistent database connections.   See SF bugs #314

git-svn-id: http://svn.code.sf.net/p/mrbs/code/mrbs/trunk@2898 25f7e783-145e-4f2d-a9f8-dd7182bfe9c7
Improved error handling

git-svn-id: http://svn.code.sf.net/p/mrbs/code/mrbs/trunk@2899 25f7e783-145e-4f2d-a9f8-dd7182bfe9c7
Fixed potential bug in sql_mysql_mutex_lock() and sql_mysqli_mutex_lock() where an error from the GET_LOCK query, which would return NULL, would be falsely reported as a successful lock.

git-svn-id: http://svn.code.sf.net/p/mrbs/code/mrbs/trunk@2900 25f7e783-145e-4f2d-a9f8-dd7182bfe9c7