From f82e15baaabde8259ae3b1a34dccff4d4b19f7c6 Mon Sep 17 00:00:00 2001
From: unknown <vva@eagle.mysql.r18.ru>
Date: Wed, 9 Apr 2003 20:50:30 -0400
Subject: added compress/uncompress function

sql/mysql_priv.h:
  added have_compress variable
sql/mysqld.cc:
  added have_compress variable
sql/set_var.cc:
  added have_compress variable
---
 include/mysqld_error.h               |  6 ++-
 mysql-test/include/have_compress.inc |  4 ++
 mysql-test/r/func_compress.result    | 35 ++++++++++++++
 mysql-test/r/have_compress.require   |  2 +
 mysql-test/t/func_compress.test      | 20 ++++++++
 sql/item_create.cc                   | 20 ++++++++
 sql/item_create.h                    |  7 +++
 sql/item_func.cc                     | 14 +++++-
 sql/item_func.h                      |  9 ++++
 sql/item_strfunc.cc                  | 88 ++++++++++++++++++++++++++++++++++++
 sql/item_strfunc.h                   | 23 ++++++++++
 sql/lex.h                            |  7 +++
 sql/mysql_priv.h                     |  1 +
 sql/mysqld.cc                        |  5 ++
 sql/set_var.cc                       |  1 +
 sql/share/czech/errmsg.txt           |  4 ++
 sql/share/danish/errmsg.txt          |  4 ++
 sql/share/dutch/errmsg.txt           |  4 ++
 sql/share/english/errmsg.txt         |  4 ++
 sql/share/estonian/errmsg.txt        |  4 ++
 sql/share/french/errmsg.txt          |  4 ++
 sql/share/german/errmsg.txt          |  4 ++
 sql/share/greek/errmsg.txt           |  4 ++
 sql/share/hungarian/errmsg.txt       |  4 ++
 sql/share/italian/errmsg.txt         |  4 ++
 sql/share/japanese/errmsg.txt        |  4 ++
 sql/share/korean/errmsg.txt          |  4 ++
 sql/share/norwegian-ny/errmsg.txt    |  4 ++
 sql/share/norwegian/errmsg.txt       |  4 ++
 sql/share/polish/errmsg.txt          |  4 ++
 sql/share/portuguese/errmsg.txt      |  4 ++
 sql/share/romanian/errmsg.txt        |  4 ++
 sql/share/russian/errmsg.txt         |  4 ++
 sql/share/serbian/errmsg.txt         |  4 ++
 sql/share/slovak/errmsg.txt          |  4 ++
 sql/share/spanish/errmsg.txt         |  4 ++
 sql/share/swedish/errmsg.txt         |  4 ++
 sql/share/ukrainian/errmsg.txt       |  4 ++
 38 files changed, 332 insertions(+), 2 deletions(-)
 create mode 100644 mysql-test/include/have_compress.inc
 create mode 100644 mysql-test/r/func_compress.result
 create mode 100644 mysql-test/r/have_compress.require
 create mode 100644 mysql-test/t/func_compress.test

diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index 2f4158110cd..57625198c24 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -270,4 +270,8 @@
 #define ER_COLLATION_CHARSET_MISMATCH 1251
 #define ER_SLAVE_WAS_RUNNING 1252
 #define ER_SLAVE_WAS_NOT_RUNNING 1253
-#define ER_ERROR_MESSAGES 254
+#define ER_TOO_BIG_FOR_UNCOMPRESS 1254
+#define ER_ZLIB_Z_MEM_ERROR 1255
+#define ER_ZLIB_Z_BUF_ERROR 1256
+#define ER_ZLIB_Z_DATA_ERROR 1257
+#define ER_ERROR_MESSAGES 258
diff --git a/mysql-test/include/have_compress.inc b/mysql-test/include/have_compress.inc
new file mode 100644
index 00000000000..c042cd7452a
--- /dev/null
+++ b/mysql-test/include/have_compress.inc
@@ -0,0 +1,4 @@
+-- require r/have_compress.require
+disable_query_log;
+show variables like "have_compress";
+enable_query_log;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
new file mode 100644
index 00000000000..ac48c8b9494
--- /dev/null
+++ b/mysql-test/r/func_compress.result
@@ -0,0 +1,35 @@
+select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
+@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+select length(@test_compress_string);
+length(@test_compress_string)
+117
+select uncompress(compress(@test_compress_string));
+uncompress(compress(@test_compress_string))
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+select uncompress(@test_compress_string);
+uncompress(@test_compress_string)
+NULL
+Warnings:
+Error	1254	Too big size of uncompressed data. The maximum size is 8192. (probably, length of uncompressed data was corrupted)
+select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
+uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
+1
+select uncompressed_length(compress(@test_compress_string));
+uncompressed_length(compress(@test_compress_string))
+117
+select length(compress(@test_compress_string))<length(@test_compress_string);
+length(compress(@test_compress_string))<length(@test_compress_string)
+1
+create table t1 (a text, b char(255), c char(4)) type=myisam;
+insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
+select uncompress(a) from t1;
+uncompress(a)
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+select uncompress(b) from t1;
+uncompress(b)
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+select concat('|',c,'|') from t1;
+concat('|',c,'|')
+|d|
+drop table t1;
diff --git a/mysql-test/r/have_compress.require b/mysql-test/r/have_compress.require
new file mode 100644
index 00000000000..8bda2190fbe
--- /dev/null
+++ b/mysql-test/r/have_compress.require
@@ -0,0 +1,2 @@
+Variable_name	Value
+have_compress	YES
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
new file mode 100644
index 00000000000..2f86a414792
--- /dev/null
+++ b/mysql-test/t/func_compress.test
@@ -0,0 +1,20 @@
+-- source include/have_compress.inc
+#
+# Test for compress and uncompress functions:
+#
+
+select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
+select length(@test_compress_string);
+
+select uncompress(compress(@test_compress_string));
+select uncompress(@test_compress_string);
+select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
+select uncompressed_length(compress(@test_compress_string));
+select length(compress(@test_compress_string))<length(@test_compress_string);
+
+create table t1 (a text, b char(255), c char(4)) type=myisam;
+insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
+select uncompress(a) from t1;
+select uncompress(b) from t1;
+select concat('|',c,'|') from t1;
+drop table t1;
\ No newline at end of file
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 3bc6fa47e83..acda2f377c9 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -640,3 +640,23 @@ Item *create_func_point(Item *a, Item *b)
 {
   return new Item_func_point(a, b);
 }
+
+#ifdef HAVE_COMPRESS
+
+Item *create_func_compress(Item* a)
+{
+  return new Item_func_compress(a);
+}
+
+Item *create_func_uncompress(Item* a)
+{
+  return new Item_func_uncompress(a);
+}
+
+Item *create_func_uncompressed_length(Item* a)
+{
+  return new Item_func_uncompressed_length(a);
+}
+
+#endif
+
diff --git a/sql/item_create.h b/sql/item_create.h
index 0e2295b6d4f..fb67d78b424 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -140,3 +140,10 @@ Item *create_func_numinteriorring(Item *a);
 Item *create_func_numgeometries(Item *a);
 
 Item *create_func_point(Item *a, Item *b);
+
+#ifdef HAVE_COMPRESS
+Item *create_func_compress(Item *a);
+Item *create_func_uncompress(Item *a);
+Item *create_func_uncompressed_length(Item *a);
+#endif
+
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 5bbb6003e4f..7a01ea898bb 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -983,8 +983,20 @@ longlong Item_func_crc32::val_int()
   null_value=0;
   return (longlong) crc32(0L, (Bytef*)res->ptr(), res->length());
 }
-#endif /* HAVE_COMPRESS */
 
+longlong Item_func_uncompressed_length::val_int()
+{
+  String *res= args[0]->val_str(&value);
+  if (!res)
+  {
+    null_value=1;
+    return 0; /* purecov: inspected */
+  }
+  null_value=0;
+  return uint4korr(res->c_ptr());
+}
+
+#endif /* HAVE_COMPRESS */
 
 longlong Item_func_length::val_int()
 {
diff --git a/sql/item_func.h b/sql/item_func.h
index 0429e650071..e1d6156c12c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -559,6 +559,15 @@ public:
   const char *func_name() const { return "crc32"; }
   void fix_length_and_dec() { max_length=10; }
 };
+class Item_func_uncompressed_length : public Item_int_func 
+{
+  String value;
+public:
+  Item_func_uncompressed_length(Item *a):Item_int_func(a){}
+  longlong val_int();
+  const char *func_name() const{return "uncompressed_length";}
+  void fix_length_and_dec() { max_length=10; }
+};
 #endif
 
 class Item_func_length :public Item_int_func
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 2a0194aba28..97c9fd77fb8 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2895,3 +2895,91 @@ String *Item_func_spatial_collection::val_str(String *str)
 ret:
   return null_value ? 0 : str;
 }
+
+#ifdef HAVE_COMPRESS
+#include <zlib.h>
+
+String *Item_func_compress::val_str(String *str)
+{
+  String *res= args[0]->val_str(str);
+  int err= Z_OK;
+  int code;
+
+  /*
+   citation from zlib.h (comment for compress function):
+
+    Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be at least 0.1% larger than
+   sourceLen plus 12 bytes.
+
+   Proportion 120/100 founded by Sinica with help of procedure
+   compress(compress(compress(...)))
+   I.e. zlib give number 'at least'..
+  */
+  uLongf new_size= (uLongf)((res->length()*120)/100)+12;
+
+  buffer.realloc((uint32)new_size+sizeof(int32)+sizeof(char));
+
+  Byte *body= ((Byte*)buffer.c_ptr())+sizeof(int32);
+  err= compress(body, &new_size,(const Bytef*)res->c_ptr(), res->length());
+  
+  if (err != Z_OK)
+  {
+    code= err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_BUF_ERROR;
+    push_warning(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,code,ER(code));
+    null_value= 1;
+    return 0;
+  }
+  
+  int4store(buffer.c_ptr(),res->length());
+  buffer.length((uint32)new_size+sizeof(int32));
+  
+  /* This is for the stupid char fields which trimm ' ': */
+  char *last_char= ((char*)body)+new_size-1;
+  if (*last_char == ' ')
+  {
+    *++last_char= '.';
+    new_size++;
+  }
+  
+  buffer.length((uint32)new_size+sizeof(int32));
+  
+  return &buffer;
+}
+
+String *Item_func_uncompress::val_str(String *str)
+{
+  String *res= args[0]->val_str(str);
+  uLongf new_size= uint4korr(res->c_ptr());
+  int err= Z_OK;
+  uint code;
+  
+  if (new_size > MAX_BLOB_WIDTH)
+  {
+    push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
+			ER_TOO_BIG_FOR_UNCOMPRESS,
+			ER(ER_TOO_BIG_FOR_UNCOMPRESS),MAX_BLOB_WIDTH);
+    null_value= 1;
+    return 0;
+  }
+  
+  buffer.realloc((uint32)new_size);
+  
+  err= uncompress((Byte*)buffer.c_ptr(), &new_size, 
+		  ((const Bytef*)res->c_ptr())+sizeof(int32),res->length());
+  
+  if (err == Z_OK)
+  {
+    buffer.length((uint32)new_size);
+    return &buffer;
+  }
+  
+  code= err==Z_BUF_ERROR ? ER_ZLIB_Z_BUF_ERROR : 
+    err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_DATA_ERROR;
+  push_warning(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,code,ER(code));
+  null_value= 1;
+  return 0;
+}
+
+#endif
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 07b7eb2d165..3c5ab855970 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -771,6 +771,29 @@ public:
   const char *func_name() const { return "multipoint"; }
 };
 
+#ifdef HAVE_COMPRESS
+
+class Item_func_compress : public Item_str_func
+{
+  String buffer;
+public:
+  Item_func_compress(Item *a):Item_str_func(a){}
+  String *val_str(String *);
+  void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
+  const char *func_name() const{return "compress";}
+};
+
+class Item_func_uncompress : public Item_str_func 
+{
+  String buffer;
+public:
+  Item_func_uncompress(Item *a):Item_str_func(a){}
+  String *val_str(String *);
+  void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
+  const char *func_name() const{return "uncompress";}
+};
+
+#endif
 
 /*
 class Item_func_multipoint :public Item_str_func
diff --git a/sql/lex.h b/sql/lex.h
index 3bc5820ee66..2be5bea9693 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -445,6 +445,9 @@ static SYMBOL sql_functions[] = {
   { "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
   { "COALESCE",		SYM(COALESCE),0,0},
   { "COERCIBILITY",	SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_coercibility)},
+#ifdef HAVE_COMPRESS
+  { "COMPRESS",		SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_compress)},
+#endif
   { "CONCAT",		SYM(CONCAT),0,0},
   { "CONCAT_WS",	SYM(CONCAT_WS),0,0},
   { "CONNECTION_ID",	SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_connection_id)},
@@ -599,6 +602,10 @@ static SYMBOL sql_functions[] = {
   { "TOUCHES",		SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_touches)},
   { "TRIM",		SYM(TRIM),0,0},
   { "UCASE",		SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},
+#ifdef HAVE_COMPRESS
+  { "UNCOMPRESS",	SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_uncompress)},
+  { "UNCOMPRESSED_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_uncompressed_length)},
+#endif
   { "UNIQUE_USERS",	SYM(UNIQUE_USERS),0,0},
   { "UNIX_TIMESTAMP",	SYM(UNIX_TIMESTAMP),0,0},
   { "UPPER",		SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index f68de23034a..34d92836ce6 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -767,6 +767,7 @@ extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db;
 extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink;
 extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb;
 extern SHOW_COMP_OPTION have_crypt;
+extern SHOW_COMP_OPTION have_compress;
 
 #ifndef __WIN__
 extern pthread_t signal_thread;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ac3703c5a1d..687f2179193 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -257,6 +257,11 @@ SHOW_COMP_OPTION have_crypt=SHOW_OPTION_YES;
 #else
 SHOW_COMP_OPTION have_crypt=SHOW_OPTION_NO;
 #endif
+#ifdef HAVE_COMPRESS
+SHOW_COMP_OPTION have_compress= SHOW_OPTION_YES;
+#else
+SHOW_COMP_OPTION have_compress= SHOW_OPTION_NO;
+#endif
 
 const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
 
diff --git a/sql/set_var.cc b/sql/set_var.cc
index c4a4819689c..b7fcaf07f0c 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -465,6 +465,7 @@ struct show_var_st init_vars[]= {
   {"ft_stopword_file",        (char*) &ft_stopword_file,            SHOW_CHAR_PTR},
   {"have_bdb",		      (char*) &have_berkeley_db,	    SHOW_HAVE},
   {"have_crypt",	      (char*) &have_crypt,		    SHOW_HAVE},
+  {"have_compress",	      (char*) &have_compress,		    SHOW_HAVE},
   {"have_innodb",	      (char*) &have_innodb,		    SHOW_HAVE},
   {"have_isam",	      	      (char*) &have_isam,		    SHOW_HAVE},
   {"have_raid",		      (char*) &have_raid,		    SHOW_HAVE},
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 169595c34c5..427ca169a41 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -264,3 +264,7 @@ v/*
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index ff58079f4c8..b05395b707f 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -258,3 +258,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index a0a6755c693..ef3b9ba40e7 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -266,3 +266,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 0f48416d6db..213068c7d87 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -255,3 +255,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 4503f011692..1b4207c948a 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -260,3 +260,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 9474d67f2f2..ea0d3c28f95 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -255,3 +255,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index ef4110a6b93..9b66e6f7e0c 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -265,3 +265,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 3f54e7740bd..ffe9d71ca5d 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -255,3 +255,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 7519448ef33..79451ccdb74 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -257,3 +257,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 71a02896c01..4d292d7ad09 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -255,3 +255,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index b10ddb1d1d2..c88b41dd09a 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -257,3 +257,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index be1e85ad33c..f1e9eeacf1d 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -255,3 +255,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 84c96a0540e..957ee163759 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -257,3 +257,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index b57eb19906d..776f1cc415e 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -257,3 +257,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 2d07b362257..576825f749f 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -259,3 +259,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 8db48115c49..15570be044c 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -255,3 +255,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 337cfd0963e..97be6eee3e4 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -259,3 +259,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index b5d1a0a7e07..e7dc116f337 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -257,3 +257,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index d6883efc96b..a45db002932 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -251,3 +251,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index ee7d1e9c4fb..0b00722e314 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -263,3 +263,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 2dfdc7573fa..2090c6cdee2 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -256,3 +256,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 6d34b5a93b3..be5d056e3fb 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -255,3 +255,7 @@
 "COLLATION '%s' �r inte till�tet f�r CHARACTER SET '%s'"
 "Slaven har redan startat"
 "Slaven har redan stoppat"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index be8fe2afea5..0e550b15a55 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -260,3 +260,7 @@
 "COLLATION '%s' is not valid for CHARACTER SET '%s'"
 "The slave was already running"
 "The slave was already stopped"
+"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
+"Z_BUF_ERROR: Not enough memory available for zlib"
+"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
+"Z_DATA_ERROR: Input data was corrupted for zlib"
-- 
cgit v1.2.1