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
1=== modified file 'drizzled/Makefile.am'
2--- drizzled/Makefile.am 2009-06-26 06:25:57 +0000
3+++ drizzled/Makefile.am 2009-07-05 16:50:29 +0000
4@@ -76,7 +76,6 @@
5 function/benchmark.h \
6 function/char_length.h \
7 function/coercibility.h \
8- function/connection_id.h \
9 function/create.h \
10 function/field.h \
11 function/find_in_set.h \
12@@ -409,7 +408,6 @@
13 function/benchmark.cc \
14 function/char_length.cc \
15 function/check_reserved_words.cc \
16- function/connection_id.cc \
17 function/coercibility.cc \
18 function/field.cc \
19 function/find_in_set.cc \
20
21=== removed file 'drizzled/function/connection_id.cc'
22--- drizzled/function/connection_id.cc 2009-05-15 07:39:56 +0000
23+++ drizzled/function/connection_id.cc 1970-01-01 00:00:00 +0000
24@@ -1,41 +0,0 @@
25-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
26- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
27- *
28- * Copyright (C) 2008 Sun Microsystems
29- *
30- * This program is free software; you can redistribute it and/or modify
31- * it under the terms of the GNU General Public License as published by
32- * the Free Software Foundation; version 2 of the License.
33- *
34- * This program is distributed in the hope that it will be useful,
35- * but WITHOUT ANY WARRANTY; without even the implied warranty of
36- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37- * GNU General Public License for more details.
38- *
39- * You should have received a copy of the GNU General Public License
40- * along with this program; if not, write to the Free Software
41- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
42- */
43-
44-#include <drizzled/server_includes.h>
45-#include CSTDINT_H
46-#include <drizzled/function/connection_id.h>
47-#include <drizzled/session.h>
48-
49-void Item_func_connection_id::fix_length_and_dec()
50-{
51- Item_int_func::fix_length_and_dec();
52- max_length= 10;
53-}
54-
55-
56-bool Item_func_connection_id::fix_fields(Session *session, Item **ref)
57-{
58- if (Item_int_func::fix_fields(session, ref))
59- return true;
60-
61- value= session->variables.pseudo_thread_id;
62-
63- return false;
64-}
65-
66
67=== removed file 'drizzled/function/connection_id.h'
68--- drizzled/function/connection_id.h 2009-05-15 01:47:27 +0000
69+++ drizzled/function/connection_id.h 1970-01-01 00:00:00 +0000
70@@ -1,38 +0,0 @@
71-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
72- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
73- *
74- * Copyright (C) 2008 Sun Microsystems
75- *
76- * This program is free software; you can redistribute it and/or modify
77- * it under the terms of the GNU General Public License as published by
78- * the Free Software Foundation; version 2 of the License.
79- *
80- * This program is distributed in the hope that it will be useful,
81- * but WITHOUT ANY WARRANTY; without even the implied warranty of
82- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83- * GNU General Public License for more details.
84- *
85- * You should have received a copy of the GNU General Public License
86- * along with this program; if not, write to the Free Software
87- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
88- */
89-
90-#ifndef DRIZZLED_FUNCTION_CONNECTION_ID_H
91-#define DRIZZLED_FUNCTION_CONNECTION_ID_H
92-
93-#include <drizzled/function/math/int.h>
94-#include <drizzled/function/func.h>
95-
96-class Item_func_connection_id :public Item_int_func
97-{
98- int64_t value;
99-
100-public:
101- Item_func_connection_id() {}
102- const char *func_name() const { return "connection_id"; }
103- void fix_length_and_dec();
104- bool fix_fields(Session *session, Item **ref);
105- int64_t val_int() { assert(fixed == 1); return value; }
106-};
107-
108-#endif /* DRIZZLED_FUNCTION_CONNECTION_ID_H */
109
110=== modified file 'drizzled/item/create.cc'
111--- drizzled/item/create.cc 2009-06-30 18:09:07 +0000
112+++ drizzled/item/create.cc 2009-07-05 16:50:29 +0000
113@@ -73,7 +73,6 @@
114 #include <drizzled/function/math/ceiling.h>
115 #include <drizzled/function/char_length.h>
116 #include <drizzled/function/coercibility.h>
117-#include <drizzled/function/connection_id.h>
118 #include <drizzled/function/math/cos.h>
119 #include <drizzled/function/math/dec.h>
120 #include <drizzled/function/math/decimal_typecast.h>
121@@ -424,21 +423,6 @@
122 };
123
124
125-class Create_func_connection_id : public Create_func_arg0
126-{
127-public:
128- using Create_func_arg0::create;
129-
130- virtual Item *create(Session *session);
131-
132- static Create_func_connection_id s_singleton;
133-
134-protected:
135- Create_func_connection_id() {}
136- virtual ~Create_func_connection_id() {}
137-};
138-
139-
140 class Create_func_conv : public Create_func_arg3
141 {
142 public:
143@@ -1838,15 +1822,6 @@
144 }
145
146
147-Create_func_connection_id Create_func_connection_id::s_singleton;
148-
149-Item*
150-Create_func_connection_id::create(Session *session)
151-{
152- return new (session->mem_root) Item_func_connection_id();
153-}
154-
155-
156 Create_func_conv Create_func_conv::s_singleton;
157
158 Item*
159@@ -2837,7 +2812,6 @@
160 { { C_STRING_WITH_LEN("COERCIBILITY") }, BUILDER(Create_func_coercibility)},
161 { { C_STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat)},
162 { { C_STRING_WITH_LEN("CONCAT_WS") }, BUILDER(Create_func_concat_ws)},
163- { { C_STRING_WITH_LEN("CONNECTION_ID") }, BUILDER(Create_func_connection_id)},
164 { { C_STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)},
165 { { C_STRING_WITH_LEN("COS") }, BUILDER(Create_func_cos)},
166 { { C_STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)},
167
168=== added directory 'plugin/connection_id'
169=== added file 'plugin/connection_id/connection_id.cc'
170--- plugin/connection_id/connection_id.cc 1970-01-01 00:00:00 +0000
171+++ plugin/connection_id/connection_id.cc 2009-07-05 20:42:38 +0000
172@@ -0,0 +1,94 @@
173+/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
174+ * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
175+ *
176+ * Copyright (C) 2008 Sun Microsystems
177+ *
178+ * This program is free software; you can redistribute it and/or modify
179+ * it under the terms of the GNU General Public License as published by
180+ * the Free Software Foundation; version 2 of the License.
181+ *
182+ * This program is distributed in the hope that it will be useful,
183+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
184+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
185+ * GNU General Public License for more details.
186+ *
187+ * You should have received a copy of the GNU General Public License
188+ * along with this program; if not, write to the Free Software
189+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
190+ */
191+
192+#include <drizzled/server_includes.h>
193+#include <drizzled/function/math/int.h>
194+#include <drizzled/function/create.h>
195+#include <drizzled/session.h>
196+
197+using namespace std;
198+
199+class ConnectionIdFunction :public Item_int_func
200+{
201+ int64_t value;
202+public:
203+ ConnectionIdFunction() :Item_int_func() {}
204+
205+ int64_t val_int()
206+ {
207+ assert(fixed==1);
208+ return value;
209+ }
210+
211+ const char *func_name() const
212+ {
213+ return "connection_id";
214+ }
215+
216+ void fix_length_and_dec()
217+ {
218+ Item_int_func::fix_length_and_dec();
219+ max_length= 10;
220+ }
221+
222+ bool fix_fields(Session *session, Item **ref)
223+ {
224+ if (Item_int_func::fix_fields(session, ref))
225+ return true;
226+
227+ value= session->variables.pseudo_thread_id;
228+
229+ return false;
230+ }
231+
232+ bool check_argument_count(int n)
233+ {
234+ return (n==0);
235+ }
236+};
237+
238+
239+Create_function<ConnectionIdFunction> connection_idudf(string("connection_id"));
240+
241+static int initialize(PluginRegistry &registry)
242+{
243+ registry.add(&connection_idudf);
244+ return 0;
245+}
246+
247+static int finalize(PluginRegistry &registry)
248+{
249+ registry.remove(&connection_idudf);
250+ return 0;
251+}
252+
253+drizzle_declare_plugin(connection_id)
254+{
255+ "connection_id",
256+ "1.0",
257+ "Devananda van der Veen",
258+ "Return the current connection_id",
259+ PLUGIN_LICENSE_GPL,
260+ initialize, /* Plugin Init */
261+ finalize, /* Plugin Deinit */
262+ NULL, /* status variables */
263+ NULL, /* system variables */
264+ NULL /* config options */
265+}
266+drizzle_declare_plugin_end;
267
268=== added file 'plugin/connection_id/plugin.ini'
269--- plugin/connection_id/plugin.ini 1970-01-01 00:00:00 +0000
270+++ plugin/connection_id/plugin.ini 2009-07-05 20:42:38 +0000
271@@ -0,0 +1,6 @@
272+[plugin]
273+name=connection_id
274+title=Connection ID UDF
275+description=UDF Plugin for connection_id function
276+load_by_default=yes
277+sources=connection_id.cc