MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
service_mysql_string.h
1 /* Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
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 St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 /* This service provides functions to parse mysql String */
17 
18 #ifndef MYSQL_SERVICE_MYSQL_STRING_INCLUDED
19 #define MYSQL_SERVICE_MYSQL_STRING_INCLUDED
20 
21 #ifndef MYSQL_ABI_CHECK
22 #include <stdlib.h>
23 #endif
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 typedef void *mysql_string_iterator_handle;
30 typedef void *mysql_string_handle;
31 
32 extern struct mysql_string_service_st {
33  int (*mysql_string_convert_to_char_ptr_type)
34  (mysql_string_handle, const char *, char *, unsigned int, int *);
35  mysql_string_iterator_handle (*mysql_string_get_iterator_type)
36  (mysql_string_handle);
37  int (*mysql_string_iterator_next_type)(mysql_string_iterator_handle);
38  int (*mysql_string_iterator_isupper_type)(mysql_string_iterator_handle);
39  int (*mysql_string_iterator_islower_type)(mysql_string_iterator_handle);
40  int (*mysql_string_iterator_isdigit_type)(mysql_string_iterator_handle);
41  mysql_string_handle (*mysql_string_to_lowercase_type)(mysql_string_handle);
42  void (*mysql_string_free_type)(mysql_string_handle);
43  void (*mysql_string_iterator_free_type)(mysql_string_iterator_handle);
44 } *mysql_string_service;
45 
46 #ifdef MYSQL_DYNAMIC_PLUGIN
47 
48 #define mysql_string_convert_to_char_ptr(string_handle, charset_name, \
49  buffer, buffer_size, error) \
50  mysql_string_service->mysql_string_convert_to_char_ptr_type \
51  (string_handle, charset_name, buffer, \
52  buffer_size, error)
53 
54 #define mysql_string_get_iterator(string_handle) \
55  mysql_string_service->mysql_string_get_iterator_type(string_handle)
56 
57 #define mysql_string_iterator_next(iterator_handle) \
58  mysql_string_service->mysql_string_iterator_next_type(iterator_handle)
59 
60 #define mysql_string_iterator_isupper(iterator_handle) \
61  mysql_string_service->mysql_string_iterator_isupper_type \
62  (iterator_handle)
63 
64 #define mysql_string_iterator_islower(iterator_handle) \
65  mysql_string_service->mysql_string_iterator_islower_type \
66  (iterator_handle)
67 
68 #define mysql_string_iterator_isdigit(iterator_handle) \
69  mysql_string_service->mysql_string_iterator_isdigit_type \
70  (iterator_handle)
71 
72 #define mysql_string_to_lowercase(string_handle) \
73  mysql_string_service->mysql_string_to_lowercase_type(string_handle)
74 
75 #define mysql_string_free(mysql_string_handle) \
76  mysql_string_service->mysql_string_free_type(mysql_string_handle)
77 
78 #define mysql_string_iterator_free(mysql_string_iterator_handle) \
79  mysql_string_service->mysql_string_iterator_free_type \
80  (mysql_string_iterator_handle)
81 #else
82 
83 /* This service function convert string into given character set */
84 int mysql_string_convert_to_char_ptr(mysql_string_handle string_handle,
85  const char *charset_name, char *buffer,
86  unsigned int buffer_size, int *error);
87 
88 /* This service function returns the beginning of the iterator handle */
89 mysql_string_iterator_handle mysql_string_get_iterator(mysql_string_handle
90  string_handle);
91 /*
92  This service function gets the next iterator handle
93  returns 0 if reached the end else return 1
94 */
95 int mysql_string_iterator_next(mysql_string_iterator_handle iterator_handle);
96 
97 /*
98  This service function return 1 if current iterator handle points to a
99  uppercase character else return 0 for client character set.
100 */
101 int mysql_string_iterator_isupper(mysql_string_iterator_handle iterator_handle);
102 
103 /*
104  This service function return 1 if current iterator handle points to a
105  lowercase character else return 0 for client character set.
106 */
107 int mysql_string_iterator_islower(mysql_string_iterator_handle iterator_handle);
108 
109 /*
110  This service function return 1 if current iterator handle points to a digit
111  else return 0 for client character sets.
112 */
113 int mysql_string_iterator_isdigit(mysql_string_iterator_handle iterator_handle);
114 
115 /* convert string_handle into lowercase */
116 mysql_string_handle mysql_string_to_lowercase(mysql_string_handle
117  string_handle);
118 
119 /* It deallocates the string created on server side during plugin operations */
120 void mysql_string_free(mysql_string_handle);
121 
122 /*
123  It deallocates the string iterator created on server side
124  during plugin operations
125 */
126 void mysql_string_iterator_free(mysql_string_iterator_handle);
127 
128 #endif
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif