Merge lp:~tenbrae/drizzle/connectionid-plugin into lp:~drizzle-trunk/drizzle/development

Proposed by aeva black
Status: Merged
Approved by: Jay Pipes
Approved revision: 1088
Merged at revision: not available
Proposed branch: lp:~tenbrae/drizzle/connectionid-plugin
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~tenbrae/drizzle/connectionid-plugin
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Stewart Smith (community) Approve
Review via email: mp+8241@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) :
review: Approve
Revision history for this message
Jay Pipes (jaypipes) wrote :

Approved.

review: Approve
1088. By aeva black

formatting cleanup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/Makefile.am'
--- drizzled/Makefile.am 2009-06-26 06:25:57 +0000
+++ drizzled/Makefile.am 2009-07-05 16:50:29 +0000
@@ -76,7 +76,6 @@
76 function/benchmark.h \76 function/benchmark.h \
77 function/char_length.h \77 function/char_length.h \
78 function/coercibility.h \78 function/coercibility.h \
79 function/connection_id.h \
80 function/create.h \79 function/create.h \
81 function/field.h \80 function/field.h \
82 function/find_in_set.h \81 function/find_in_set.h \
@@ -409,7 +408,6 @@
409 function/benchmark.cc \408 function/benchmark.cc \
410 function/char_length.cc \409 function/char_length.cc \
411 function/check_reserved_words.cc \410 function/check_reserved_words.cc \
412 function/connection_id.cc \
413 function/coercibility.cc \411 function/coercibility.cc \
414 function/field.cc \412 function/field.cc \
415 function/find_in_set.cc \413 function/find_in_set.cc \
416414
=== removed file 'drizzled/function/connection_id.cc'
--- drizzled/function/connection_id.cc 2009-05-15 07:39:56 +0000
+++ drizzled/function/connection_id.cc 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
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
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 <drizzled/server_includes.h>
21#include CSTDINT_H
22#include <drizzled/function/connection_id.h>
23#include <drizzled/session.h>
24
25void Item_func_connection_id::fix_length_and_dec()
26{
27 Item_int_func::fix_length_and_dec();
28 max_length= 10;
29}
30
31
32bool Item_func_connection_id::fix_fields(Session *session, Item **ref)
33{
34 if (Item_int_func::fix_fields(session, ref))
35 return true;
36
37 value= session->variables.pseudo_thread_id;
38
39 return false;
40}
41
420
=== removed file 'drizzled/function/connection_id.h'
--- drizzled/function/connection_id.h 2009-05-15 01:47:27 +0000
+++ drizzled/function/connection_id.h 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
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
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#ifndef DRIZZLED_FUNCTION_CONNECTION_ID_H
21#define DRIZZLED_FUNCTION_CONNECTION_ID_H
22
23#include <drizzled/function/math/int.h>
24#include <drizzled/function/func.h>
25
26class Item_func_connection_id :public Item_int_func
27{
28 int64_t value;
29
30public:
31 Item_func_connection_id() {}
32 const char *func_name() const { return "connection_id"; }
33 void fix_length_and_dec();
34 bool fix_fields(Session *session, Item **ref);
35 int64_t val_int() { assert(fixed == 1); return value; }
36};
37
38#endif /* DRIZZLED_FUNCTION_CONNECTION_ID_H */
390
=== modified file 'drizzled/item/create.cc'
--- drizzled/item/create.cc 2009-06-30 18:09:07 +0000
+++ drizzled/item/create.cc 2009-07-05 16:50:29 +0000
@@ -73,7 +73,6 @@
73#include <drizzled/function/math/ceiling.h>73#include <drizzled/function/math/ceiling.h>
74#include <drizzled/function/char_length.h>74#include <drizzled/function/char_length.h>
75#include <drizzled/function/coercibility.h>75#include <drizzled/function/coercibility.h>
76#include <drizzled/function/connection_id.h>
77#include <drizzled/function/math/cos.h>76#include <drizzled/function/math/cos.h>
78#include <drizzled/function/math/dec.h>77#include <drizzled/function/math/dec.h>
79#include <drizzled/function/math/decimal_typecast.h>78#include <drizzled/function/math/decimal_typecast.h>
@@ -424,21 +423,6 @@
424};423};
425424
426425
427class Create_func_connection_id : public Create_func_arg0
428{
429public:
430 using Create_func_arg0::create;
431
432 virtual Item *create(Session *session);
433
434 static Create_func_connection_id s_singleton;
435
436protected:
437 Create_func_connection_id() {}
438 virtual ~Create_func_connection_id() {}
439};
440
441
442class Create_func_conv : public Create_func_arg3426class Create_func_conv : public Create_func_arg3
443{427{
444public:428public:
@@ -1838,15 +1822,6 @@
1838}1822}
18391823
18401824
1841Create_func_connection_id Create_func_connection_id::s_singleton;
1842
1843Item*
1844Create_func_connection_id::create(Session *session)
1845{
1846 return new (session->mem_root) Item_func_connection_id();
1847}
1848
1849
1850Create_func_conv Create_func_conv::s_singleton;1825Create_func_conv Create_func_conv::s_singleton;
18511826
1852Item*1827Item*
@@ -2837,7 +2812,6 @@
2837 { { C_STRING_WITH_LEN("COERCIBILITY") }, BUILDER(Create_func_coercibility)},2812 { { C_STRING_WITH_LEN("COERCIBILITY") }, BUILDER(Create_func_coercibility)},
2838 { { C_STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat)},2813 { { C_STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat)},
2839 { { C_STRING_WITH_LEN("CONCAT_WS") }, BUILDER(Create_func_concat_ws)},2814 { { C_STRING_WITH_LEN("CONCAT_WS") }, BUILDER(Create_func_concat_ws)},
2840 { { C_STRING_WITH_LEN("CONNECTION_ID") }, BUILDER(Create_func_connection_id)},
2841 { { C_STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)},2815 { { C_STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)},
2842 { { C_STRING_WITH_LEN("COS") }, BUILDER(Create_func_cos)},2816 { { C_STRING_WITH_LEN("COS") }, BUILDER(Create_func_cos)},
2843 { { C_STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)},2817 { { C_STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)},
28442818
=== added directory 'plugin/connection_id'
=== added file 'plugin/connection_id/connection_id.cc'
--- plugin/connection_id/connection_id.cc 1970-01-01 00:00:00 +0000
+++ plugin/connection_id/connection_id.cc 2009-07-05 20:42:38 +0000
@@ -0,0 +1,94 @@
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
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 <drizzled/server_includes.h>
21#include <drizzled/function/math/int.h>
22#include <drizzled/function/create.h>
23#include <drizzled/session.h>
24
25using namespace std;
26
27class ConnectionIdFunction :public Item_int_func
28{
29 int64_t value;
30public:
31 ConnectionIdFunction() :Item_int_func() {}
32
33 int64_t val_int()
34 {
35 assert(fixed==1);
36 return value;
37 }
38
39 const char *func_name() const
40 {
41 return "connection_id";
42 }
43
44 void fix_length_and_dec()
45 {
46 Item_int_func::fix_length_and_dec();
47 max_length= 10;
48 }
49
50 bool fix_fields(Session *session, Item **ref)
51 {
52 if (Item_int_func::fix_fields(session, ref))
53 return true;
54
55 value= session->variables.pseudo_thread_id;
56
57 return false;
58 }
59
60 bool check_argument_count(int n)
61 {
62 return (n==0);
63 }
64};
65
66
67Create_function<ConnectionIdFunction> connection_idudf(string("connection_id"));
68
69static int initialize(PluginRegistry &registry)
70{
71 registry.add(&connection_idudf);
72 return 0;
73}
74
75static int finalize(PluginRegistry &registry)
76{
77 registry.remove(&connection_idudf);
78 return 0;
79}
80
81drizzle_declare_plugin(connection_id)
82{
83 "connection_id",
84 "1.0",
85 "Devananda van der Veen",
86 "Return the current connection_id",
87 PLUGIN_LICENSE_GPL,
88 initialize, /* Plugin Init */
89 finalize, /* Plugin Deinit */
90 NULL, /* status variables */
91 NULL, /* system variables */
92 NULL /* config options */
93}
94drizzle_declare_plugin_end;
095
=== added file 'plugin/connection_id/plugin.ini'
--- plugin/connection_id/plugin.ini 1970-01-01 00:00:00 +0000
+++ plugin/connection_id/plugin.ini 2009-07-05 20:42:38 +0000
@@ -0,0 +1,6 @@
1[plugin]
2name=connection_id
3title=Connection ID UDF
4description=UDF Plugin for connection_id function
5load_by_default=yes
6sources=connection_id.cc