Bug #18968 Compile error for MySQL Version 5
Submitted: 10 Apr 2006 16:45 Modified: 26 Apr 2006 15:58
Reporter: Jochen Riehm Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Preview Severity:S2 (Serious)
Version:1.0.5 beta OS:Linux (Debian Sarge)
Assigned to: Alfredo Kojima CPU Architecture:Any

[10 Apr 2006 16:45] Jochen Riehm
Description:
Compilation of mysql-gui-common fails with compilation error for MYXMySQLResultSetSource.cc:

MYXMySQLResultSetSource.cc: In constructor `
   MYXMySQLResultSetSource::MYXMySQLResultSetSource()':
MYXMySQLResultSetSource.cc:32: error: `_stmt' undeclared (first use this
   function)
MYXMySQLResultSetSource.cc:32: error: (Each undeclared identifier is reported
   only once for each function it appears in.)
MYXMySQLResultSetSource.cc:33: error: `_stmt_active' undeclared (first use this
   function)
MYXMySQLResultSetSource.cc:34: error: `_stmt_results' undeclared (first use
   this function)
make[3]: *** [MYXMySQLResultSetSource.o] Fehler 1

Reason:

In MYXMySQLResultSetSource.h, Attributes, _stmt, _stmt_active and _stmt_results are not  declared if MySQL Version is smaller than 5:

#if MYSQL_VERSION_ID >= 50000
    std::vector<ResultColumnData*> _column_data;
    MYSQL_STMT *_stmt;
    MYSQL_RES *_stmt_metadata;
    MYSQL_BIND *_stmt_results;
    bool _stmt_active;
#endif

In MYXMySQLResultSetSource.cc, the constructor assigns them without check for version:

MYXMySQLResultSetSource::MYXMySQLResultSetSource()
{
  _result= 0;
  _row= 0;
  _connected= false;
  _last_errno= 0;
  _last_error= 0;
  _stmt= 0;
  _stmt_active= true;
  _stmt_results= 0;
}

How to repeat:
On debian sarge system with MySQL 4 client libraries and development package (for mysql.h etc.) cd to directory mysql-workbench-1.0.5beta/mysql-gui-common of downloaded source distribution of mysql-workbench and run
./configure
./make

Suggested fix:
Either remove version dependency in declaration or include in usage.
[26 Apr 2006 15:58] 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