~drizzle-trunk/drizzle/development

1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
1
/*
2
 * Drizzle Client & Protocol Library
3
 *
4
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
5
 * All rights reserved.
6
 *
1971.2.1 by kalebral at gmail
update files that did not have license or had incorrect license structure
7
 * Redistribution and use in source and binary forms, with or without
8
 * modification, are permitted provided that the following conditions are
9
 * met:
10
 *
11
 *     * Redistributions of source code must retain the above copyright
12
 * notice, this list of conditions and the following disclaimer.
13
 *
14
 *     * Redistributions in binary form must reproduce the above
15
 * copyright notice, this list of conditions and the following disclaimer
16
 * in the documentation and/or other materials provided with the
17
 * distribution.
18
 *
19
 *     * The names of its contributors may not be used to endorse or
20
 * promote products derived from this software without specific prior
21
 * written permission.
22
 *
23
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
 *
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
35
 */
36
37
/**
38
 * @file
39
 * @brief Connection Declarations for Clients
40
 */
41
42
#ifndef __DRIZZLE_CON_CLIENT_H
43
#define __DRIZZLE_CON_CLIENT_H
44
45
#ifdef __cplusplus
46
extern "C" {
47
#endif
48
49
/**
50
 * @addtogroup drizzle_con_client Connection Declarations for Clients
51
 * @ingroup drizzle_client_interface
52
 * @{
53
 */
54
55
/**
56
 * Connect to server.
57
 *
58
 * @param[in] con Connection structure previously initialized with
59
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
60
 * @return Standard drizzle return value.
61
 */
62
DRIZZLE_API
63
drizzle_return_t drizzle_con_connect(drizzle_con_st *con);
64
65
/**
66
 * Send quit command to server for a connection.
67
 *
68
 * @param[in] con Connection structure previously initialized with
69
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
70
 * @param[in] result Caller allocated structure, or NULL to allocate one.
71
 * @param[out] ret_ptr Standard drizzle return value.
72
 * @return On success, a pointer to the (possibly allocated) structure. On
73
 *  failure this will be NULL.
74
 */
75
DRIZZLE_API
76
drizzle_result_st *drizzle_con_quit(drizzle_con_st *con,
77
                                    drizzle_result_st *result,
78
                                    drizzle_return_t *ret_ptr);
79
80
/**
81
 * @todo Remove this with next major API change.
82
 */
83
DRIZZLE_API
84
drizzle_result_st *drizzle_quit(drizzle_con_st *con,
85
                                drizzle_result_st *result,
86
                                drizzle_return_t *ret_ptr);
87
88
/**
89
 * Select a new default database for a connection.
90
 *
91
 * @param[in] con Connection structure previously initialized with
92
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
93
 * @param[in] result Caller allocated structure, or NULL to allocate one.
94
 * @param[in] db Default database to select.
95
 * @param[out] ret_ptr Standard drizzle return value.
96
 * @return On success, a pointer to the (possibly allocated) structure. On
97
 *  failure this will be NULL.
98
 */
99
DRIZZLE_API
100
drizzle_result_st *drizzle_con_select_db(drizzle_con_st *con,
101
                                         drizzle_result_st *result,
102
                                         const char *db,
103
                                         drizzle_return_t *ret_ptr);
104
105
/**
106
 * @todo Remove this with next major API change.
107
 */
108
DRIZZLE_API
109
drizzle_result_st *drizzle_select_db(drizzle_con_st *con,
110
                                     drizzle_result_st *result,
111
                                     const char *db,
112
                                     drizzle_return_t *ret_ptr);
113
114
/**
115
 * Send a shutdown message to the server.
116
 *
117
 * @param[in] con Connection structure previously initialized with
118
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
119
 * @param[in] result Caller allocated structure, or NULL to allocate one.
120
 * @param[out] ret_ptr Standard drizzle return value.
121
 * @return On success, a pointer to the (possibly allocated) structure. On
122
 *  failure this will be NULL.
123
 */
124
DRIZZLE_API
125
drizzle_result_st *drizzle_con_shutdown(drizzle_con_st *con,
126
                                        drizzle_result_st *result,
127
                                        drizzle_return_t *ret_ptr);
128
2191.1.1 by Brian Aker
Add in KILL protocol support.
129
DRIZZLE_API
130
drizzle_result_st *drizzle_kill(drizzle_con_st *con,
131
                                drizzle_result_st *result,
132
                                uint32_t query_id,
133
                                drizzle_return_t *ret_ptr);
134
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
135
/**
136
 * @todo Remove this with next major API change.
137
 */
138
#define DRIZZLE_SHUTDOWN_DEFAULT 0
139
DRIZZLE_API
140
drizzle_result_st *drizzle_shutdown(drizzle_con_st *con,
141
                                    drizzle_result_st *result, uint32_t level,
142
                                    drizzle_return_t *ret_ptr);
143
144
/**
145
 * Send a ping request to the server.
146
 *
147
 * @param[in] con Connection structure previously initialized with
148
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
149
 * @param[in] result Caller allocated structure, or NULL to allocate one.
150
 * @param[out] ret_ptr Standard drizzle return value.
151
 * @return On success, a pointer to the (possibly allocated) structure. On
152
 *  failure this will be NULL.
153
 */
154
DRIZZLE_API
155
drizzle_result_st *drizzle_con_ping(drizzle_con_st *con,
156
                                    drizzle_result_st *result,
157
                                    drizzle_return_t *ret_ptr);
158
159
/**
160
 * @todo Remove this with next major API change.
161
 */
162
DRIZZLE_API
163
drizzle_result_st *drizzle_ping(drizzle_con_st *con,
164
                                drizzle_result_st *result,
165
                                drizzle_return_t *ret_ptr);
166
167
/**
168
 * Send raw command to server, possibly in parts.
169
 *
170
 * @param[in] con Connection structure previously initialized with
171
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
172
 * @param[in] result Caller allocated structure, or NULL to allocate one.
173
 * @param[in] command Command to run on server.
174
 * @param[in] data Data to send along with the command.
175
 * @param[in] size Size of the current chunk of data being sent.
176
 * @param[in] total Total size of all data being sent for command.
177
 * @param[out] ret_ptr Standard drizzle return value.
178
 * @return On success, a pointer to the (possibly allocated) structure. On
179
 *  failure this will be NULL.
180
 */
181
DRIZZLE_API
182
drizzle_result_st *drizzle_con_command_write(drizzle_con_st *con,
183
                                             drizzle_result_st *result,
184
                                             drizzle_command_t command,
185
                                             const void *data, size_t size,
186
                                             size_t total,
187
                                             drizzle_return_t *ret_ptr);
188
189
/** @} */
190
191
#ifdef __cplusplus
192
}
193
#endif
194
195
#endif /* __DRIZZLE_CON_CLIENT_H */