~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
 *
7
 * Use and distribution licensed under the BSD license.  See
8
 * the COPYING file in this directory for full text.
9
 */
10
11
/**
12
 * @file
13
 * @brief Connection Declarations for Clients
14
 */
15
16
#ifndef __DRIZZLE_CON_CLIENT_H
17
#define __DRIZZLE_CON_CLIENT_H
18
19
#ifdef __cplusplus
20
extern "C" {
21
#endif
22
23
/**
24
 * @addtogroup drizzle_con_client Connection Declarations for Clients
25
 * @ingroup drizzle_client_interface
26
 * @{
27
 */
28
29
/**
30
 * Connect to server.
31
 *
32
 * @param[in] con Connection structure previously initialized with
33
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
34
 * @return Standard drizzle return value.
35
 */
36
DRIZZLE_API
37
drizzle_return_t drizzle_con_connect(drizzle_con_st *con);
38
39
/**
40
 * Send quit command to server for a connection.
41
 *
42
 * @param[in] con Connection structure previously initialized with
43
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
44
 * @param[in] result Caller allocated structure, or NULL to allocate one.
45
 * @param[out] ret_ptr Standard drizzle return value.
46
 * @return On success, a pointer to the (possibly allocated) structure. On
47
 *  failure this will be NULL.
48
 */
49
DRIZZLE_API
50
drizzle_result_st *drizzle_con_quit(drizzle_con_st *con,
51
                                    drizzle_result_st *result,
52
                                    drizzle_return_t *ret_ptr);
53
54
/**
55
 * @todo Remove this with next major API change.
56
 */
57
DRIZZLE_API
58
drizzle_result_st *drizzle_quit(drizzle_con_st *con,
59
                                drizzle_result_st *result,
60
                                drizzle_return_t *ret_ptr);
61
62
/**
63
 * Select a new default database for a connection.
64
 *
65
 * @param[in] con Connection structure previously initialized with
66
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
67
 * @param[in] result Caller allocated structure, or NULL to allocate one.
68
 * @param[in] db Default database to select.
69
 * @param[out] ret_ptr Standard drizzle return value.
70
 * @return On success, a pointer to the (possibly allocated) structure. On
71
 *  failure this will be NULL.
72
 */
73
DRIZZLE_API
74
drizzle_result_st *drizzle_con_select_db(drizzle_con_st *con,
75
                                         drizzle_result_st *result,
76
                                         const char *db,
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_select_db(drizzle_con_st *con,
84
                                     drizzle_result_st *result,
85
                                     const char *db,
86
                                     drizzle_return_t *ret_ptr);
87
88
/**
89
 * Send a shutdown message to the server.
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[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_shutdown(drizzle_con_st *con,
100
                                        drizzle_result_st *result,
101
                                        drizzle_return_t *ret_ptr);
102
103
/**
104
 * @todo Remove this with next major API change.
105
 */
106
#define DRIZZLE_SHUTDOWN_DEFAULT 0
107
DRIZZLE_API
108
drizzle_result_st *drizzle_shutdown(drizzle_con_st *con,
109
                                    drizzle_result_st *result, uint32_t level,
110
                                    drizzle_return_t *ret_ptr);
111
112
/**
113
 * Send a ping request to the server.
114
 *
115
 * @param[in] con Connection structure previously initialized with
116
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
117
 * @param[in] result Caller allocated structure, or NULL to allocate one.
118
 * @param[out] ret_ptr Standard drizzle return value.
119
 * @return On success, a pointer to the (possibly allocated) structure. On
120
 *  failure this will be NULL.
121
 */
122
DRIZZLE_API
123
drizzle_result_st *drizzle_con_ping(drizzle_con_st *con,
124
                                    drizzle_result_st *result,
125
                                    drizzle_return_t *ret_ptr);
126
127
/**
128
 * @todo Remove this with next major API change.
129
 */
130
DRIZZLE_API
131
drizzle_result_st *drizzle_ping(drizzle_con_st *con,
132
                                drizzle_result_st *result,
133
                                drizzle_return_t *ret_ptr);
134
135
/**
136
 * Send raw command to server, possibly in parts.
137
 *
138
 * @param[in] con Connection structure previously initialized with
139
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
140
 * @param[in] result Caller allocated structure, or NULL to allocate one.
141
 * @param[in] command Command to run on server.
142
 * @param[in] data Data to send along with the command.
143
 * @param[in] size Size of the current chunk of data being sent.
144
 * @param[in] total Total size of all data being sent for command.
145
 * @param[out] ret_ptr Standard drizzle return value.
146
 * @return On success, a pointer to the (possibly allocated) structure. On
147
 *  failure this will be NULL.
148
 */
149
DRIZZLE_API
150
drizzle_result_st *drizzle_con_command_write(drizzle_con_st *con,
151
                                             drizzle_result_st *result,
152
                                             drizzle_command_t command,
153
                                             const void *data, size_t size,
154
                                             size_t total,
155
                                             drizzle_return_t *ret_ptr);
156
157
/** @} */
158
159
#ifdef __cplusplus
160
}
161
#endif
162
163
#endif /* __DRIZZLE_CON_CLIENT_H */