Drizzled Public API Documentation

hello_world.cc
1 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2008 Sun Microsystems, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include <config.h>
21 
22 #include <drizzled/function/str/strfunc.h>
23 #include <drizzled/item/func.h>
24 #include <drizzled/plugin.h>
25 #include <drizzled/plugin/function.h>
26 
27 #include <string>
28 
29 using namespace std;
30 using namespace drizzled;
31 
33 {
34 public:
36  const char *func_name() const { return "hello_world"; }
38  s->set(STRING_WITH_LEN("Hello World!"),system_charset_info);
39  return s;
40  }
41  void fix_length_and_dec() {
42  max_length=strlen("Hello World!");
43  }
44 };
45 
46 plugin::Create_function<Item_func_hello_world> *hello_world_udf= NULL;
47 
48 static int hello_world_plugin_init(drizzled::module::Context &context)
49 {
50  hello_world_udf=
51  new plugin::Create_function<Item_func_hello_world>("hello_world");
52  context.add(hello_world_udf);
53 
54  return 0;
55 }
56 
57 DRIZZLE_DECLARE_PLUGIN
58 {
59  DRIZZLE_VERSION_ID, /* DRIZZLE_VERSION_ID */
60  "hello_world", /* module name */
61  "1.0", /* module version */
62  "Mark Atwood", /* author(s) */
63  N_("Example Function plugin"), /* description */
64  PLUGIN_LICENSE_BSD, /* license */
65  hello_world_plugin_init, /* init module function */
66  NULL, /* module dependencies */
67  NULL /* init options function */
68 }
69 DRIZZLE_DECLARE_PLUGIN_END;
String * val_str(String *s)
Definition: hello_world.cc:37