Last-Update: 2021-07-26
Forwarded: not-needed
Origin: https://packages.altlinux.org/en/p8/srpms/mysql-workbench-community/patches/mysql-workbench-mariadb-build.patch
Author: Dmitry Smirnov <onlyjob@member.fsf.org>
Description: fix FTBFS with MariaDB.
 mysql_real_escape_string_quote() has been implemented as a replacement
 for mysql_real_escape_string() in MySQL 5.7.6 but is not implemented
 in libmysqlclient of MariaDB 10.0.21

--- a/plugins/migration/copytable/copytable.cpp
+++ b/plugins/migration/copytable/copytable.cpp
@@ -339,13 +339,9 @@
         throw std::logic_error(
           base::strfmt("Unhandled MySQL type %i for column '%s'", col->target_type, col->target_name.c_str()));
     }
 
-#if MYSQL_VERSION_ID >= 80004
-    typedef bool WB_BOOL;
-#else
     typedef my_bool WB_BOOL;
-#endif
 
     bind.error = (WB_BOOL *)malloc(sizeof(WB_BOOL));
     if (!bind.error)
       throw std::runtime_error("Could not allocate memory for row buffer");
@@ -2290,16 +2286,11 @@
         ret_val = _bulk_insert_record.append_escaped((char *)(*_row_buffer)[col_index].buffer,
                                                      *(*_row_buffer)[col_index].length);
         _bulk_insert_record.append("')");
         break;
-#if MYSQL_VERSION_ID > 80021
-      case MYSQL_TYPE_INVALID:
-        // TODO: added to fix the build. Need to check how to handle this.
-        break;
-      case MYSQL_TYPE_BOOL:
-        // TODO: added to fix the build. Need to check how to handle this. In the current version this is just a placeholder.
+      case MAX_NO_FIELD_TYPES:
+        // should not ever occur as is used only to mark the end of enum
         break;
-#endif
       
     }
   }
 
@@ -2686,16 +2677,9 @@
   unsigned long ret_length = 0;
 
 
 
-#if MYSQL_VERSION_ID >= 50706
-  if (_target->is_mysql_version_at_least(5, 7, 6))
-    ret_length += mysql_real_escape_string_quote(_mysql, buffer + length, data, (unsigned long)dlength, '\'');
-  else
-    ret_length += mysql_real_escape_string(_mysql, buffer + length, data, (unsigned long)dlength);
-#else
   ret_length += mysql_real_escape_string(_mysql, buffer + length, data, (unsigned long)dlength);
-#endif
 
   if (ret_length != (unsigned long)-1)
     length += ret_length;
   else
