[Bug #661832]MySQL database error after wireless reconnect

After suggestion by Wang Xiaozhe <chaoslawful@gmail.com>

BP

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22818 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2013-03-02 00:21:30 +00:00
parent f65b2e1aa3
commit d311e942f6

View File

@ -531,6 +531,14 @@ set_standard_connection_options( QofBackend* qbe, dbi_conn conn, const gchar* ho
return FALSE; return FALSE;
} }
result = dbi_conn_set_option( conn, "encoding", "UTF-8" );
if ( result < 0 )
{
PERR( "Error setting 'encoding' option\n" );
qof_backend_set_error( qbe, ERR_BACKEND_SERVER_ERR );
return FALSE;
}
return TRUE; return TRUE;
} }
@ -926,15 +934,6 @@ gnc_dbi_mysql_session_begin( QofBackend* qbe, QofSession *session,
{ {
dbi_result dresult; dbi_result dresult;
/* Set connection char set to utf8 */
dresult = dbi_conn_queryf( be->conn, "SET NAMES 'utf8'" );
if ( dresult == NULL )
{
PERR( "Unable to set connection char set" );
qof_backend_set_error( qbe, ERR_BACKEND_SERVER_ERR );
goto exit;
}
if ( be->sql_be.conn != NULL ) if ( be->sql_be.conn != NULL )
{ {
gnc_sql_connection_dispose( be->sql_be.conn ); gnc_sql_connection_dispose( be->sql_be.conn );