1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Patrick Galbraith
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.
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.
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
21
#include <drizzled/server_includes.h>
22
#include <drizzled/sql_udf.h>
23
#include <drizzled/item/func.h>
24
#include <drizzled/function/str/strfunc.h>
30
class Item_func_sleep : public Item_int_func
36
Item_func_sleep() : Item_int_func()
41
const char *func_name() const
46
void fix_length_and_dec() {
50
bool check_argument_count(int n)
57
int64_t Item_func_sleep::val_int()
59
/* int time in seconds */
64
if ((arg_count != 1) || ! (stime= args[0]->val_str(&value)))
71
dtime= atoi(stime->c_ptr());
73
/* sleep dtime seconds */
80
Create_function<Item_func_sleep>
81
sleep_udf(string("sleep"));
83
static int sleep_plugin_init(PluginRegistry ®istry)
85
registry.add(&sleep_udf);
89
static int sleep_plugin_deinit(PluginRegistry ®istry)
91
registry.remove(&sleep_udf);
96
drizzle_declare_plugin(sleep)
103
sleep_plugin_init, /* Plugin Init */
104
sleep_plugin_deinit, /* Plugin Deinit */
105
NULL, /* status variables */
106
NULL, /* system variables */
107
NULL /* config options */
109
drizzle_declare_plugin_end;