~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/md5/md5udf.cc

  • Committer: Brian Aker
  • Date: 2009-03-27 22:55:28 UTC
  • mto: This revision was merged to the branch mainline in revision 968.
  • Revision ID: brian@tangent.org-20090327225528-8y76cfx8a4oemqv9
Remove ref_count

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 <drizzled/common_includes.h>
17
 
#include <drizzled/item_func.h>
18
 
#include <drizzled/item_strfunc.h>
 
16
#include <drizzled/server_includes.h>
 
17
#include <drizzled/sql_udf.h>
 
18
#include <drizzled/item/func.h>
 
19
#include <drizzled/function/str/strfunc.h>
19
20
 
20
21
#include <openssl/md5.h>
21
22
 
 
23
#include <stdio.h>
 
24
 
 
25
using namespace std;
 
26
 
22
27
class Item_func_md5 : public Item_str_func
23
28
{
24
29
public:
 
30
  Item_func_md5() : Item_str_func() {}
25
31
  const char *func_name() const { return "md5"; }
26
32
  String *val_str(String*);
27
33
  void fix_length_and_dec() {
28
34
    max_length=32;
29
35
    args[0]->collation.set(
30
36
      get_charset_by_csname(args[0]->collation.collation->csname,
31
 
                            MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
 
37
                            MY_CS_BINSORT), DERIVATION_COERCIBLE);
32
38
  }
33
39
 
34
40
};
67
73
}
68
74
 
69
75
 
70
 
Item_func* create_md5udf_item(MEM_ROOT* m)
71
 
{
72
 
  return  new (m) Item_func_md5();
73
 
}
74
 
 
75
 
struct udf_func md5udf = {
76
 
  { C_STRING_WITH_LEN("md5") },
77
 
  create_md5udf_item
78
 
};
 
76
Create_function<Item_func_md5> md5udf(string("md5"));
79
77
 
80
78
static int md5udf_plugin_init(void *p)
81
79
{
82
 
  udf_func **f = (udf_func**) p;
 
80
  Function_builder **f = (Function_builder**) p;
83
81
 
84
82
  *f= &md5udf;
85
83
 
88
86
 
89
87
static int md5udf_plugin_deinit(void *p)
90
88
{
91
 
  udf_func *udff = (udf_func *) p;
 
89
  Function_builder *udff = (Function_builder *) p;
92
90
  (void)udff;
93
91
  return 0;
94
92
}
95
93
 
96
 
mysql_declare_plugin(md5)
 
94
drizzle_declare_plugin(md5)
97
95
{
98
96
  DRIZZLE_UDF_PLUGIN,
99
97
  "md5",
107
105
  NULL,   /* system variables */
108
106
  NULL    /* config options */
109
107
}
110
 
mysql_declare_plugin_end;
 
108
drizzle_declare_plugin_end;