Bug #18047 build error on mysql-gui-common with mysql < 5
Submitted: 7 Mar 2006 20:05 Modified: 26 Apr 2006 17:21
Reporter: Roeland Nys Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Preview Severity:S3 (Non-critical)
Version:SVN OS:Linux (gentoo linux)
Assigned to: Alfredo Kojima CPU Architecture:Any

[7 Mar 2006 20:05] Roeland Nys
Description:
I had a build error in mysql-gui-common

i fixed it by adding an extra check 

#if MYSQL_VERSION_ID >= 50000

in MYXMySQLResultSetSource.cc

How to repeat:
build with mysql 4.1 libs

Suggested fix:
*** MYXMySQLResultSetSource.cc  Tue Mar  7 20:58:01 2006
--- MYXMySQLResultSetSource.cc~ Tue Mar  7 20:56:12 2006
***************
*** 44,55 ****
    g_free(_username);
    g_free(_socket_path);

- #if MYSQL_VERSION_ID >= 50000
    if (_stmt)
      mysql_stmt_close(_stmt);
    g_free(_stmt_results);
! #endif
!
    mysql_free_result(_result);
    if (_connected)
      mysql_close(&_mysql);
--- 44,53 ----
    g_free(_username);
    g_free(_socket_path);

    if (_stmt)
      mysql_stmt_close(_stmt);
    g_free(_stmt_results);
!
    mysql_free_result(_result);
    if (_connected)
      mysql_close(&_mysql);
***************
*** 217,223 ****
    int fields[6];

    g_return_val_if_fail(_stmt != NULL && _stmt_active, columns);
!
    mysql_init(&mysql);

    if (mysql_real_connect(&mysql, _hostname, _username, _password, NULL, _port, _socket_path, 0) != 0)
--- 215,221 ----
    int fields[6];

    g_return_val_if_fail(_stmt != NULL && _stmt_active, columns);
!
    mysql_init(&mysql);

    if (mysql_real_connect(&mysql, _hostname, _username, _password, NULL, _port, _socket_path, 0) != 0)
[7 Mar 2006 20:10] Roeland Nys
i missed something in the diff:

*** MYXMySQLResultSetSource.cc  Tue Mar  7 21:10:15 2006
--- /home/roeland/MYXMySQLResultSetSource_new.cc        Tue Mar  7 20:58:01 2006
***************
*** 29,37 ****
--- 29,39 ----
    _connected= false;
    _last_errno= 0;
    _last_error= 0;
+ #if MYSQL_VERSION_ID >= 50000
    _stmt= 0;
    _stmt_active= true;
    _stmt_results= 0;
+ #endif
  }

***************
*** 42,51 ****
    g_free(_username);
    g_free(_socket_path);

    if (_stmt)
      mysql_stmt_close(_stmt);
    g_free(_stmt_results);
!
    mysql_free_result(_result);
    if (_connected)
      mysql_close(&_mysql);
--- 44,55 ----
    g_free(_username);
    g_free(_socket_path);

+ #if MYSQL_VERSION_ID >= 50000
    if (_stmt)
      mysql_stmt_close(_stmt);
    g_free(_stmt_results);
! #endif
!
    mysql_free_result(_result);
    if (_connected)
      mysql_close(&_mysql);
[26 Apr 2006 17:21] Alfredo Kojima
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html