1 /* Copyright (C) 2009-2014 Kentoku Shiba
2 
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License as published by
5   the Free Software Foundation; version 2 of the License.
6 
7   This program is distributed in the hope that it will be useful,
8   but WITHOUT ANY WARRANTY; without even the implied warranty of
9   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10   GNU General Public License for more details.
11 
12   You should have received a copy of the GNU General Public License
13   along with this program; if not, write to the Free Software
14   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
15 
16 #define MYSQL_SERVER 1
17 #include <my_global.h>
18 #include "spd_environ.h"
19 #include "mysql.h"
20 #include "spd_udf.h"
21 
22 extern "C" {
spider_direct_sql(UDF_INIT * initid,UDF_ARGS * args,char * is_null,char * error)23 long long spider_direct_sql(
24   UDF_INIT *initid,
25   UDF_ARGS *args,
26   char *is_null,
27   char *error
28 ) {
29   return spider_direct_sql_body(initid, args, is_null, error, FALSE);
30 }
31 
spider_direct_sql_init(UDF_INIT * initid,UDF_ARGS * args,char * message)32 my_bool spider_direct_sql_init(
33   UDF_INIT *initid,
34   UDF_ARGS *args,
35   char *message
36 ) {
37   return spider_direct_sql_init_body(initid, args, message, FALSE);
38 }
39 
spider_direct_sql_deinit(UDF_INIT * initid)40 void spider_direct_sql_deinit(
41   UDF_INIT *initid
42 ) {
43   spider_direct_sql_deinit_body(initid);
44 }
45 
46 #ifndef WITHOUT_SPIDER_BG_SEARCH
spider_bg_direct_sql(UDF_INIT * initid,UDF_ARGS * args,char * is_null,char * error)47 long long spider_bg_direct_sql(
48   UDF_INIT *initid,
49   UDF_ARGS *args,
50   char *is_null,
51   char *error
52 ) {
53   return spider_direct_sql_bg_end(initid);
54 }
55 
spider_bg_direct_sql_init(UDF_INIT * initid,UDF_ARGS * args,char * message)56 my_bool spider_bg_direct_sql_init(
57   UDF_INIT *initid,
58   UDF_ARGS *args,
59   char *message
60 ) {
61   return spider_direct_sql_init_body(initid, args, message, TRUE);
62 }
63 
spider_bg_direct_sql_deinit(UDF_INIT * initid)64 void spider_bg_direct_sql_deinit(
65   UDF_INIT *initid
66 ) {
67   spider_direct_sql_deinit_body(initid);
68 }
69 
spider_bg_direct_sql_clear(UDF_INIT * initid,char * is_null,char * error)70 void spider_bg_direct_sql_clear(
71   UDF_INIT *initid,
72   char *is_null,
73   char *error
74 ) {
75   spider_direct_sql_bg_start(initid);
76 }
77 
spider_bg_direct_sql_add(UDF_INIT * initid,UDF_ARGS * args,char * is_null,char * error)78 void spider_bg_direct_sql_add(
79   UDF_INIT *initid,
80   UDF_ARGS *args,
81   char *is_null,
82   char *error
83 ) {
84   spider_direct_sql_body(initid, args, is_null, error, TRUE);
85 }
86 #endif
87 
spider_ping_table(UDF_INIT * initid,UDF_ARGS * args,char * is_null,char * error)88 long long spider_ping_table(
89   UDF_INIT *initid,
90   UDF_ARGS *args,
91   char *is_null,
92   char *error
93 ) {
94   return spider_ping_table_body(initid, args, is_null, error);
95 }
96 
spider_ping_table_init(UDF_INIT * initid,UDF_ARGS * args,char * message)97 my_bool spider_ping_table_init(
98   UDF_INIT *initid,
99   UDF_ARGS *args,
100   char *message
101 ) {
102   return spider_ping_table_init_body(initid, args, message);
103 }
104 
spider_ping_table_deinit(UDF_INIT * initid)105 void spider_ping_table_deinit(
106   UDF_INIT *initid
107 ) {
108   spider_ping_table_deinit_body(initid);
109 }
110 
spider_flush_table_mon_cache(UDF_INIT * initid,UDF_ARGS * args,char * is_null,char * error)111 long long spider_flush_table_mon_cache(
112   UDF_INIT *initid,
113   UDF_ARGS *args,
114   char *is_null,
115   char *error
116 ) {
117   return spider_flush_table_mon_cache_body();
118 }
119 
spider_flush_table_mon_cache_init(UDF_INIT * initid,UDF_ARGS * args,char * message)120 my_bool spider_flush_table_mon_cache_init(
121   UDF_INIT *initid,
122   UDF_ARGS *args,
123   char *message
124 ) {
125   return FALSE;
126 }
127 
spider_flush_table_mon_cache_deinit(UDF_INIT * initid)128 void spider_flush_table_mon_cache_deinit(
129   UDF_INIT *initid
130 ) {
131 }
132 
spider_copy_tables(UDF_INIT * initid,UDF_ARGS * args,char * is_null,char * error)133 long long spider_copy_tables(
134   UDF_INIT *initid,
135   UDF_ARGS *args,
136   char *is_null,
137   char *error
138 ) {
139   return spider_copy_tables_body(initid, args, is_null, error);
140 }
141 
spider_copy_tables_init(UDF_INIT * initid,UDF_ARGS * args,char * message)142 my_bool spider_copy_tables_init(
143   UDF_INIT *initid,
144   UDF_ARGS *args,
145   char *message
146 ) {
147   return spider_copy_tables_init_body(initid, args, message);
148 }
149 
spider_copy_tables_deinit(UDF_INIT * initid)150 void spider_copy_tables_deinit(
151   UDF_INIT *initid
152 ) {
153   spider_copy_tables_deinit_body(initid);
154 }
155 }
156