summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2003-08-21 16:15:06 +0200
committerunknown <serg@serg.mylan>2003-08-21 16:15:06 +0200
commitaa4baac3f89a1842f2abdd117544f556c3e9dd77 (patch)
tree5d947ccbb3381780780dbd2338b587ce9cbe0855 /sql/item_strfunc.h
parent177dfa822eeefc25fc99d742203465dc5e28cdfa (diff)
downloadmariadb-git-aa4baac3f89a1842f2abdd117544f556c3e9dd77.tar.gz
fixed a crash on COMPRESS() and other zlib-dependent functions when compiled w/o zlib
moved them all from different places to item_strfunc.{h,cc} checksum table command Com_xxx status variables updated sql/item_create.cc: fixed a crash on COMPRESS() and other zlib-dependent functions when compiled w/o zlib moved them all from different places to item_strfunc.{h,cc} sql/item_func.cc: fixed a crash on COMPRESS() and other zlib-dependent functions when compiled w/o zlib moved them all from different places to item_strfunc.{h,cc} sql/item_func.h: fixed a crash on COMPRESS() and other zlib-dependent functions when compiled w/o zlib moved them all from different places to item_strfunc.{h,cc} sql/item_geofunc.h: fixed a crash on COMPRESS() and other zlib-dependent functions when compiled w/o zlib moved them all from different places to item_strfunc.{h,cc} sql/item_strfunc.cc: fixed a crash on COMPRESS() and other zlib-dependent functions when compiled w/o zlib moved them all from different places to item_strfunc.{h,cc} sql/item_strfunc.h: fixed a crash on COMPRESS() and other zlib-dependent functions when compiled w/o zlib moved them all from different places to item_strfunc.{h,cc} sql/mysql_priv.h: checksum table command sql/mysqld.cc: Com_xxx updated sql/sql_lex.h: checksum table command sql/sql_parse.cc: checksum table command sql/sql_table.cc: checksum table command sql/sql_yacc.yy: checksum table command
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index dfcc22b3443..d7547d69aed 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -623,9 +623,56 @@ public:
Item_func_collation(Item *a) :Item_str_func(a) {}
String *val_str(String *);
const char *func_name() const { return "collation"; }
- void fix_length_and_dec()
+ void fix_length_and_dec()
{
max_length=40; // should be enough
collation.set(system_charset_info);
};
};
+
+#ifdef HAVE_COMPRESS
+#define ZLIB_DEPENDED_FUNCTION ;
+#else
+#define ZLIB_DEPENDED_FUNCTION { null_value=1; return 0; }
+#endif
+
+class Item_func_compress: public Item_str_func
+{
+ String buffer;
+public:
+ Item_func_compress(Item *a):Item_str_func(a){}
+ void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
+ const char *func_name() const{return "compress";}
+ String *val_str(String *) ZLIB_DEPENDED_FUNCTION
+};
+
+class Item_func_uncompress: public Item_str_func
+{
+ String buffer;
+public:
+ Item_func_uncompress(Item *a): Item_str_func(a){}
+ void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
+ const char *func_name() const{return "uncompress";}
+ String *val_str(String *) ZLIB_DEPENDED_FUNCTION
+};
+
+class Item_func_crc32 :public Item_int_func
+{
+ String value;
+public:
+ Item_func_crc32(Item *a) :Item_int_func(a) {}
+ const char *func_name() const { return "crc32"; }
+ void fix_length_and_dec() { max_length=10; }
+ longlong val_int() ZLIB_DEPENDED_FUNCTION
+};
+
+class Item_func_uncompressed_length : public Item_int_func
+{
+ String value;
+public:
+ Item_func_uncompressed_length(Item *a):Item_int_func(a){}
+ const char *func_name() const{return "uncompressed_length";}
+ void fix_length_and_dec() { max_length=10; }
+ longlong val_int();
+};
+