~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/compress/compressudf.cc

fix variables_c test, remove have_community checks, no longer valid

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
 
#include "config.h"
17
 
#include <drizzled/plugin/function.h>
 
16
#include <drizzled/server_includes.h>
 
17
#include <drizzled/sql_udf.h>
18
18
#include <drizzled/item/func.h>
19
19
#include <drizzled/function/str/strfunc.h>
20
20
#include <drizzled/error.h>
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
 
 
26
 
#include <string>
27
 
 
28
 
using namespace std;
29
 
using namespace drizzled;
 
24
 
 
25
class Item_func_compress: public Item_str_func
 
26
{
 
27
  String buffer;
 
28
public:
 
29
  Item_func_compress():Item_str_func(){}
 
30
  void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
 
31
  const char *func_name() const{return "compress";}
 
32
  String *val_str(String *) ;
 
33
};
30
34
 
31
35
String *Item_func_compress::val_str(String *str)
32
36
{
33
 
  int err= Z_OK;
34
 
  drizzled::error_t code;
 
37
  int err= Z_OK, code;
35
38
  ulong new_size;
36
39
  String *res;
37
40
  Byte *body;
94
97
}
95
98
 
96
99
 
 
100
Item_func* create_compressudf_item(MEM_ROOT* m)
 
101
{
 
102
  return  new (m) Item_func_compress();
 
103
}
 
104
 
 
105
static struct udf_func compressudf = {
 
106
  { C_STRING_WITH_LEN("compress") },
 
107
  create_compressudf_item
 
108
};
 
109
 
 
110
static int compressudf_plugin_init(void *p)
 
111
{
 
112
  udf_func **f = (udf_func**) p;
 
113
 
 
114
  *f= &compressudf;
 
115
 
 
116
  return 0;
 
117
}
 
118
 
 
119
static int compressudf_plugin_deinit(void *p)
 
120
{
 
121
  udf_func *udff = (udf_func *) p;
 
122
  (void)udff;
 
123
  return 0;
 
124
}
 
125
 
 
126
mysql_declare_plugin(compress)
 
127
{
 
128
  DRIZZLE_UDF_PLUGIN,
 
129
  "compress",
 
130
  "1.0",
 
131
  "Stewart Smith",
 
132
  "UDF for compress()",
 
133
  PLUGIN_LICENSE_GPL,
 
134
  compressudf_plugin_init, /* Plugin Init */
 
135
  compressudf_plugin_deinit, /* Plugin Deinit */
 
136
  NULL,   /* status variables */
 
137
  NULL,   /* system variables */
 
138
  NULL    /* config options */
 
139
}
 
140
mysql_declare_plugin_end;