~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/structs.h

  • Committer: Monty Taylor
  • Date: 2008-10-09 22:38:27 UTC
  • mto: This revision was merged to the branch mainline in revision 497.
  • Revision ID: monty@inaugust.com-20081009223827-bc9gvpiplsmvpwyq
Moved test() to its own file.
Made a new function to possibly replace int10_to_str.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 Struct Definitions
14
 
 */
15
 
 
16
 
#ifndef __DRIZZLE_STRUCTS_H
17
 
#define __DRIZZLE_STRUCTS_H
18
 
 
19
 
#include <sys/types.h>
20
 
#include <sys/socket.h>
21
 
#include <netdb.h>
22
 
#ifndef NI_MAXHOST
23
 
# define NI_MAXHOST 1025
24
 
#endif
25
 
 
26
 
#ifdef __cplusplus
27
 
extern "C" {
28
 
#endif
29
 
 
30
 
/**
31
 
 * @ingroup drizzle
32
 
 */
33
 
struct drizzle_st
34
 
{
35
 
  uint16_t error_code;
36
 
  drizzle_options_t options;
37
 
  drizzle_verbose_t verbose;
38
 
  uint32_t con_count;
39
 
  uint32_t pfds_size;
40
 
  uint32_t query_count;
41
 
  uint32_t query_new;
42
 
  uint32_t query_running;
43
 
  int last_errno;
44
 
  int timeout;
45
 
  drizzle_con_st *con_list;
46
 
  void *context;
47
 
  drizzle_context_free_fn *context_free_fn;
48
 
  drizzle_event_watch_fn *event_watch_fn;
49
 
  void *event_watch_context;
50
 
  drizzle_log_fn *log_fn;
51
 
  void *log_context;
52
 
  struct pollfd *pfds;
53
 
  drizzle_query_st *query_list;
54
 
  char sqlstate[DRIZZLE_MAX_SQLSTATE_SIZE + 1];
55
 
  char last_error[DRIZZLE_MAX_ERROR_SIZE];
56
 
};
57
 
 
58
 
/**
59
 
 * @ingroup drizzle_con
60
 
 */
61
 
struct drizzle_con_tcp_st
62
 
{
63
 
  in_port_t port;
64
 
  struct addrinfo *addrinfo;
65
 
  char *host;
66
 
  char host_buffer[NI_MAXHOST];
67
 
};
68
 
 
69
 
/**
70
 
 * @ingroup drizzle_con
71
 
 */
72
 
struct drizzle_con_uds_st
73
 
{
74
 
  struct addrinfo addrinfo;
75
 
  struct sockaddr_un sockaddr;
76
 
};
77
 
 
78
 
/**
79
 
 * @ingroup drizzle_con
80
 
 */
81
 
struct drizzle_con_st
82
 
{
83
 
  uint8_t packet_number;
84
 
  uint8_t protocol_version;
85
 
  uint8_t state_current;
86
 
  short events;
87
 
  short revents;
88
 
  drizzle_capabilities_t capabilities;
89
 
  drizzle_charset_t charset;
90
 
  drizzle_command_t command;
91
 
  drizzle_con_options_t options;
92
 
  drizzle_con_socket_t socket_type;
93
 
  drizzle_con_status_t status;
94
 
  uint32_t max_packet_size;
95
 
  uint32_t result_count;
96
 
  uint32_t thread_id;
97
 
  int backlog;
98
 
  int fd;
99
 
  size_t buffer_size;
100
 
  size_t command_offset;
101
 
  size_t command_size;
102
 
  size_t command_total;
103
 
  size_t packet_size;
104
 
  struct addrinfo *addrinfo_next;
105
 
  uint8_t *buffer_ptr;
106
 
  uint8_t *command_buffer;
107
 
  uint8_t *command_data;
108
 
  void *context;
109
 
  drizzle_con_context_free_fn *context_free_fn;
110
 
  drizzle_st *drizzle;
111
 
  drizzle_con_st *next;
112
 
  drizzle_con_st *prev;
113
 
  drizzle_query_st *query;
114
 
  drizzle_result_st *result;
115
 
  drizzle_result_st *result_list;
116
 
  uint8_t *scramble;
117
 
  union
118
 
  {
119
 
    drizzle_con_tcp_st tcp;
120
 
    drizzle_con_uds_st uds;
121
 
  } socket;
122
 
  uint8_t buffer[DRIZZLE_MAX_BUFFER_SIZE];
123
 
  char db[DRIZZLE_MAX_DB_SIZE];
124
 
  char password[DRIZZLE_MAX_PASSWORD_SIZE];
125
 
  uint8_t scramble_buffer[DRIZZLE_MAX_SCRAMBLE_SIZE];
126
 
  char server_version[DRIZZLE_MAX_SERVER_VERSION_SIZE];
127
 
  drizzle_state_fn *state_stack[DRIZZLE_STATE_STACK_SIZE];
128
 
  char user[DRIZZLE_MAX_USER_SIZE];
129
 
};
130
 
 
131
 
/**
132
 
 * @ingroup drizzle_query
133
 
 */
134
 
struct drizzle_query_st
135
 
{
136
 
  drizzle_st *drizzle;
137
 
  drizzle_query_st *next;
138
 
  drizzle_query_st *prev;
139
 
  drizzle_query_options_t options;
140
 
  drizzle_query_state_t state;
141
 
  drizzle_con_st *con;
142
 
  drizzle_result_st *result;
143
 
  const char *string;
144
 
  size_t size;
145
 
  void *context;
146
 
  drizzle_query_context_free_fn *context_free_fn;
147
 
};
148
 
 
149
 
/**
150
 
 * @ingroup drizzle_result
151
 
 */
152
 
struct drizzle_result_st
153
 
{
154
 
  drizzle_con_st *con;
155
 
  drizzle_result_st *next;
156
 
  drizzle_result_st *prev;
157
 
  drizzle_result_options_t options;
158
 
 
159
 
  char info[DRIZZLE_MAX_INFO_SIZE];
160
 
  uint16_t error_code;
161
 
  char sqlstate[DRIZZLE_MAX_SQLSTATE_SIZE + 1];
162
 
  uint64_t insert_id;
163
 
  uint16_t warning_count;
164
 
  uint64_t affected_rows;
165
 
 
166
 
  uint16_t column_count;
167
 
  uint16_t column_current;
168
 
  drizzle_column_st *column_list;
169
 
  drizzle_column_st *column;
170
 
  drizzle_column_st *column_buffer;
171
 
 
172
 
  uint64_t row_count;
173
 
  uint64_t row_current;
174
 
 
175
 
  uint16_t field_current;
176
 
  size_t field_total;
177
 
  size_t field_offset;
178
 
  size_t field_size;
179
 
  drizzle_field_t field;
180
 
  drizzle_field_t field_buffer;
181
 
 
182
 
  uint64_t row_list_size;
183
 
  drizzle_row_t row;
184
 
  drizzle_row_t *row_list;
185
 
  size_t *field_sizes;
186
 
  size_t **field_sizes_list;
187
 
};
188
 
 
189
 
/**
190
 
 * @ingroup drizzle_column
191
 
 */
192
 
struct drizzle_column_st
193
 
{
194
 
  drizzle_result_st *result;
195
 
  drizzle_column_st *next;
196
 
  drizzle_column_st *prev;
197
 
  drizzle_column_options_t options;
198
 
  char catalog[DRIZZLE_MAX_CATALOG_SIZE];
199
 
  char db[DRIZZLE_MAX_DB_SIZE];
200
 
  char table[DRIZZLE_MAX_TABLE_SIZE];
201
 
  char orig_table[DRIZZLE_MAX_TABLE_SIZE];
202
 
  char name[DRIZZLE_MAX_COLUMN_NAME_SIZE];
203
 
  char orig_name[DRIZZLE_MAX_COLUMN_NAME_SIZE];
204
 
  drizzle_charset_t charset;
205
 
  uint32_t size;
206
 
  size_t max_size;
207
 
  drizzle_column_type_t type;
208
 
  drizzle_column_flags_t flags;
209
 
  uint8_t decimals;
210
 
  uint8_t default_value[DRIZZLE_MAX_DEFAULT_VALUE_SIZE];
211
 
  size_t default_value_size;
212
 
};
213
 
 
214
 
#ifdef __cplusplus
215
 
}
216
 
#endif
217
 
 
218
 
#endif /* __DRIZZLE_STRUCTS_H */