~drizzle-trunk/drizzle/development

2244.1.1 by Monty Taylor
Split libdrizzle into 1.0 and 2.0. Applied the C++ changes to 2.0 branch.
1
/*
2
 * Drizzle Client & Protocol Library
3
 *
4
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
5
 * All rights reserved.
6
 *
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
 *
35
 */
36
2449.1.4 by Brian Aker
Complete update of libdrizzle
37
#pragma once
38
2244.1.1 by Monty Taylor
Split libdrizzle into 1.0 and 2.0. Applied the C++ changes to 2.0 branch.
39
/**
40
 * @file
41
 * @brief Connection Declarations for Clients
42
 */
43
44
#ifdef __cplusplus
45
extern "C" {
46
#endif
47
48
/**
49
 * @addtogroup drizzle_con_client Connection Declarations for Clients
50
 * @ingroup drizzle_client_interface
51
 * @{
52
 */
53
54
/**
55
 * Connect to server.
56
 *
57
 * @param[in] con Connection structure previously initialized with
58
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
59
 * @return Standard drizzle return value.
60
 */
61
DRIZZLE_API
62
drizzle_return_t drizzle_con_connect(drizzle_con_st *con);
63
64
/**
65
 * Send quit command to server for a connection.
66
 *
67
 * @param[in] con Connection structure previously initialized with
68
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
69
 * @param[in] result Caller allocated structure, or NULL to allocate one.
70
 * @param[out] ret_ptr Standard drizzle return value.
71
 * @return On success, a pointer to the (possibly allocated) structure. On
72
 *  failure this will be NULL.
73
 */
74
DRIZZLE_API
75
drizzle_result_st *drizzle_con_quit(drizzle_con_st *con,
76
                                    drizzle_result_st *result,
77
                                    drizzle_return_t *ret_ptr);
78
79
/**
80
 * @todo Remove this with next major API change.
81
 */
82
DRIZZLE_API
83
drizzle_result_st *drizzle_quit(drizzle_con_st *con,
84
                                drizzle_result_st *result,
85
                                drizzle_return_t *ret_ptr);
86
87
/**
88
 * Select a new default database for a connection.
89
 *
90
 * @param[in] con Connection structure previously initialized with
91
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
92
 * @param[in] result Caller allocated structure, or NULL to allocate one.
93
 * @param[in] db Default database to select.
94
 * @param[out] ret_ptr Standard drizzle return value.
95
 * @return On success, a pointer to the (possibly allocated) structure. On
96
 *  failure this will be NULL.
97
 */
98
DRIZZLE_API
99
drizzle_result_st *drizzle_con_select_db(drizzle_con_st *con,
100
                                         drizzle_result_st *result,
101
                                         const char *db,
102
                                         drizzle_return_t *ret_ptr);
103
104
/**
105
 * @todo Remove this with next major API change.
106
 */
107
DRIZZLE_API
108
drizzle_result_st *drizzle_select_db(drizzle_con_st *con,
109
                                     drizzle_result_st *result,
110
                                     const char *db,
111
                                     drizzle_return_t *ret_ptr);
112
113
/**
114
 * Send a shutdown message to the server.
115
 *
116
 * @param[in] con Connection structure previously initialized with
117
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
118
 * @param[in] result Caller allocated structure, or NULL to allocate one.
119
 * @param[out] ret_ptr Standard drizzle return value.
120
 * @return On success, a pointer to the (possibly allocated) structure. On
121
 *  failure this will be NULL.
122
 */
123
DRIZZLE_API
124
drizzle_result_st *drizzle_con_shutdown(drizzle_con_st *con,
125
                                        drizzle_result_st *result,
126
                                        drizzle_return_t *ret_ptr);
127
128
DRIZZLE_API
129
drizzle_result_st *drizzle_kill(drizzle_con_st *con,
130
                                drizzle_result_st *result,
131
                                uint32_t query_id,
132
                                drizzle_return_t *ret_ptr);
133
134
/**
135
 * @todo Remove this with next major API change.
136
 */
137
#define DRIZZLE_SHUTDOWN_DEFAULT 0
138
DRIZZLE_API
139
drizzle_result_st *drizzle_shutdown(drizzle_con_st *con,
140
                                    drizzle_result_st *result, uint32_t level,
141
                                    drizzle_return_t *ret_ptr);
142
143
/**
144
 * Send a ping request to the server.
145
 *
146
 * @param[in] con Connection structure previously initialized with
147
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
148
 * @param[in] result Caller allocated structure, or NULL to allocate one.
149
 * @param[out] ret_ptr Standard drizzle return value.
150
 * @return On success, a pointer to the (possibly allocated) structure. On
151
 *  failure this will be NULL.
152
 */
153
DRIZZLE_API
154
drizzle_result_st *drizzle_con_ping(drizzle_con_st *con,
155
                                    drizzle_result_st *result,
156
                                    drizzle_return_t *ret_ptr);
157
158
/**
159
 * @todo Remove this with next major API change.
160
 */
161
DRIZZLE_API
162
drizzle_result_st *drizzle_ping(drizzle_con_st *con,
163
                                drizzle_result_st *result,
164
                                drizzle_return_t *ret_ptr);
165
166
/**
167
 * Send raw command to server, possibly in parts.
168
 *
169
 * @param[in] con Connection structure previously initialized with
170
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
171
 * @param[in] result Caller allocated structure, or NULL to allocate one.
172
 * @param[in] command Command to run on server.
173
 * @param[in] data Data to send along with the command.
174
 * @param[in] size Size of the current chunk of data being sent.
175
 * @param[in] total Total size of all data being sent for command.
176
 * @param[out] ret_ptr Standard drizzle return value.
177
 * @return On success, a pointer to the (possibly allocated) structure. On
178
 *  failure this will be NULL.
179
 */
180
DRIZZLE_API
181
drizzle_result_st *drizzle_con_command_write(drizzle_con_st *con,
182
                                             drizzle_result_st *result,
183
                                             drizzle_command_t command,
184
                                             const void *data, size_t size,
185
                                             size_t total,
186
                                             drizzle_return_t *ret_ptr);
187
188
/** @} */
189
190
#ifdef __cplusplus
191
}
192
#endif