~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/compression/compress.cc

  • Committer: Monty Taylor
  • Date: 2009-04-12 08:14:18 UTC
  • mto: (992.1.1 mordred)
  • mto: This revision was merged to the branch mainline in revision 990.
  • Revision ID: mordred@inaugust.com-20090412081418-dc6gh3g3awkrhwov
Merged compress, uncompress and uncompressed_length into one plugin lib. Yay new plugin registration!

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <drizzled/sql_error.h>
22
22
#include <drizzled/current_session.h>
23
23
#include <zlib.h>
 
24
#include "plugin/compression/compress.h"
 
25
 
24
26
#include <string>
25
27
 
26
28
using namespace std;
27
29
 
28
 
class Item_func_compress: public Item_str_func
29
 
{
30
 
  String buffer;
31
 
public:
32
 
  Item_func_compress():Item_str_func(){}
33
 
  void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
34
 
  const char *func_name() const{return "compress";}
35
 
  String *val_str(String *) ;
36
 
};
37
 
 
38
30
String *Item_func_compress::val_str(String *str)
39
31
{
40
32
  int err= Z_OK, code;
100
92
}
101
93
 
102
94
 
103
 
Create_function<Item_func_compress> compressudf(string("compress"));
104
 
 
105
 
static int compressudf_plugin_init(PluginRegistry &registry)
106
 
{
107
 
  registry.add(&compressudf);
108
 
  return 0;
109
 
}
110
 
 
111
 
drizzle_declare_plugin(compress)
112
 
{
113
 
  "compress",
114
 
  "1.0",
115
 
  "Stewart Smith",
116
 
  "UDF for compress()",
117
 
  PLUGIN_LICENSE_GPL,
118
 
  compressudf_plugin_init, /* Plugin Init */
119
 
  NULL, /* Plugin Deinit */
120
 
  NULL,   /* status variables */
121
 
  NULL,   /* system variables */
122
 
  NULL    /* config options */
123
 
}
124
 
drizzle_declare_plugin_end;