Merge lp:~fallenpegasus/drizzle/fix-libdrizzle into lp:~drizzle-trunk/drizzle/development

Proposed by Mark Atwood
Status: Merged
Approved by: Mark Atwood
Approved revision: 2455
Merged at revision: 2455
Proposed branch: lp:~fallenpegasus/drizzle/fix-libdrizzle
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 3321 lines (+792/-417)
78 files modified
.bzrignore (+1/-0)
Makefile.am (+2/-1)
configure.ac (+2/-11)
drizzled/drizzled.cc (+1/-1)
libdrizzle-1.0/column.c (+1/-1)
libdrizzle-1.0/column_client.h (+1/-5)
libdrizzle-1.0/column_server.h (+2/-5)
libdrizzle-1.0/command.c (+1/-1)
libdrizzle-1.0/common.h (+8/-11)
libdrizzle-1.0/conn.c (+7/-1)
libdrizzle-1.0/conn.h (+2/-5)
libdrizzle-1.0/conn_client.h (+2/-5)
libdrizzle-1.0/conn_local.h (+2/-5)
libdrizzle-1.0/conn_server.h (+2/-5)
libdrizzle-1.0/conn_uds.c (+1/-1)
libdrizzle-1.0/constants.h (+100/-37)
libdrizzle-1.0/drizzle.c (+1/-1)
libdrizzle-1.0/drizzle.h (+2/-6)
libdrizzle-1.0/drizzle_local.h (+2/-5)
libdrizzle-1.0/field.c (+1/-1)
libdrizzle-1.0/field_client.h (+2/-5)
libdrizzle-1.0/field_server.h (+1/-4)
libdrizzle-1.0/handshake.c (+1/-1)
libdrizzle-1.0/handshake_client.h (+2/-5)
libdrizzle-1.0/handshake_server.h (+2/-5)
libdrizzle-1.0/include.am (+26/-33)
libdrizzle-1.0/pack.c (+1/-1)
libdrizzle-1.0/pack.h (+2/-5)
libdrizzle-1.0/query.c (+1/-1)
libdrizzle-1.0/result.c (+183/-1)
libdrizzle-1.0/result_client.h (+2/-5)
libdrizzle-1.0/result_server.h (+2/-5)
libdrizzle-1.0/row.c (+1/-1)
libdrizzle-1.0/row_client.h (+2/-5)
libdrizzle-1.0/row_server.h (+2/-5)
libdrizzle-1.0/sha1.c (+1/-1)
libdrizzle-1.0/sha1.h (+2/-5)
libdrizzle-1.0/state.c (+3/-5)
libdrizzle-1.0/state.h (+2/-5)
libdrizzle-2.0/column.h (+1/-0)
libdrizzle-2.0/column_client.h (+1/-4)
libdrizzle-2.0/column_server.h (+2/-5)
libdrizzle-2.0/command_client.h (+2/-5)
libdrizzle-2.0/command_server.h (+1/-5)
libdrizzle-2.0/conn.cc (+10/-0)
libdrizzle-2.0/conn.h (+2/-5)
libdrizzle-2.0/conn_client.h (+2/-5)
libdrizzle-2.0/conn_local.h (+2/-5)
libdrizzle-2.0/conn_server.h (+2/-5)
libdrizzle-2.0/constants.h (+100/-37)
libdrizzle-2.0/drizzle.h (+2/-6)
libdrizzle-2.0/drizzle_client.h (+1/-5)
libdrizzle-2.0/drizzle_local.h (+2/-5)
libdrizzle-2.0/drizzle_server.h (+2/-5)
libdrizzle-2.0/field_client.h (+2/-5)
libdrizzle-2.0/field_server.h (+2/-5)
libdrizzle-2.0/handshake_client.h (+2/-5)
libdrizzle-2.0/handshake_server.h (+2/-5)
libdrizzle-2.0/include.am (+27/-33)
libdrizzle-2.0/pack.h (+2/-5)
libdrizzle-2.0/query.h (+2/-5)
libdrizzle-2.0/result.cc (+163/-0)
libdrizzle-2.0/result.h (+2/-5)
libdrizzle-2.0/result_client.h (+2/-5)
libdrizzle-2.0/result_server.h (+2/-5)
libdrizzle-2.0/row_client.h (+2/-5)
libdrizzle-2.0/row_server.h (+2/-5)
libdrizzle-2.0/sha1.h (+2/-5)
libdrizzle-2.0/state.cc (+1/-1)
libdrizzle-2.0/state.h (+2/-5)
libdrizzle-2.0/structs.h (+2/-5)
libdrizzle-2.0/visibility.h (+2/-2)
libdrizzle/drizzle_client.h (+39/-0)
libdrizzle/include.am (+2/-1)
support-files/drizzle7.pc.in (+2/-1)
support-files/libdrizzle-1.0.pc.in (+3/-3)
support-files/libdrizzle-2.0.pc.in (+3/-3)
support-files/libdrizzle.pc.in (+11/-0)
To merge this branch: bzr merge lp:~fallenpegasus/drizzle/fix-libdrizzle
Reviewer Review Type Date Requested Status
Drizzle Merge Team Pending
Review via email: mp+81509@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2011-11-04 21:06:16 +0000
3+++ .bzrignore 2011-11-08 00:09:24 +0000
4@@ -306,6 +306,7 @@
5 support-files/drizzle7.pc
6 support-files/drizzle.server
7 support-files/drizzle.spec
8+support-files/libdrizzle.pc
9 support-files/libdrizzle-1.0.pc
10 support-files/libdrizzle-2.0.pc
11 support-files/libdrizzleclient.pc
12
13=== modified file 'Makefile.am'
14--- Makefile.am 2011-11-04 21:06:16 +0000
15+++ Makefile.am 2011-11-08 00:09:24 +0000
16@@ -41,6 +41,8 @@
17 man_MANS =
18 bin_PROGRAMS =
19
20+nobase_include_HEADERS=
21+
22 # scripts or bin_scripts
23 dist_bin_SCRIPTS=
24 # sbin_scripts
25@@ -134,7 +136,6 @@
26 echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
27 echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
28 echo '#define INCLUDEDIR "$(includedir)"'; \
29- echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
30 echo '#define DOCDIR "$(docdir)"'; \
31 echo '#define INFODIR "$(infodir)"'; \
32 echo '#define HTMLDIR "$(htmldir)"'; \
33
34=== modified file 'configure.ac'
35--- configure.ac 2011-11-06 19:00:34 +0000
36+++ configure.ac 2011-11-08 00:09:24 +0000
37@@ -20,7 +20,7 @@
38 AC_PREREQ(2.59)dnl Minimum Autoconf version required.
39 dnl Version from the AC_INIT call below is overridden later
40 dnl So don't update it here
41-AC_INIT([drizzle7],[7],[http://bugs.launchpad.net/drizzle])
42+AC_INIT([drizzle7],[7],[http://bugs.launchpad.net/drizzle],[drizzle7],[http://drizzle.org/])
43 AC_CONFIG_SRCDIR([drizzled/drizzled.cc])
44 AC_CONFIG_AUX_DIR([config])
45
46@@ -56,16 +56,6 @@
47 # changed
48 AC_SUBST(OLDLIBDRIZZLE_LIBRARY_VERSION)
49
50-libdrizzleincludedir='${includedir}/libdrizzle-2.0'
51-libdrizzleinstalldir='${libdrizzleincludedir}/libdrizzle'
52-AC_SUBST(libdrizzleinstalldir)
53-AC_SUBST(libdrizzleincludedir)
54-
55-oldlibdrizzleincludedir='${includedir}/libdrizzle-1.0'
56-oldlibdrizzleinstalldir='${oldlibdrizzleincludedir}/libdrizzle'
57-AC_SUBST(oldlibdrizzleinstalldir)
58-AC_SUBST(oldlibdrizzleincludedir)
59-
60 # libdrizzle versioning when linked with GNU ld.
61 AS_IF([test "$lt_cv_prog_gnu_ld" = "yes"],[
62 LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/config/drizzle.ver"
63@@ -180,6 +170,7 @@
64 tests/Makefile dnl
65 drizzled/plugin/version.h dnl
66 support-files/drizzle7.pc dnl
67+ support-files/libdrizzle.pc dnl
68 support-files/libdrizzle-1.0.pc dnl
69 support-files/libdrizzle-2.0.pc dnl
70 support-files/smf/install.sh dnl
71
72=== modified file 'drizzled/drizzled.cc'
73--- drizzled/drizzled.cc 2011-10-24 09:51:02 +0000
74+++ drizzled/drizzled.cc 2011-11-08 00:09:24 +0000
75@@ -476,7 +476,7 @@
76 {
77 std::stringstream temp;
78 temp << _("Aborting:") << "\"" << message << "\"" << ". Abort was called from " << file << ":" << line << " in " << func << "()";
79- errmsg_printf(error::ERROR, temp.str().c_str());
80+ errmsg_printf(error::ERROR, "%s", temp.str().c_str());
81
82 clean_up(vm.count("help") == 0);
83 internal::my_end();
84
85=== modified file 'libdrizzle-1.0/column.c'
86--- libdrizzle-1.0/column.c 2011-11-04 21:06:16 +0000
87+++ libdrizzle-1.0/column.c 2011-11-08 00:09:24 +0000
88@@ -40,7 +40,7 @@
89 * @brief Column definitions
90 */
91
92-#include "common.h"
93+#include <libdrizzle-1.0/common.h>
94
95 /*
96 * Private variables.
97
98=== modified file 'libdrizzle-1.0/column_client.h'
99--- libdrizzle-1.0/column_client.h 2011-11-04 21:06:16 +0000
100+++ libdrizzle-1.0/column_client.h 2011-11-08 00:09:24 +0000
101@@ -34,15 +34,13 @@
102 *
103 */
104
105+#pragma once
106
107 /**
108 * @file
109 * @brief Column Declarations for Clients
110 */
111
112-#ifndef __DRIZZLE_COLUMN_CLIENT_H
113-#define __DRIZZLE_COLUMN_CLIENT_H
114-
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
118@@ -125,5 +123,3 @@
119 #ifdef __cplusplus
120 }
121 #endif
122-
123-#endif /* __DRIZZLE_COLUMN_CLIENT_H */
124
125=== modified file 'libdrizzle-1.0/column_server.h'
126--- libdrizzle-1.0/column_server.h 2011-11-04 21:06:16 +0000
127+++ libdrizzle-1.0/column_server.h 2011-11-08 00:09:24 +0000
128@@ -34,14 +34,13 @@
129 *
130 */
131
132+#pragma once
133+
134 /**
135 * @file
136 * @brief Column Declarations for Servers
137 */
138
139-#ifndef __DRIZZLE_COLUMN_SERVER_H
140-#define __DRIZZLE_COLUMN_SERVER_H
141-
142 #ifdef __cplusplus
143 extern "C" {
144 #endif
145@@ -145,5 +144,3 @@
146 #ifdef __cplusplus
147 }
148 #endif
149-
150-#endif /* __DRIZZLE_COLUMN_SERVER_H */
151
152=== modified file 'libdrizzle-1.0/command.c'
153--- libdrizzle-1.0/command.c 2011-11-04 21:06:16 +0000
154+++ libdrizzle-1.0/command.c 2011-11-08 00:09:24 +0000
155@@ -40,7 +40,7 @@
156 * @brief Command definitions
157 */
158
159-#include "common.h"
160+#include <libdrizzle-1.0/common.h>
161
162 /*
163 * Private variables.
164
165=== modified file 'libdrizzle-1.0/common.h'
166--- libdrizzle-1.0/common.h 2011-11-04 21:06:16 +0000
167+++ libdrizzle-1.0/common.h 2011-11-08 00:09:24 +0000
168@@ -39,13 +39,12 @@
169 * @brief System Include Files
170 */
171
172-#ifndef __DRIZZLE_COMMON_H
173-#define __DRIZZLE_COMMON_H
174+#pragma once
175
176 #include <config.h>
177
178-#include "drizzle_client.h"
179-#include "drizzle_server.h"
180+#include "libdrizzle-1.0/drizzle_client.h"
181+#include "libdrizzle-1.0/drizzle_server.h"
182
183 #include <assert.h>
184 #include <errno.h>
185@@ -61,10 +60,8 @@
186 #include <string.h>
187 #include <signal.h>
188
189-#include "drizzle_local.h"
190-#include "conn_local.h"
191-#include "pack.h"
192-#include "state.h"
193-#include "sha1.h"
194-
195-#endif /* __DRIZZLE_COMMON_H */
196+#include <libdrizzle-1.0/drizzle_local.h>
197+#include <libdrizzle-1.0/conn_local.h>
198+#include <libdrizzle-1.0/pack.h>
199+#include <libdrizzle-1.0/state.h>
200+#include <libdrizzle-1.0/sha1.h>
201
202=== modified file 'libdrizzle-1.0/conn.c'
203--- libdrizzle-1.0/conn.c 2011-11-04 21:06:16 +0000
204+++ libdrizzle-1.0/conn.c 2011-11-08 00:09:24 +0000
205@@ -40,7 +40,7 @@
206 * @brief Connection Definitions
207 */
208
209-#include "common.h"
210+#include <libdrizzle-1.0/common.h>
211
212 /**
213 * @addtogroup drizzle_con_static Static Connection Declarations
214@@ -487,6 +487,12 @@
215 {
216 drizzle_result_st *old_result;
217
218+ drizzle_return_t unused;
219+ if (ret_ptr == NULL)
220+ {
221+ ret_ptr= &unused;
222+ }
223+
224 if (!(con->options & DRIZZLE_CON_READY))
225 {
226 if (con->options & DRIZZLE_CON_RAW_PACKET)
227
228=== modified file 'libdrizzle-1.0/conn.h'
229--- libdrizzle-1.0/conn.h 2011-11-04 21:06:16 +0000
230+++ libdrizzle-1.0/conn.h 2011-11-08 00:09:24 +0000
231@@ -34,14 +34,13 @@
232 *
233 */
234
235+#pragma once
236+
237 /**
238 * @file
239 * @brief Connection Declarations
240 */
241
242-#ifndef __DRIZZLE_CONN_H
243-#define __DRIZZLE_CONN_H
244-
245 #ifdef __cplusplus
246 extern "C" {
247 #endif
248@@ -429,5 +428,3 @@
249 #ifdef __cplusplus
250 }
251 #endif
252-
253-#endif /* __DRIZZLE_CONN_H */
254
255=== modified file 'libdrizzle-1.0/conn_client.h'
256--- libdrizzle-1.0/conn_client.h 2011-11-04 21:06:16 +0000
257+++ libdrizzle-1.0/conn_client.h 2011-11-08 00:09:24 +0000
258@@ -34,14 +34,13 @@
259 *
260 */
261
262+#pragma once
263+
264 /**
265 * @file
266 * @brief Connection Declarations for Clients
267 */
268
269-#ifndef __DRIZZLE_CON_CLIENT_H
270-#define __DRIZZLE_CON_CLIENT_H
271-
272 #ifdef __cplusplus
273 extern "C" {
274 #endif
275@@ -191,5 +190,3 @@
276 #ifdef __cplusplus
277 }
278 #endif
279-
280-#endif /* __DRIZZLE_CON_CLIENT_H */
281
282=== modified file 'libdrizzle-1.0/conn_local.h'
283--- libdrizzle-1.0/conn_local.h 2011-11-04 21:06:16 +0000
284+++ libdrizzle-1.0/conn_local.h 2011-11-08 00:09:24 +0000
285@@ -34,14 +34,13 @@
286 *
287 */
288
289+#pragma once
290+
291 /**
292 * @file
293 * @brief Local Connection Declarations
294 */
295
296-#ifndef __DRIZZLE_CONN_LOCAL_H
297-#define __DRIZZLE_CONN_LOCAL_H
298-
299 #ifdef __cplusplus
300 extern "C" {
301 #endif
302@@ -117,5 +116,3 @@
303 #ifdef __cplusplus
304 }
305 #endif
306-
307-#endif /* __DRIZZLE_CONN_LOCAL_H */
308
309=== modified file 'libdrizzle-1.0/conn_server.h'
310--- libdrizzle-1.0/conn_server.h 2011-11-04 21:06:16 +0000
311+++ libdrizzle-1.0/conn_server.h 2011-11-08 00:09:24 +0000
312@@ -34,14 +34,13 @@
313 *
314 */
315
316+#pragma once
317+
318 /**
319 * @file
320 * @brief Connection Declarations for Servers
321 */
322
323-#ifndef __DRIZZLE_CON_SERVER_H
324-#define __DRIZZLE_CON_SERVER_H
325-
326 #ifdef __cplusplus
327 extern "C" {
328 #endif
329@@ -220,5 +219,3 @@
330 #ifdef __cplusplus
331 }
332 #endif
333-
334-#endif /* __DRIZZLE_CON_SERVER_H */
335
336=== modified file 'libdrizzle-1.0/conn_uds.c'
337--- libdrizzle-1.0/conn_uds.c 2011-11-04 21:06:16 +0000
338+++ libdrizzle-1.0/conn_uds.c 2011-11-08 00:09:24 +0000
339@@ -39,7 +39,7 @@
340 * @brief Connection Definitions for Unix Domain Sockets
341 */
342
343-#include "common.h"
344+#include <libdrizzle-1.0/common.h>
345
346 const char *drizzle_con_uds(const drizzle_con_st *con)
347 {
348
349=== modified file 'libdrizzle-1.0/constants.h'
350--- libdrizzle-1.0/constants.h 2011-11-04 21:06:16 +0000
351+++ libdrizzle-1.0/constants.h 2011-11-08 00:09:24 +0000
352@@ -1,6 +1,7 @@
353 /*
354 * Drizzle Client & Protocol Library
355 *
356+ * Copyright (C) 2011 Brian Aker (brian@tangent.org)
357 * Copyright (C) 2008 Eric Day (eday@oddments.org)
358 * All rights reserved.
359 *
360@@ -34,14 +35,13 @@
361 *
362 */
363
364+#pragma once
365+
366 /**
367 * @file
368 * @brief Defines, typedefs, enums, and macros
369 */
370
371-#ifndef __DRIZZLE_CONSTANTS_H
372-#define __DRIZZLE_CONSTANTS_H
373-
374 #ifdef __cplusplus
375 extern "C" {
376 #endif
377@@ -93,7 +93,7 @@
378 /**
379 * Return codes.
380 */
381-typedef enum
382+enum drizzle_return_t
383 {
384 DRIZZLE_RETURN_OK,
385 DRIZZLE_RETURN_IO_WAIT,
386@@ -120,13 +120,18 @@
387 DRIZZLE_RETURN_NO_ACTIVE_CONNECTIONS,
388 DRIZZLE_RETURN_HANDSHAKE_FAILED,
389 DRIZZLE_RETURN_TIMEOUT,
390+ DRIZZLE_RETURN_INVALID_ARGUMENT,
391 DRIZZLE_RETURN_MAX /* Always add new codes to the end before this one. */
392-} drizzle_return_t;
393+};
394+
395+#ifndef __cplusplus
396+typedef enum drizzle_return_t drizzle_return_t;
397+#endif
398
399 /**
400 * Verbosity levels.
401 */
402-typedef enum
403+enum drizzle_verbose_t
404 {
405 DRIZZLE_VERBOSE_NEVER,
406 DRIZZLE_VERBOSE_FATAL,
407@@ -135,7 +140,11 @@
408 DRIZZLE_VERBOSE_DEBUG,
409 DRIZZLE_VERBOSE_CRAZY,
410 DRIZZLE_VERBOSE_MAX
411-} drizzle_verbose_t;
412+};
413+
414+#ifndef __cplusplus
415+typedef enum drizzle_verbose_t drizzle_verbose_t;
416+#endif
417
418 /** @} */
419
420@@ -143,20 +152,24 @@
421 * @ingroup drizzle
422 * Options for drizzle_st.
423 */
424-typedef enum
425+enum drizzle_options_t
426 {
427 DRIZZLE_NONE= 0,
428 DRIZZLE_ALLOCATED= (1 << 0),
429 DRIZZLE_NON_BLOCKING= (1 << 1),
430 DRIZZLE_FREE_OBJECTS= (1 << 2),
431 DRIZZLE_ASSERT_DANGLING= (1 << 3)
432-} drizzle_options_t;
433+};
434+
435+#ifndef __cplusplus
436+typedef enum drizzle_options_t drizzle_options_t;
437+#endif
438
439 /**
440 * @ingroup drizzle_con
441 * Options for drizzle_con_st.
442 */
443-typedef enum
444+enum drizzle_con_options_t
445 {
446 DRIZZLE_CON_NONE= 0,
447 DRIZZLE_CON_ALLOCATED= (1 << 0),
448@@ -172,23 +185,31 @@
449 DRIZZLE_CON_INTERACTIVE= (1 << 11),
450 DRIZZLE_CON_MULTI_STATEMENTS= (1 << 12),
451 DRIZZLE_CON_AUTH_PLUGIN= (1 << 13)
452-} drizzle_con_options_t;
453+};
454+
455+#ifndef __cplusplus
456+typedef enum drizzle_con_options_t drizzle_con_options_t;
457+#endif
458
459 /**
460 * @ingroup drizzle_con
461 * Socket types for drizzle_con_st.
462 */
463-typedef enum
464+enum drizzle_con_socket_t
465 {
466 DRIZZLE_CON_SOCKET_TCP= 0,
467 DRIZZLE_CON_SOCKET_UDS= (1 << 0)
468-} drizzle_con_socket_t;
469+};
470+
471+#ifndef __cplusplus
472+typedef enum drizzle_con_socket_t drizzle_con_socket_t;
473+#endif
474
475 /**
476 * @ingroup drizzle_con
477 * Status flags for drizle_con_st.
478 */
479-typedef enum
480+enum drizzle_con_status_t
481 {
482 DRIZZLE_CON_STATUS_NONE= 0,
483 DRIZZLE_CON_STATUS_IN_TRANS= (1 << 0),
484@@ -201,13 +222,17 @@
485 DRIZZLE_CON_STATUS_DB_DROPPED= (1 << 8),
486 DRIZZLE_CON_STATUS_NO_BACKSLASH_ESCAPES= (1 << 9),
487 DRIZZLE_CON_STATUS_QUERY_WAS_SLOW= (1 << 10)
488-} drizzle_con_status_t;
489+};
490+
491+#ifndef __cplusplus
492+typedef enum drizzle_con_status_t drizzle_con_status_t;
493+#endif
494
495 /**
496 * @ingroup drizzle_con
497 * Capabilities for drizzle_con_st.
498 */
499-typedef enum
500+enum drizzle_capabilities_t
501 {
502 DRIZZLE_CAPABILITIES_NONE= 0,
503 DRIZZLE_CAPABILITIES_LONG_PASSWORD= (1 << 0),
504@@ -240,13 +265,17 @@
505 DRIZZLE_CAPABILITIES_TRANSACTIONS |
506 DRIZZLE_CAPABILITIES_PROTOCOL_41 |
507 DRIZZLE_CAPABILITIES_SECURE_CONNECTION)
508-} drizzle_capabilities_t;
509+};
510+
511+#ifndef __cplusplus
512+typedef enum drizzle_capabilities_t drizzle_capabilities_t;
513+#endif
514
515 /**
516 * @ingroup drizzle_command
517 * Commands for drizzle_command functions.
518 */
519-typedef enum
520+enum drizzle_command_t
521 {
522 DRIZZLE_COMMAND_SLEEP, /* Not used currently. */
523 DRIZZLE_COMMAND_QUIT,
524@@ -279,13 +308,17 @@
525 DRIZZLE_COMMAND_STMT_FETCH, /* Not used currently. */
526 DRIZZLE_COMMAND_DAEMON, /* Not used currently. */
527 DRIZZLE_COMMAND_END /* Not used currently. */
528-} drizzle_command_t;
529+};
530+
531+#ifndef __cplusplus
532+typedef enum drizzle_command_t drizzle_command_t;
533+#endif
534
535 /**
536 * @ingroup drizzle_command
537 * Commands for the Drizzle protocol functions.
538 */
539-typedef enum
540+enum drizzle_command_drizzle_t
541 {
542 DRIZZLE_COMMAND_DRIZZLE_SLEEP,
543 DRIZZLE_COMMAND_DRIZZLE_QUIT,
544@@ -296,35 +329,47 @@
545 DRIZZLE_COMMAND_DRIZZLE_PING,
546 DRIZZLE_COMMAND_DRIZZLE_KILL,
547 DRIZZLE_COMMAND_DRIZZLE_END
548-} drizzle_command_drizzle_t;
549+};
550+
551+#ifndef __cplusplus
552+typedef enum drizzle_command_drizzle_t drizzle_command_drizzle_t;
553+#endif
554
555 /**
556 * @ingroup drizzle_query
557 * Options for drizzle_query_st.
558 */
559-typedef enum
560+enum drizzle_query_options_t
561 {
562 DRIZZLE_QUERY_NONE,
563 DRIZZLE_QUERY_ALLOCATED= (1 << 0)
564-} drizzle_query_options_t;
565+};
566+
567+#ifndef __cplusplus
568+typedef enum drizzle_query_options_t drizzle_query_options_t;
569+#endif
570
571 /**
572 * @ingroup drizzle_query
573 * States for drizle_query_st.
574 */
575-typedef enum
576+enum drizzle_query_state_t
577 {
578 DRIZZLE_QUERY_STATE_INIT,
579 DRIZZLE_QUERY_STATE_QUERY,
580 DRIZZLE_QUERY_STATE_RESULT,
581 DRIZZLE_QUERY_STATE_DONE
582-} drizzle_query_state_t;
583+};
584+
585+#ifndef __cplusplus
586+typedef enum drizzle_query_state_t drizzle_query_state_t;
587+#endif
588
589 /**
590 * @ingroup drizzle_result
591 * Options for drizzle_result_st.
592 */
593-typedef enum
594+enum drizzle_result_options_t
595 {
596 DRIZZLE_RESULT_NONE= 0,
597 DRIZZLE_RESULT_ALLOCATED= (1 << 0),
598@@ -333,22 +378,30 @@
599 DRIZZLE_RESULT_BUFFER_ROW= (1 << 3),
600 DRIZZLE_RESULT_EOF_PACKET= (1 << 4),
601 DRIZZLE_RESULT_ROW_BREAK= (1 << 5)
602-} drizzle_result_options_t;
603+};
604+
605+#ifndef __cplusplus
606+typedef enum drizzle_result_options_t drizzle_result_options_t;
607+#endif
608
609 /**
610 * @ingroup drizzle_column
611 * Options for drizzle_column_st.
612 */
613-typedef enum
614+enum drizzle_column_options_t
615 {
616 DRIZZLE_COLUMN_ALLOCATED= (1 << 0)
617-} drizzle_column_options_t;
618+};
619+
620+#ifndef __cplusplus
621+typedef enum drizzle_column_options_t drizzle_column_options_t;
622+#endif
623
624 /**
625 * @ingroup drizzle_column
626 * Types for drizzle_column_st.
627 */
628-typedef enum
629+enum drizzle_column_type_t
630 {
631 DRIZZLE_COLUMN_TYPE_DECIMAL,
632 DRIZZLE_COLUMN_TYPE_TINY,
633@@ -377,13 +430,17 @@
634 DRIZZLE_COLUMN_TYPE_VAR_STRING= 253,
635 DRIZZLE_COLUMN_TYPE_STRING= 254,
636 DRIZZLE_COLUMN_TYPE_GEOMETRY= 255
637-} drizzle_column_type_t;
638+};
639+
640+#ifndef __cplusplus
641+typedef enum drizzle_column_type_t drizzle_column_type_t;
642+#endif
643
644 /**
645 * @ingroup drizzle_column
646 * Types for drizzle_column_st for Drizzle.
647 */
648-typedef enum
649+enum drizzle_column_type_drizzle_t
650 {
651 DRIZZLE_COLUMN_TYPE_DRIZZLE_TINY,
652 DRIZZLE_COLUMN_TYPE_DRIZZLE_LONG,
653@@ -402,13 +459,17 @@
654 DRIZZLE_COLUMN_TYPE_DRIZZLE_UUID,
655 DRIZZLE_COLUMN_TYPE_DRIZZLE_MICROTIME,
656 DRIZZLE_COLUMN_TYPE_DRIZZLE_MAX=DRIZZLE_COLUMN_TYPE_DRIZZLE_MICROTIME
657-} drizzle_column_type_drizzle_t;
658+};
659+
660+#ifndef __cplusplus
661+typedef enum drizzle_column_type_drizzle_t drizzle_column_type_drizzle_t;
662+#endif
663
664 /**
665 * @ingroup drizzle_column
666 * Flags for drizzle_column_st.
667 */
668-typedef enum
669+enum drizzle_column_flags_t
670 {
671 DRIZZLE_COLUMN_FLAGS_NONE= 0,
672 DRIZZLE_COLUMN_FLAGS_NOT_NULL= (1 << 0),
673@@ -434,7 +495,11 @@
674 DRIZZLE_COLUMN_FLAGS_IN_PART_FUNC= (1 << 19),
675 DRIZZLE_COLUMN_FLAGS_IN_ADD_INDEX= (1 << 20),
676 DRIZZLE_COLUMN_FLAGS_RENAMED= (1 << 21)
677-} drizzle_column_flags_t;
678+};
679+
680+#ifndef __cplusplus
681+typedef enum drizzle_column_flags_t drizzle_column_flags_t;
682+#endif
683
684 /**
685 * @addtogroup drizzle_types Types
686@@ -550,5 +615,3 @@
687 #ifdef __cplusplus
688 }
689 #endif
690-
691-#endif /* __DRIZZLE_CONSTANTS_H */
692
693=== modified file 'libdrizzle-1.0/drizzle.c'
694--- libdrizzle-1.0/drizzle.c 2011-11-04 21:06:16 +0000
695+++ libdrizzle-1.0/drizzle.c 2011-11-08 00:09:24 +0000
696@@ -39,7 +39,7 @@
697 * @brief Drizzle Definitions
698 */
699
700-#include "libdrizzle-1.0/common.h"
701+#include <libdrizzle-1.0/common.h>
702
703 /**
704 * @addtogroup drizzle_static Static Drizzle Declarations
705
706=== modified file 'libdrizzle-1.0/drizzle.h'
707--- libdrizzle-1.0/drizzle.h 2011-11-04 21:06:16 +0000
708+++ libdrizzle-1.0/drizzle.h 2011-11-08 00:09:24 +0000
709@@ -34,15 +34,13 @@
710 *
711 */
712
713+#pragma once
714+
715 /**
716 * @file
717 * @brief Drizzle Declarations
718 */
719
720-#ifndef __DRIZZLE_H
721-#define __DRIZZLE_H
722-
723-
724 #include <inttypes.h>
725 #include <sys/types.h>
726
727@@ -435,5 +433,3 @@
728 #ifdef __cplusplus
729 }
730 #endif
731-
732-#endif /* __DRIZZLE_H */
733
734=== modified file 'libdrizzle-1.0/drizzle_local.h'
735--- libdrizzle-1.0/drizzle_local.h 2011-11-04 21:06:16 +0000
736+++ libdrizzle-1.0/drizzle_local.h 2011-11-08 00:09:24 +0000
737@@ -34,14 +34,13 @@
738 *
739 */
740
741+#pragma once
742+
743 /**
744 * @file
745 * @brief Local Drizzle Declarations
746 */
747
748-#ifndef __DRIZZLE_LOCAL_H
749-#define __DRIZZLE_LOCAL_H
750-
751 #ifdef __cplusplus
752 extern "C" {
753 #endif
754@@ -162,5 +161,3 @@
755 #ifdef __cplusplus
756 }
757 #endif
758-
759-#endif /* __DRIZZLE_LOCAL_H */
760
761=== modified file 'libdrizzle-1.0/field.c'
762--- libdrizzle-1.0/field.c 2011-11-04 21:06:16 +0000
763+++ libdrizzle-1.0/field.c 2011-11-08 00:09:24 +0000
764@@ -39,7 +39,7 @@
765 * @brief Field definitions
766 */
767
768-#include "common.h"
769+#include <libdrizzle-1.0/common.h>
770
771 /*
772 * Client definitions
773
774=== modified file 'libdrizzle-1.0/field_client.h'
775--- libdrizzle-1.0/field_client.h 2011-11-04 21:06:16 +0000
776+++ libdrizzle-1.0/field_client.h 2011-11-08 00:09:24 +0000
777@@ -34,14 +34,13 @@
778 *
779 */
780
781+#pragma once
782+
783 /**
784 * @file
785 * @brief Field Declarations for Clients
786 */
787
788-#ifndef __DRIZZLE_FIELD_CLIENT_H
789-#define __DRIZZLE_FIELD_CLIENT_H
790-
791 #ifdef __cplusplus
792 extern "C" {
793 #endif
794@@ -84,5 +83,3 @@
795 #ifdef __cplusplus
796 }
797 #endif
798-
799-#endif /* __DRIZZLE_FIELD_CLIENT_H */
800
801=== modified file 'libdrizzle-1.0/field_server.h'
802--- libdrizzle-1.0/field_server.h 2011-11-04 21:06:16 +0000
803+++ libdrizzle-1.0/field_server.h 2011-11-08 00:09:24 +0000
804@@ -39,8 +39,7 @@
805 * @brief Field Declarations for Servers
806 */
807
808-#ifndef __DRIZZLE_FIELD_SERVER_H
809-#define __DRIZZLE_FIELD_SERVER_H
810+#pragma once
811
812 #ifdef __cplusplus
813 extern "C" {
814@@ -64,5 +63,3 @@
815 #ifdef __cplusplus
816 }
817 #endif
818-
819-#endif /* __DRIZZLE_FIELD_SERVER_H */
820
821=== modified file 'libdrizzle-1.0/handshake.c'
822--- libdrizzle-1.0/handshake.c 2011-11-04 21:06:16 +0000
823+++ libdrizzle-1.0/handshake.c 2011-11-08 00:09:24 +0000
824@@ -39,7 +39,7 @@
825 * @brief Handshake Definitions
826 */
827
828-#include "common.h"
829+#include <libdrizzle-1.0/common.h>
830
831 /*
832 * Client Definitions
833
834=== modified file 'libdrizzle-1.0/handshake_client.h'
835--- libdrizzle-1.0/handshake_client.h 2011-11-04 21:06:16 +0000
836+++ libdrizzle-1.0/handshake_client.h 2011-11-08 00:09:24 +0000
837@@ -34,14 +34,13 @@
838 *
839 */
840
841+#pragma once
842+
843 /**
844 * @file
845 * @brief Handshake Declarations for Clients
846 */
847
848-#ifndef __DRIZZLE_HANDSHAKE_CLIENT_H
849-#define __DRIZZLE_HANDSHAKE_CLIENT_H
850-
851 #ifdef __cplusplus
852 extern "C" {
853 #endif
854@@ -81,5 +80,3 @@
855 #ifdef __cplusplus
856 }
857 #endif
858-
859-#endif /* __DRIZZLE_HANDSHAKE_CLIENT_H */
860
861=== modified file 'libdrizzle-1.0/handshake_server.h'
862--- libdrizzle-1.0/handshake_server.h 2011-11-04 21:06:16 +0000
863+++ libdrizzle-1.0/handshake_server.h 2011-11-08 00:09:24 +0000
864@@ -34,14 +34,13 @@
865 *
866 */
867
868+#pragma once
869+
870 /**
871 * @file
872 * @brief Handshake Declarations for Servers
873 */
874
875-#ifndef __DRIZZLE_HANDSHAKE_SERVER_H
876-#define __DRIZZLE_HANDSHAKE_SERVER_H
877-
878 #ifdef __cplusplus
879 extern "C" {
880 #endif
881@@ -79,5 +78,3 @@
882 #ifdef __cplusplus
883 }
884 #endif
885-
886-#endif /* __DRIZZLE_HANDSHAKE_SERVER_H */
887
888=== modified file 'libdrizzle-1.0/include.am'
889--- libdrizzle-1.0/include.am 2011-11-04 21:06:16 +0000
890+++ libdrizzle-1.0/include.am 2011-11-08 00:09:24 +0000
891@@ -63,32 +63,32 @@
892 libdrizzle-1.0/sha1.c \
893 libdrizzle-1.0/state.c
894
895-dist_oldlibdrizzleinstall_HEADERS= \
896- libdrizzle-1.0/column.h \
897- libdrizzle-1.0/column_client.h \
898- libdrizzle-1.0/column_server.h \
899- libdrizzle-1.0/command_client.h \
900- libdrizzle-1.0/command_server.h \
901- libdrizzle-1.0/conn.h \
902- libdrizzle-1.0/conn_client.h \
903- libdrizzle-1.0/conn_server.h \
904- libdrizzle-1.0/constants.h \
905- libdrizzle-1.0/drizzle.h \
906- libdrizzle-1.0/drizzle_client.h \
907- libdrizzle-1.0/drizzle_server.h \
908- libdrizzle-1.0/field_client.h \
909- libdrizzle-1.0/field_server.h \
910- libdrizzle-1.0/handshake_client.h \
911- libdrizzle-1.0/handshake_server.h \
912- libdrizzle-1.0/libdrizzle.h \
913- libdrizzle-1.0/query.h \
914- libdrizzle-1.0/result.h \
915- libdrizzle-1.0/result_client.h \
916- libdrizzle-1.0/result_server.h \
917- libdrizzle-1.0/row_client.h \
918- libdrizzle-1.0/row_server.h \
919- libdrizzle-1.0/structs.h \
920- libdrizzle-1.0/visibility.h
921+nobase_include_HEADERS+= \
922+ libdrizzle-1.0/column.h \
923+ libdrizzle-1.0/column_client.h \
924+ libdrizzle-1.0/column_server.h \
925+ libdrizzle-1.0/command_client.h \
926+ libdrizzle-1.0/command_server.h \
927+ libdrizzle-1.0/conn.h \
928+ libdrizzle-1.0/conn_client.h \
929+ libdrizzle-1.0/conn_server.h \
930+ libdrizzle-1.0/constants.h \
931+ libdrizzle-1.0/drizzle.h \
932+ libdrizzle-1.0/drizzle_client.h \
933+ libdrizzle-1.0/drizzle_server.h \
934+ libdrizzle-1.0/field_client.h \
935+ libdrizzle-1.0/field_server.h \
936+ libdrizzle-1.0/handshake_client.h \
937+ libdrizzle-1.0/handshake_server.h \
938+ libdrizzle-1.0/libdrizzle.h \
939+ libdrizzle-1.0/query.h \
940+ libdrizzle-1.0/result.h \
941+ libdrizzle-1.0/result_client.h \
942+ libdrizzle-1.0/result_server.h \
943+ libdrizzle-1.0/row_client.h \
944+ libdrizzle-1.0/row_server.h \
945+ libdrizzle-1.0/structs.h \
946+ libdrizzle-1.0/visibility.h
947
948 noinst_HEADERS+= \
949 libdrizzle-1.0/common.h \
950@@ -97,10 +97,3 @@
951 libdrizzle-1.0/pack.h \
952 libdrizzle-1.0/state.h \
953 libdrizzle-1.0/sha1.h
954-
955-libdrizzle-1.0: libdrizzle-1.0/libdrizzle.la
956-install-libdrizzle-1.0: libdrizzle-1.0 install-dist_oldlibdrizzleinstallHEADERS
957- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
958- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) libdrizzle-1.0/libdrizzle.la '$(DESTDIR)$(libdir)'";
959- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) libdrizzle-1.0/libdrizzle.la "$(DESTDIR)$(libdir)";
960-
961
962=== modified file 'libdrizzle-1.0/pack.c'
963--- libdrizzle-1.0/pack.c 2011-11-04 21:06:16 +0000
964+++ libdrizzle-1.0/pack.c 2011-11-08 00:09:24 +0000
965@@ -39,7 +39,7 @@
966 * @brief Packing definitions
967 */
968
969-#include "common.h"
970+#include <libdrizzle-1.0/common.h>
971
972 /*
973 * Private declarations
974
975=== modified file 'libdrizzle-1.0/pack.h'
976--- libdrizzle-1.0/pack.h 2011-11-04 21:06:16 +0000
977+++ libdrizzle-1.0/pack.h 2011-11-08 00:09:24 +0000
978@@ -34,14 +34,13 @@
979 *
980 */
981
982+#pragma once
983+
984 /**
985 * @file
986 * @brief Packing Declarations
987 */
988
989-#ifndef __DRIZZLE_PACK_H
990-#define __DRIZZLE_PACK_H
991-
992 #ifdef __cplusplus
993 extern "C" {
994 #endif
995@@ -92,5 +91,3 @@
996 #ifdef __cplusplus
997 }
998 #endif
999-
1000-#endif /* __DRIZZLE_PACK_H */
1001
1002=== modified file 'libdrizzle-1.0/query.c'
1003--- libdrizzle-1.0/query.c 2011-11-04 21:06:16 +0000
1004+++ libdrizzle-1.0/query.c 2011-11-08 00:09:24 +0000
1005@@ -39,7 +39,7 @@
1006 * @brief Query definitions
1007 */
1008
1009-#include "common.h"
1010+#include <libdrizzle-1.0/common.h>
1011
1012 drizzle_result_st *drizzle_query(drizzle_con_st *con, drizzle_result_st *result,
1013 const char *query, size_t size,
1014
1015=== modified file 'libdrizzle-1.0/result.c'
1016--- libdrizzle-1.0/result.c 2011-11-04 21:06:16 +0000
1017+++ libdrizzle-1.0/result.c 2011-11-08 00:09:24 +0000
1018@@ -39,7 +39,7 @@
1019 * @brief Result definitions
1020 */
1021
1022-#include "common.h"
1023+#include <libdrizzle-1.0/common.h>
1024
1025 /*
1026 * Common definitions
1027@@ -48,6 +48,11 @@
1028 drizzle_result_st *drizzle_result_create(drizzle_con_st *con,
1029 drizzle_result_st *result)
1030 {
1031+ if (con == NULL)
1032+ {
1033+ return NULL;
1034+ }
1035+
1036 if (result == NULL)
1037 {
1038 result= malloc(sizeof(drizzle_result_st));
1039@@ -61,7 +66,9 @@
1040 result->options|= DRIZZLE_RESULT_ALLOCATED;
1041 }
1042 else
1043+ {
1044 memset(result, 0, sizeof(drizzle_result_st));
1045+ }
1046
1047 result->con= con;
1048 con->result= result;
1049@@ -79,9 +86,12 @@
1050 drizzle_result_st *result,
1051 drizzle_result_st *from)
1052 {
1053+ // A NULL con will return a NULL result
1054 result= drizzle_result_create(con, result);
1055 if (result == NULL)
1056+ {
1057 return NULL;
1058+ }
1059
1060 result->options|= (from->options &
1061 (drizzle_result_options_t)~DRIZZLE_RESULT_ALLOCATED);
1062@@ -100,11 +110,18 @@
1063
1064 void drizzle_result_free(drizzle_result_st *result)
1065 {
1066+ if (result == NULL)
1067+ {
1068+ return;
1069+ }
1070+
1071 drizzle_column_st *column;
1072 uint64_t x;
1073
1074 for (column= result->column_list; column != NULL; column= result->column_list)
1075+ {
1076 drizzle_column_free(column);
1077+ }
1078
1079 free(result->column_buffer);
1080
1081@@ -123,73 +140,142 @@
1082 if (result->con->result_list == result)
1083 result->con->result_list= result->next;
1084 }
1085+
1086 if (result->prev)
1087+ {
1088 result->prev->next= result->next;
1089+ }
1090 if (result->next)
1091+ {
1092 result->next->prev= result->prev;
1093+ }
1094
1095 if (result->options & DRIZZLE_RESULT_ALLOCATED)
1096+ {
1097 free(result);
1098+ }
1099 }
1100
1101 void drizzle_result_free_all(drizzle_con_st *con)
1102 {
1103+ if (con == NULL)
1104+ {
1105+ return;
1106+ }
1107+
1108 while (con->result_list != NULL)
1109+ {
1110 drizzle_result_free(con->result_list);
1111+ }
1112 }
1113
1114 drizzle_con_st *drizzle_result_drizzle_con(drizzle_result_st *result)
1115 {
1116+ if (result == NULL)
1117+ {
1118+ return NULL;
1119+ }
1120+
1121 return result->con;
1122 }
1123
1124 bool drizzle_result_eof(drizzle_result_st *result)
1125 {
1126+ if (result == NULL)
1127+ {
1128+ return false;
1129+ }
1130+
1131 return result->options & DRIZZLE_RESULT_EOF_PACKET;
1132 }
1133
1134 const char *drizzle_result_info(drizzle_result_st *result)
1135 {
1136+ if (result == NULL)
1137+ {
1138+ return NULL;
1139+ }
1140+
1141 return result->info;
1142 }
1143
1144 const char *drizzle_result_error(drizzle_result_st *result)
1145 {
1146+ if (result == NULL)
1147+ {
1148+ return NULL;
1149+ }
1150+
1151 return result->info;
1152 }
1153
1154 uint16_t drizzle_result_error_code(drizzle_result_st *result)
1155 {
1156+ if (result == NULL)
1157+ {
1158+ return 0;
1159+ }
1160+
1161 return result->error_code;
1162 }
1163
1164 const char *drizzle_result_sqlstate(drizzle_result_st *result)
1165 {
1166+ if (result == NULL)
1167+ {
1168+ return NULL;
1169+ }
1170+
1171 return result->sqlstate;
1172 }
1173
1174 uint16_t drizzle_result_warning_count(drizzle_result_st *result)
1175 {
1176+ if (result == NULL)
1177+ {
1178+ return 0;
1179+ }
1180+
1181 return result->warning_count;
1182 }
1183
1184 uint64_t drizzle_result_insert_id(drizzle_result_st *result)
1185 {
1186+ if (result == NULL)
1187+ {
1188+ return 0;
1189+ }
1190+
1191 return result->insert_id;
1192 }
1193
1194 uint64_t drizzle_result_affected_rows(drizzle_result_st *result)
1195 {
1196+ if (result == NULL)
1197+ {
1198+ return 0;
1199+ }
1200+
1201 return result->affected_rows;
1202 }
1203
1204 uint16_t drizzle_result_column_count(drizzle_result_st *result)
1205 {
1206+ if (result == NULL)
1207+ {
1208+ return 0;
1209+ }
1210+
1211 return result->column_count;
1212 }
1213
1214 uint64_t drizzle_result_row_count(drizzle_result_st *result)
1215 {
1216+ if (result == NULL)
1217+ {
1218+ return 0;
1219+ }
1220+
1221 return result->row_count;
1222 }
1223
1224@@ -201,6 +287,18 @@
1225 drizzle_result_st *result,
1226 drizzle_return_t *ret_ptr)
1227 {
1228+ drizzle_return_t unused;
1229+ if (ret_ptr == NULL)
1230+ {
1231+ ret_ptr= &unused;
1232+ }
1233+
1234+ if (con == NULL)
1235+ {
1236+ *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT;
1237+ return NULL;
1238+ }
1239+
1240 if (drizzle_state_none(con))
1241 {
1242 con->result= drizzle_result_create(con, result);
1243@@ -220,6 +318,11 @@
1244
1245 drizzle_return_t drizzle_result_buffer(drizzle_result_st *result)
1246 {
1247+ if (result == NULL)
1248+ {
1249+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
1250+ }
1251+
1252 drizzle_return_t ret;
1253 drizzle_row_t row;
1254 drizzle_row_t *row_list;
1255@@ -288,6 +391,11 @@
1256
1257 size_t drizzle_result_row_size(drizzle_result_st *result)
1258 {
1259+ if (result == NULL)
1260+ {
1261+ return 0;
1262+ }
1263+
1264 return result->con->packet_size;
1265 }
1266
1267@@ -298,6 +406,11 @@
1268 drizzle_return_t drizzle_result_write(drizzle_con_st *con,
1269 drizzle_result_st *result, bool flush)
1270 {
1271+ if (con == NULL)
1272+ {
1273+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
1274+ }
1275+
1276 if (drizzle_state_none(con))
1277 {
1278 con->result= result;
1279@@ -313,6 +426,11 @@
1280
1281 void drizzle_result_set_row_size(drizzle_result_st *result, size_t size)
1282 {
1283+ if (result == NULL)
1284+ {
1285+ return;
1286+ }
1287+
1288 result->con->packet_size= size;
1289 }
1290
1291@@ -322,6 +440,11 @@
1292 {
1293 uint16_t x;
1294
1295+ if (result == NULL)
1296+ {
1297+ return;
1298+ }
1299+
1300 result->con->packet_size= 0;
1301
1302 for (x= 0; x < result->column_count; x++)
1303@@ -341,6 +464,11 @@
1304
1305 void drizzle_result_set_eof(drizzle_result_st *result, bool is_eof)
1306 {
1307+ if (result == NULL)
1308+ {
1309+ return;
1310+ }
1311+
1312 if (is_eof)
1313 result->options|= DRIZZLE_RESULT_EOF_PACKET;
1314 else
1315@@ -349,8 +477,15 @@
1316
1317 void drizzle_result_set_info(drizzle_result_st *result, const char *info)
1318 {
1319+ if (result == NULL)
1320+ {
1321+ return;
1322+ }
1323+
1324 if (info == NULL)
1325+ {
1326 result->info[0]= 0;
1327+ }
1328 else
1329 {
1330 strncpy(result->info, info, DRIZZLE_MAX_INFO_SIZE);
1331@@ -360,20 +495,37 @@
1332
1333 void drizzle_result_set_error(drizzle_result_st *result, const char *error)
1334 {
1335+ if (result == NULL)
1336+ {
1337+ return;
1338+ }
1339+
1340 drizzle_result_set_info(result, error);
1341 }
1342
1343 void drizzle_result_set_error_code(drizzle_result_st *result,
1344 uint16_t error_code)
1345 {
1346+ if (result == NULL)
1347+ {
1348+ return;
1349+ }
1350+
1351 result->error_code= error_code;
1352 }
1353
1354 void drizzle_result_set_sqlstate(drizzle_result_st *result,
1355 const char *sqlstate)
1356 {
1357+ if (result == NULL)
1358+ {
1359+ return;
1360+ }
1361+
1362 if (sqlstate == NULL)
1363+ {
1364 result->sqlstate[0]= 0;
1365+ }
1366 else
1367 {
1368 strncpy(result->sqlstate, sqlstate, DRIZZLE_MAX_SQLSTATE_SIZE + 1);
1369@@ -384,24 +536,44 @@
1370 void drizzle_result_set_warning_count(drizzle_result_st *result,
1371 uint16_t warning_count)
1372 {
1373+ if (result == NULL)
1374+ {
1375+ return;
1376+ }
1377+
1378 result->warning_count= warning_count;
1379 }
1380
1381 void drizzle_result_set_insert_id(drizzle_result_st *result,
1382 uint64_t insert_id)
1383 {
1384+ if (result == NULL)
1385+ {
1386+ return;
1387+ }
1388+
1389 result->insert_id= insert_id;
1390 }
1391
1392 void drizzle_result_set_affected_rows(drizzle_result_st *result,
1393 uint64_t affected_rows)
1394 {
1395+ if (result == NULL)
1396+ {
1397+ return;
1398+ }
1399+
1400 result->affected_rows= affected_rows;
1401 }
1402
1403 void drizzle_result_set_column_count(drizzle_result_st *result,
1404 uint16_t column_count)
1405 {
1406+ if (result == NULL)
1407+ {
1408+ return;
1409+ }
1410+
1411 result->column_count= column_count;
1412 }
1413
1414@@ -413,6 +585,11 @@
1415 {
1416 drizzle_return_t ret;
1417
1418+ if (con == NULL)
1419+ {
1420+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
1421+ }
1422+
1423 drizzle_log_debug(con->drizzle, "drizzle_state_result_read");
1424
1425 /* Assume the entire result packet will fit in the buffer. */
1426@@ -493,6 +670,11 @@
1427
1428 drizzle_return_t drizzle_state_result_write(drizzle_con_st *con)
1429 {
1430+ if (con == NULL)
1431+ {
1432+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
1433+ }
1434+
1435 uint8_t *start= con->buffer_ptr + con->buffer_size;
1436 uint8_t *ptr;
1437 drizzle_result_st *result= con->result;
1438
1439=== modified file 'libdrizzle-1.0/result_client.h'
1440--- libdrizzle-1.0/result_client.h 2011-11-04 21:06:16 +0000
1441+++ libdrizzle-1.0/result_client.h 2011-11-08 00:09:24 +0000
1442@@ -34,14 +34,13 @@
1443 *
1444 */
1445
1446+#pragma once
1447+
1448 /**
1449 * @file
1450 * @brief Result Declarations for Clients
1451 */
1452
1453-#ifndef __DRIZZLE_RESULT_CLIENT_H
1454-#define __DRIZZLE_RESULT_CLIENT_H
1455-
1456 #ifdef __cplusplus
1457 extern "C" {
1458 #endif
1459@@ -79,5 +78,3 @@
1460 #ifdef __cplusplus
1461 }
1462 #endif
1463-
1464-#endif /* __DRIZZLE_RESULT_CLIENT_H */
1465
1466=== modified file 'libdrizzle-1.0/result_server.h'
1467--- libdrizzle-1.0/result_server.h 2011-11-04 21:06:16 +0000
1468+++ libdrizzle-1.0/result_server.h 2011-11-08 00:09:24 +0000
1469@@ -34,14 +34,13 @@
1470 *
1471 */
1472
1473+#pragma once
1474+
1475 /**
1476 * @file
1477 * @brief Result Declarations for Servers
1478 */
1479
1480-#ifndef __DRIZZLE_RESULT_SERVER_H
1481-#define __DRIZZLE_RESULT_SERVER_H
1482-
1483 #ifdef __cplusplus
1484 extern "C" {
1485 #endif
1486@@ -140,5 +139,3 @@
1487 #ifdef __cplusplus
1488 }
1489 #endif
1490-
1491-#endif /* __DRIZZLE_RESULT_SERVER_H */
1492
1493=== modified file 'libdrizzle-1.0/row.c'
1494--- libdrizzle-1.0/row.c 2011-11-04 21:06:16 +0000
1495+++ libdrizzle-1.0/row.c 2011-11-08 00:09:24 +0000
1496@@ -39,7 +39,7 @@
1497 * @brief Row definitions
1498 */
1499
1500-#include "common.h"
1501+#include <libdrizzle-1.0/common.h>
1502
1503 /*
1504 * Client definitions
1505
1506=== modified file 'libdrizzle-1.0/row_client.h'
1507--- libdrizzle-1.0/row_client.h 2011-11-04 21:06:16 +0000
1508+++ libdrizzle-1.0/row_client.h 2011-11-08 00:09:24 +0000
1509@@ -34,14 +34,13 @@
1510 *
1511 */
1512
1513+#pragma once
1514+
1515 /**
1516 * @file
1517 * @brief Row Declarations for Clients
1518 */
1519
1520-#ifndef __DRIZZLE_ROW_CLIENT_H
1521-#define __DRIZZLE_ROW_CLIENT_H
1522-
1523 #ifdef __cplusplus
1524 extern "C" {
1525 #endif
1526@@ -129,5 +128,3 @@
1527 #ifdef __cplusplus
1528 }
1529 #endif
1530-
1531-#endif /* __DRIZZLE_ROW_CLIENT_H */
1532
1533=== modified file 'libdrizzle-1.0/row_server.h'
1534--- libdrizzle-1.0/row_server.h 2011-11-04 21:06:16 +0000
1535+++ libdrizzle-1.0/row_server.h 2011-11-08 00:09:24 +0000
1536@@ -34,14 +34,13 @@
1537 *
1538 */
1539
1540+#pragma once
1541+
1542 /**
1543 * @file
1544 * @brief Row Declarations for Servers
1545 */
1546
1547-#ifndef __DRIZZLE_ROW_SERVER_H
1548-#define __DRIZZLE_ROW_SERVER_H
1549-
1550 #ifdef __cplusplus
1551 extern "C" {
1552 #endif
1553@@ -65,5 +64,3 @@
1554 #ifdef __cplusplus
1555 }
1556 #endif
1557-
1558-#endif /* __DRIZZLE_ROW_SERVER_H */
1559
1560=== modified file 'libdrizzle-1.0/sha1.c'
1561--- libdrizzle-1.0/sha1.c 2011-11-04 21:06:16 +0000
1562+++ libdrizzle-1.0/sha1.c 2011-11-08 00:09:24 +0000
1563@@ -21,7 +21,7 @@
1564 * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
1565 */
1566
1567-#include "common.h"
1568+#include <libdrizzle-1.0/common.h>
1569
1570 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
1571
1572
1573=== modified file 'libdrizzle-1.0/sha1.h'
1574--- libdrizzle-1.0/sha1.h 2011-11-04 21:06:16 +0000
1575+++ libdrizzle-1.0/sha1.h 2011-11-08 00:09:24 +0000
1576@@ -1,11 +1,10 @@
1577+#pragma once
1578+
1579 /**
1580 * @file
1581 * @brief SHA1 Declarations
1582 */
1583
1584-#ifndef _SHA1_H
1585-#define _SHA1_H
1586-
1587 #ifdef __cplusplus
1588 extern "C" {
1589 #endif
1590@@ -43,5 +42,3 @@
1591 #ifdef __cplusplus
1592 }
1593 #endif
1594-
1595-#endif /* _SHA1_H */
1596
1597=== modified file 'libdrizzle-1.0/state.c'
1598--- libdrizzle-1.0/state.c 2011-11-04 21:06:16 +0000
1599+++ libdrizzle-1.0/state.c 2011-11-08 00:09:24 +0000
1600@@ -39,15 +39,13 @@
1601 * @brief State machine definitions
1602 */
1603
1604-#include "common.h"
1605+#include <libdrizzle-1.0/common.h>
1606
1607 drizzle_return_t drizzle_state_loop(drizzle_con_st *con)
1608 {
1609- drizzle_return_t ret;
1610-
1611- while (!drizzle_state_none(con))
1612+ while (drizzle_state_none(con) == false)
1613 {
1614- ret= con->state_stack[con->state_current - 1](con);
1615+ drizzle_return_t ret= con->state_stack[con->state_current - 1](con);
1616 if (ret != DRIZZLE_RETURN_OK)
1617 {
1618 if (ret != DRIZZLE_RETURN_IO_WAIT && ret != DRIZZLE_RETURN_PAUSE &&
1619
1620=== modified file 'libdrizzle-1.0/state.h'
1621--- libdrizzle-1.0/state.h 2011-11-04 21:06:16 +0000
1622+++ libdrizzle-1.0/state.h 2011-11-08 00:09:24 +0000
1623@@ -34,14 +34,13 @@
1624 *
1625 */
1626
1627+#pragma once
1628+
1629 /**
1630 * @file
1631 * @brief State Machine Declarations
1632 */
1633
1634-#ifndef __DRIZZLE_STATE_H
1635-#define __DRIZZLE_STATE_H
1636-
1637 #ifdef __cplusplus
1638 extern "C" {
1639 #endif
1640@@ -107,5 +106,3 @@
1641 #ifdef __cplusplus
1642 }
1643 #endif
1644-
1645-#endif /* __DRIZZLE_STATE_H */
1646
1647=== modified file 'libdrizzle-2.0/column.h'
1648--- libdrizzle-2.0/column.h 2011-11-04 21:06:16 +0000
1649+++ libdrizzle-2.0/column.h 2011-11-08 00:09:24 +0000
1650@@ -34,6 +34,7 @@
1651 *
1652 */
1653
1654+#pragma once
1655
1656 /**
1657 * @file
1658
1659=== modified file 'libdrizzle-2.0/column_client.h'
1660--- libdrizzle-2.0/column_client.h 2011-11-04 21:06:16 +0000
1661+++ libdrizzle-2.0/column_client.h 2011-11-08 00:09:24 +0000
1662@@ -40,8 +40,7 @@
1663 * @brief Column Declarations for Clients
1664 */
1665
1666-#ifndef __DRIZZLE_COLUMN_CLIENT_H
1667-#define __DRIZZLE_COLUMN_CLIENT_H
1668+#pragma once
1669
1670 #ifdef __cplusplus
1671 extern "C" {
1672@@ -124,5 +123,3 @@
1673 #ifdef __cplusplus
1674 }
1675 #endif
1676-
1677-#endif /* __DRIZZLE_COLUMN_CLIENT_H */
1678
1679=== modified file 'libdrizzle-2.0/column_server.h'
1680--- libdrizzle-2.0/column_server.h 2011-11-04 21:06:16 +0000
1681+++ libdrizzle-2.0/column_server.h 2011-11-08 00:09:24 +0000
1682@@ -34,14 +34,13 @@
1683 *
1684 */
1685
1686+#pragma once
1687+
1688 /**
1689 * @file
1690 * @brief Column Declarations for Servers
1691 */
1692
1693-#ifndef __DRIZZLE_COLUMN_SERVER_H
1694-#define __DRIZZLE_COLUMN_SERVER_H
1695-
1696 #ifdef __cplusplus
1697 extern "C" {
1698 #endif
1699@@ -145,5 +144,3 @@
1700 #ifdef __cplusplus
1701 }
1702 #endif
1703-
1704-#endif /* __DRIZZLE_COLUMN_SERVER_H */
1705
1706=== modified file 'libdrizzle-2.0/command_client.h'
1707--- libdrizzle-2.0/command_client.h 2011-11-04 21:06:16 +0000
1708+++ libdrizzle-2.0/command_client.h 2011-11-08 00:09:24 +0000
1709@@ -34,14 +34,13 @@
1710 *
1711 */
1712
1713+#pragma once
1714+
1715 /**
1716 * @file
1717 * @brief Command Declarations for Clients
1718 */
1719
1720-#ifndef __DRIZZLE_COMMAND_CLIENT_H
1721-#define __DRIZZLE_COMMAND_CLIENT_H
1722-
1723 #ifdef __cplusplus
1724 extern "C" {
1725 #endif
1726@@ -60,5 +59,3 @@
1727 #ifdef __cplusplus
1728 }
1729 #endif
1730-
1731-#endif /* __DRIZZLE_COMMAND_CLIENT_H */
1732
1733=== modified file 'libdrizzle-2.0/command_server.h'
1734--- libdrizzle-2.0/command_server.h 2011-11-04 21:06:16 +0000
1735+++ libdrizzle-2.0/command_server.h 2011-11-08 00:09:24 +0000
1736@@ -34,15 +34,13 @@
1737 *
1738 */
1739
1740+#pragma once
1741
1742 /**
1743 * @file
1744 * @brief Command Declarations for Servers
1745 */
1746
1747-#ifndef __DRIZZLE_COMMAND_SERVER_H
1748-#define __DRIZZLE_COMMAND_SERVER_H
1749-
1750 #ifdef __cplusplus
1751 extern "C" {
1752 #endif
1753@@ -60,5 +58,3 @@
1754 #ifdef __cplusplus
1755 }
1756 #endif
1757-
1758-#endif /* __DRIZZLE_COMMAND_SERVER_H */
1759
1760=== modified file 'libdrizzle-2.0/conn.cc'
1761--- libdrizzle-2.0/conn.cc 2011-11-04 21:06:16 +0000
1762+++ libdrizzle-2.0/conn.cc 2011-11-08 00:09:24 +0000
1763@@ -478,6 +478,12 @@
1764 {
1765 drizzle_result_st *old_result;
1766
1767+ drizzle_return_t unused;
1768+ if (ret_ptr == NULL)
1769+ {
1770+ ret_ptr= &unused;
1771+ }
1772+
1773 if (!(con->options & DRIZZLE_CON_READY))
1774 {
1775 if (con->options & DRIZZLE_CON_RAW_PACKET)
1776@@ -490,13 +496,17 @@
1777
1778 *ret_ptr= drizzle_con_connect(con);
1779 if (*ret_ptr != DRIZZLE_RETURN_OK)
1780+ {
1781 return result;
1782+ }
1783 }
1784
1785 if (drizzle_state_none(con))
1786 {
1787 if (con->options & (DRIZZLE_CON_RAW_PACKET | DRIZZLE_CON_NO_RESULT_READ))
1788+ {
1789 con->result= NULL;
1790+ }
1791 else
1792 {
1793 for (old_result= con->result_list; old_result != NULL; old_result= old_result->next)
1794
1795=== modified file 'libdrizzle-2.0/conn.h'
1796--- libdrizzle-2.0/conn.h 2011-11-04 21:06:16 +0000
1797+++ libdrizzle-2.0/conn.h 2011-11-08 00:09:24 +0000
1798@@ -34,14 +34,13 @@
1799 *
1800 */
1801
1802+#pragma once
1803+
1804 /**
1805 * @file
1806 * @brief Connection Declarations
1807 */
1808
1809-#ifndef __DRIZZLE_CONN_H
1810-#define __DRIZZLE_CONN_H
1811-
1812 #ifdef __cplusplus
1813 extern "C" {
1814 #endif
1815@@ -429,5 +428,3 @@
1816 #ifdef __cplusplus
1817 }
1818 #endif
1819-
1820-#endif /* __DRIZZLE_CONN_H */
1821
1822=== modified file 'libdrizzle-2.0/conn_client.h'
1823--- libdrizzle-2.0/conn_client.h 2011-11-04 21:06:16 +0000
1824+++ libdrizzle-2.0/conn_client.h 2011-11-08 00:09:24 +0000
1825@@ -34,14 +34,13 @@
1826 *
1827 */
1828
1829+#pragma once
1830+
1831 /**
1832 * @file
1833 * @brief Connection Declarations for Clients
1834 */
1835
1836-#ifndef __DRIZZLE_CON_CLIENT_H
1837-#define __DRIZZLE_CON_CLIENT_H
1838-
1839 #ifdef __cplusplus
1840 extern "C" {
1841 #endif
1842@@ -191,5 +190,3 @@
1843 #ifdef __cplusplus
1844 }
1845 #endif
1846-
1847-#endif /* __DRIZZLE_CON_CLIENT_H */
1848
1849=== modified file 'libdrizzle-2.0/conn_local.h'
1850--- libdrizzle-2.0/conn_local.h 2011-11-04 21:06:16 +0000
1851+++ libdrizzle-2.0/conn_local.h 2011-11-08 00:09:24 +0000
1852@@ -34,14 +34,13 @@
1853 *
1854 */
1855
1856+#pragma once
1857+
1858 /**
1859 * @file
1860 * @brief Local Connection Declarations
1861 */
1862
1863-#ifndef __DRIZZLE_CONN_LOCAL_H
1864-#define __DRIZZLE_CONN_LOCAL_H
1865-
1866 #ifdef __cplusplus
1867 extern "C" {
1868 #endif
1869@@ -117,5 +116,3 @@
1870 #ifdef __cplusplus
1871 }
1872 #endif
1873-
1874-#endif /* __DRIZZLE_CONN_LOCAL_H */
1875
1876=== modified file 'libdrizzle-2.0/conn_server.h'
1877--- libdrizzle-2.0/conn_server.h 2011-11-04 21:06:16 +0000
1878+++ libdrizzle-2.0/conn_server.h 2011-11-08 00:09:24 +0000
1879@@ -34,14 +34,13 @@
1880 *
1881 */
1882
1883+#pragma once
1884+
1885 /**
1886 * @file
1887 * @brief Connection Declarations for Servers
1888 */
1889
1890-#ifndef __DRIZZLE_CON_SERVER_H
1891-#define __DRIZZLE_CON_SERVER_H
1892-
1893 #ifdef __cplusplus
1894 extern "C" {
1895 #endif
1896@@ -223,5 +222,3 @@
1897 #ifdef __cplusplus
1898 }
1899 #endif
1900-
1901-#endif /* __DRIZZLE_CON_SERVER_H */
1902
1903=== modified file 'libdrizzle-2.0/constants.h'
1904--- libdrizzle-2.0/constants.h 2011-11-04 21:06:16 +0000
1905+++ libdrizzle-2.0/constants.h 2011-11-08 00:09:24 +0000
1906@@ -1,6 +1,7 @@
1907 /*
1908 * Drizzle Client & Protocol Library
1909 *
1910+ * Copyright (C) 2011 Brian Aker (brian@tangent.org)
1911 * Copyright (C) 2008 Eric Day (eday@oddments.org)
1912 * All rights reserved.
1913 *
1914@@ -34,14 +35,13 @@
1915 *
1916 */
1917
1918+#pragma once
1919+
1920 /**
1921 * @file
1922 * @brief Defines, typedefs, enums, and macros
1923 */
1924
1925-#ifndef __DRIZZLE_CONSTANTS_H
1926-#define __DRIZZLE_CONSTANTS_H
1927-
1928 #include <stdint.h>
1929
1930 #ifdef __cplusplus
1931@@ -92,7 +92,7 @@
1932 /**
1933 * Return codes.
1934 */
1935-typedef enum
1936+enum drizzle_return_t
1937 {
1938 DRIZZLE_RETURN_OK,
1939 DRIZZLE_RETURN_IO_WAIT,
1940@@ -119,13 +119,18 @@
1941 DRIZZLE_RETURN_NO_ACTIVE_CONNECTIONS,
1942 DRIZZLE_RETURN_HANDSHAKE_FAILED,
1943 DRIZZLE_RETURN_TIMEOUT,
1944+ DRIZZLE_RETURN_INVALID_ARGUMENT,
1945 DRIZZLE_RETURN_MAX /* Always add new codes to the end before this one. */
1946-} drizzle_return_t;
1947+};
1948+
1949+#ifndef __cplusplus
1950+typedef enum drizzle_return_t drizzle_return_t
1951+#endif
1952
1953 /**
1954 * Verbosity levels.
1955 */
1956-typedef enum
1957+enum drizzle_verbose_t
1958 {
1959 DRIZZLE_VERBOSE_NEVER,
1960 DRIZZLE_VERBOSE_FATAL,
1961@@ -134,7 +139,11 @@
1962 DRIZZLE_VERBOSE_DEBUG,
1963 DRIZZLE_VERBOSE_CRAZY,
1964 DRIZZLE_VERBOSE_MAX
1965-} drizzle_verbose_t;
1966+};
1967+
1968+#ifndef __cplusplus
1969+typedef enum drizzle_verbose_t drizzle_verbose_t;
1970+#endif
1971
1972 /** @} */
1973
1974@@ -142,20 +151,24 @@
1975 * @ingroup drizzle
1976 * Options for drizzle_st.
1977 */
1978-typedef enum
1979+enum drizzle_options_t
1980 {
1981 DRIZZLE_NONE= 0,
1982 DRIZZLE_ALLOCATED= (1 << 0),
1983 DRIZZLE_NON_BLOCKING= (1 << 1),
1984 DRIZZLE_FREE_OBJECTS= (1 << 2),
1985 DRIZZLE_ASSERT_DANGLING= (1 << 3)
1986-} drizzle_options_t;
1987+};
1988+
1989+#ifndef __cplusplus
1990+typedef enum drizzle_options_t drizzle_options_t;
1991+#endif
1992
1993 /**
1994 * @ingroup drizzle_con
1995 * Options for drizzle_con_st.
1996 */
1997-typedef enum
1998+enum drizzle_con_options_t
1999 {
2000 DRIZZLE_CON_NONE= 0,
2001 DRIZZLE_CON_ALLOCATED= (1 << 0),
2002@@ -171,23 +184,31 @@
2003 DRIZZLE_CON_INTERACTIVE= (1 << 11),
2004 DRIZZLE_CON_MULTI_STATEMENTS= (1 << 12),
2005 DRIZZLE_CON_AUTH_PLUGIN= (1 << 13)
2006-} drizzle_con_options_t;
2007+};
2008+
2009+#ifndef __cplusplus
2010+typedef enum drizzle_con_options_t drizzle_con_options_t;
2011+#endif
2012
2013 /**
2014 * @ingroup drizzle_con
2015 * Socket types for drizzle_con_st.
2016 */
2017-typedef enum
2018+enum drizzle_con_socket_t
2019 {
2020 DRIZZLE_CON_SOCKET_TCP= 0,
2021 DRIZZLE_CON_SOCKET_UDS= (1 << 0)
2022-} drizzle_con_socket_t;
2023+};
2024+
2025+#ifndef __cplusplus
2026+typedef enum drizzle_con_socket_t drizzle_con_socket_t;
2027+#endif
2028
2029 /**
2030 * @ingroup drizzle_con
2031 * Status flags for drizle_con_st.
2032 */
2033-typedef enum
2034+enum drizzle_con_status_t
2035 {
2036 DRIZZLE_CON_STATUS_NONE= 0,
2037 DRIZZLE_CON_STATUS_IN_TRANS= (1 << 0),
2038@@ -200,13 +221,17 @@
2039 DRIZZLE_CON_STATUS_DB_DROPPED= (1 << 8),
2040 DRIZZLE_CON_STATUS_NO_BACKSLASH_ESCAPES= (1 << 9),
2041 DRIZZLE_CON_STATUS_QUERY_WAS_SLOW= (1 << 10)
2042-} drizzle_con_status_t;
2043+};
2044+
2045+#ifndef __cplusplus
2046+typedef enum drizzle_con_status_t drizzle_con_status_t;
2047+#endif
2048
2049 /**
2050 * @ingroup drizzle_con
2051 * Capabilities for drizzle_con_st.
2052 */
2053-typedef enum
2054+enum drizzle_capabilities_t
2055 {
2056 DRIZZLE_CAPABILITIES_NONE= 0,
2057 DRIZZLE_CAPABILITIES_LONG_PASSWORD= (1 << 0),
2058@@ -239,13 +264,17 @@
2059 DRIZZLE_CAPABILITIES_TRANSACTIONS |
2060 DRIZZLE_CAPABILITIES_PROTOCOL_41 |
2061 DRIZZLE_CAPABILITIES_SECURE_CONNECTION)
2062-} drizzle_capabilities_t;
2063+};
2064+
2065+#ifndef __cplusplus
2066+typedef enum drizzle_capabilities_t drizzle_capabilities_t;
2067+#endif
2068
2069 /**
2070 * @ingroup drizzle_command
2071 * Commands for drizzle_command functions.
2072 */
2073-typedef enum
2074+enum drizzle_command_t
2075 {
2076 DRIZZLE_COMMAND_SLEEP, /* Not used currently. */
2077 DRIZZLE_COMMAND_QUIT,
2078@@ -278,13 +307,17 @@
2079 DRIZZLE_COMMAND_STMT_FETCH, /* Not used currently. */
2080 DRIZZLE_COMMAND_DAEMON, /* Not used currently. */
2081 DRIZZLE_COMMAND_END /* Not used currently. */
2082-} drizzle_command_t;
2083+};
2084+
2085+#ifndef __cplusplus
2086+typedef enum drizzle_command_t drizzle_command_t;
2087+#endif
2088
2089 /**
2090 * @ingroup drizzle_command
2091 * Commands for the Drizzle protocol functions.
2092 */
2093-typedef enum
2094+enum drizzle_command_drizzle_t
2095 {
2096 DRIZZLE_COMMAND_DRIZZLE_SLEEP,
2097 DRIZZLE_COMMAND_DRIZZLE_QUIT,
2098@@ -295,35 +328,47 @@
2099 DRIZZLE_COMMAND_DRIZZLE_PING,
2100 DRIZZLE_COMMAND_DRIZZLE_KILL,
2101 DRIZZLE_COMMAND_DRIZZLE_END
2102-} drizzle_command_drizzle_t;
2103+};
2104+
2105+#ifndef __cplusplus
2106+typedef enum drizzle_command_drizzle_t drizzle_command_drizzle_t;
2107+#endif
2108
2109 /**
2110 * @ingroup drizzle_query
2111 * Options for drizzle_query_st.
2112 */
2113-typedef enum
2114+enum drizzle_query_options_t
2115 {
2116 DRIZZLE_QUERY_NONE,
2117 DRIZZLE_QUERY_ALLOCATED= (1 << 0)
2118-} drizzle_query_options_t;
2119+};
2120+
2121+#ifndef __cplusplus
2122+typedef enum drizzle_query_options_t drizzle_query_options_t;
2123+#endif
2124
2125 /**
2126 * @ingroup drizzle_query
2127 * States for drizle_query_st.
2128 */
2129-typedef enum
2130+enum drizzle_query_state_t
2131 {
2132 DRIZZLE_QUERY_STATE_INIT,
2133 DRIZZLE_QUERY_STATE_QUERY,
2134 DRIZZLE_QUERY_STATE_RESULT,
2135 DRIZZLE_QUERY_STATE_DONE
2136-} drizzle_query_state_t;
2137+};
2138+
2139+#ifndef __cplusplus
2140+enum drizzle_query_state_t drizzle_query_state_t;
2141+#endif
2142
2143 /**
2144 * @ingroup drizzle_result
2145 * Options for drizzle_result_st.
2146 */
2147-typedef enum
2148+enum drizzle_result_options_t
2149 {
2150 DRIZZLE_RESULT_NONE= 0,
2151 DRIZZLE_RESULT_ALLOCATED= (1 << 0),
2152@@ -332,22 +377,30 @@
2153 DRIZZLE_RESULT_BUFFER_ROW= (1 << 3),
2154 DRIZZLE_RESULT_EOF_PACKET= (1 << 4),
2155 DRIZZLE_RESULT_ROW_BREAK= (1 << 5)
2156-} drizzle_result_options_t;
2157+};
2158+
2159+#ifndef __cplusplus
2160+typedef enum drizzle_result_options_t drizzle_result_options_t;
2161+#endif
2162
2163 /**
2164 * @ingroup drizzle_column
2165 * Options for drizzle_column_st.
2166 */
2167-typedef enum
2168+enum drizzle_column_options_t
2169 {
2170 DRIZZLE_COLUMN_ALLOCATED= (1 << 0)
2171-} drizzle_column_options_t;
2172+};
2173+
2174+#ifndef __cplusplus
2175+typedef enum drizzle_column_options_t drizzle_column_options_t;
2176+#endif
2177
2178 /**
2179 * @ingroup drizzle_column
2180 * Types for drizzle_column_st.
2181 */
2182-typedef enum
2183+enum drizzle_column_type_t
2184 {
2185 DRIZZLE_COLUMN_TYPE_DECIMAL,
2186 DRIZZLE_COLUMN_TYPE_TINY,
2187@@ -376,13 +429,17 @@
2188 DRIZZLE_COLUMN_TYPE_VAR_STRING= 253,
2189 DRIZZLE_COLUMN_TYPE_STRING= 254,
2190 DRIZZLE_COLUMN_TYPE_GEOMETRY= 255
2191-} drizzle_column_type_t;
2192+};
2193+
2194+#ifndef __cplusplus
2195+typedef enum drizzle_column_type_t drizzle_column_type_t;
2196+#endif
2197
2198 /**
2199 * @ingroup drizzle_column
2200 * Types for drizzle_column_st for Drizzle.
2201 */
2202-typedef enum
2203+enum drizzle_column_type_drizzle_t
2204 {
2205 DRIZZLE_COLUMN_TYPE_DRIZZLE_TINY,
2206 DRIZZLE_COLUMN_TYPE_DRIZZLE_LONG,
2207@@ -401,13 +458,17 @@
2208 DRIZZLE_COLUMN_TYPE_DRIZZLE_UUID,
2209 DRIZZLE_COLUMN_TYPE_DRIZZLE_MICROTIME,
2210 DRIZZLE_COLUMN_TYPE_DRIZZLE_MAX=DRIZZLE_COLUMN_TYPE_DRIZZLE_MICROTIME
2211-} drizzle_column_type_drizzle_t;
2212+};
2213+
2214+#ifndef __cplusplus
2215+typedef enum drizzle_column_type_drizzle_t drizzle_column_type_drizzle_t;
2216+#endif
2217
2218 /**
2219 * @ingroup drizzle_column
2220 * Flags for drizzle_column_st.
2221 */
2222-typedef enum
2223+enum drizzle_column_flags_t
2224 {
2225 DRIZZLE_COLUMN_FLAGS_NONE= 0,
2226 DRIZZLE_COLUMN_FLAGS_NOT_NULL= (1 << 0),
2227@@ -433,7 +494,11 @@
2228 DRIZZLE_COLUMN_FLAGS_IN_PART_FUNC= (1 << 19),
2229 DRIZZLE_COLUMN_FLAGS_IN_ADD_INDEX= (1 << 20),
2230 DRIZZLE_COLUMN_FLAGS_RENAMED= (1 << 21)
2231-} drizzle_column_flags_t;
2232+};
2233+
2234+#ifndef __cplusplus
2235+typedef enum drizzle_column_flags_t drizzle_column_flags_t;
2236+#endif
2237
2238 /**
2239 * @addtogroup drizzle_types Types
2240@@ -570,5 +635,3 @@
2241 #ifdef __cplusplus
2242 }
2243 #endif
2244-
2245-#endif /* __DRIZZLE_CONSTANTS_H */
2246
2247=== modified file 'libdrizzle-2.0/drizzle.h'
2248--- libdrizzle-2.0/drizzle.h 2011-11-04 21:06:16 +0000
2249+++ libdrizzle-2.0/drizzle.h 2011-11-08 00:09:24 +0000
2250@@ -34,15 +34,13 @@
2251 *
2252 */
2253
2254+#pragma once
2255+
2256 /**
2257 * @file
2258 * @brief Drizzle Declarations
2259 */
2260
2261-#ifndef __DRIZZLE_H
2262-#define __DRIZZLE_H
2263-
2264-
2265 #include <inttypes.h>
2266 #include <sys/types.h>
2267
2268@@ -435,5 +433,3 @@
2269 #ifdef __cplusplus
2270 }
2271 #endif
2272-
2273-#endif /* __DRIZZLE_H */
2274
2275=== modified file 'libdrizzle-2.0/drizzle_client.h'
2276--- libdrizzle-2.0/drizzle_client.h 2011-11-04 21:06:16 +0000
2277+++ libdrizzle-2.0/drizzle_client.h 2011-11-08 00:09:24 +0000
2278@@ -34,15 +34,13 @@
2279 *
2280 */
2281
2282+#pragma once
2283
2284 /**
2285 * @file
2286 * @brief Drizzle Declarations for Clients
2287 */
2288
2289-#ifndef __DRIZZLE_CLIENT_H
2290-#define __DRIZZLE_CLIENT_H
2291-
2292 #include <libdrizzle-2.0/drizzle.h>
2293 #include <libdrizzle-2.0/conn_client.h>
2294 #include <libdrizzle-2.0/handshake_client.h>
2295@@ -113,5 +111,3 @@
2296 #ifdef __cplusplus
2297 }
2298 #endif
2299-
2300-#endif /* __DRIZZLE_CLIENT_H */
2301
2302=== modified file 'libdrizzle-2.0/drizzle_local.h'
2303--- libdrizzle-2.0/drizzle_local.h 2011-11-04 21:06:16 +0000
2304+++ libdrizzle-2.0/drizzle_local.h 2011-11-08 00:09:24 +0000
2305@@ -34,14 +34,13 @@
2306 *
2307 */
2308
2309+#pragma once
2310+
2311 /**
2312 * @file
2313 * @brief Local Drizzle Declarations
2314 */
2315
2316-#ifndef __DRIZZLE_LOCAL_H
2317-#define __DRIZZLE_LOCAL_H
2318-
2319 #ifdef __cplusplus
2320 extern "C" {
2321 #endif
2322@@ -162,5 +161,3 @@
2323 #ifdef __cplusplus
2324 }
2325 #endif
2326-
2327-#endif /* __DRIZZLE_LOCAL_H */
2328
2329=== modified file 'libdrizzle-2.0/drizzle_server.h'
2330--- libdrizzle-2.0/drizzle_server.h 2011-11-04 21:06:16 +0000
2331+++ libdrizzle-2.0/drizzle_server.h 2011-11-08 00:09:24 +0000
2332@@ -34,14 +34,13 @@
2333 *
2334 */
2335
2336+#pragma once
2337+
2338 /**
2339 * @file
2340 * @brief Drizzle Declarations for Servers
2341 */
2342
2343-#ifndef __DRIZZLE_SERVER_H
2344-#define __DRIZZLE_SERVER_H
2345-
2346 #include <libdrizzle-2.0/drizzle.h>
2347 #include <libdrizzle-2.0/conn_server.h>
2348 #include <libdrizzle-2.0/handshake_server.h>
2349@@ -130,5 +129,3 @@
2350 #ifdef __cplusplus
2351 }
2352 #endif
2353-
2354-#endif /* __DRIZZLE_SERVER_H */
2355
2356=== modified file 'libdrizzle-2.0/field_client.h'
2357--- libdrizzle-2.0/field_client.h 2011-11-04 21:06:16 +0000
2358+++ libdrizzle-2.0/field_client.h 2011-11-08 00:09:24 +0000
2359@@ -34,14 +34,13 @@
2360 *
2361 */
2362
2363+#pragma once
2364+
2365 /**
2366 * @file
2367 * @brief Field Declarations for Clients
2368 */
2369
2370-#ifndef __DRIZZLE_FIELD_CLIENT_H
2371-#define __DRIZZLE_FIELD_CLIENT_H
2372-
2373 #ifdef __cplusplus
2374 extern "C" {
2375 #endif
2376@@ -84,5 +83,3 @@
2377 #ifdef __cplusplus
2378 }
2379 #endif
2380-
2381-#endif /* __DRIZZLE_FIELD_CLIENT_H */
2382
2383=== modified file 'libdrizzle-2.0/field_server.h'
2384--- libdrizzle-2.0/field_server.h 2011-11-04 21:06:16 +0000
2385+++ libdrizzle-2.0/field_server.h 2011-11-08 00:09:24 +0000
2386@@ -34,14 +34,13 @@
2387 *
2388 */
2389
2390+#pragma once
2391+
2392 /**
2393 * @file
2394 * @brief Field Declarations for Servers
2395 */
2396
2397-#ifndef __DRIZZLE_FIELD_SERVER_H
2398-#define __DRIZZLE_FIELD_SERVER_H
2399-
2400 #ifdef __cplusplus
2401 extern "C" {
2402 #endif
2403@@ -64,5 +63,3 @@
2404 #ifdef __cplusplus
2405 }
2406 #endif
2407-
2408-#endif /* __DRIZZLE_FIELD_SERVER_H */
2409
2410=== modified file 'libdrizzle-2.0/handshake_client.h'
2411--- libdrizzle-2.0/handshake_client.h 2011-11-04 21:06:16 +0000
2412+++ libdrizzle-2.0/handshake_client.h 2011-11-08 00:09:24 +0000
2413@@ -34,14 +34,13 @@
2414 *
2415 */
2416
2417+#pragma once
2418+
2419 /**
2420 * @file
2421 * @brief Handshake Declarations for Clients
2422 */
2423
2424-#ifndef __DRIZZLE_HANDSHAKE_CLIENT_H
2425-#define __DRIZZLE_HANDSHAKE_CLIENT_H
2426-
2427 #ifdef __cplusplus
2428 extern "C" {
2429 #endif
2430@@ -81,5 +80,3 @@
2431 #ifdef __cplusplus
2432 }
2433 #endif
2434-
2435-#endif /* __DRIZZLE_HANDSHAKE_CLIENT_H */
2436
2437=== modified file 'libdrizzle-2.0/handshake_server.h'
2438--- libdrizzle-2.0/handshake_server.h 2011-11-04 21:06:16 +0000
2439+++ libdrizzle-2.0/handshake_server.h 2011-11-08 00:09:24 +0000
2440@@ -34,14 +34,13 @@
2441 *
2442 */
2443
2444+#pragma once
2445+
2446 /**
2447 * @file
2448 * @brief Handshake Declarations for Servers
2449 */
2450
2451-#ifndef __DRIZZLE_HANDSHAKE_SERVER_H
2452-#define __DRIZZLE_HANDSHAKE_SERVER_H
2453-
2454 #ifdef __cplusplus
2455 extern "C" {
2456 #endif
2457@@ -79,5 +78,3 @@
2458 #ifdef __cplusplus
2459 }
2460 #endif
2461-
2462-#endif /* __DRIZZLE_HANDSHAKE_SERVER_H */
2463
2464=== modified file 'libdrizzle-2.0/include.am'
2465--- libdrizzle-2.0/include.am 2011-11-04 21:06:16 +0000
2466+++ libdrizzle-2.0/include.am 2011-11-08 00:09:24 +0000
2467@@ -135,33 +135,33 @@
2468 examples_sqlite_server_SOURCES= examples/sqlite_server.cc
2469 endif
2470
2471-dist_libdrizzleinstall_HEADERS= \
2472- libdrizzle-2.0/column.h \
2473- libdrizzle-2.0/column_client.h \
2474- libdrizzle-2.0/column_server.h \
2475- libdrizzle-2.0/command_client.h \
2476- libdrizzle-2.0/command_server.h \
2477- libdrizzle-2.0/conn.h \
2478- libdrizzle-2.0/conn_client.h \
2479- libdrizzle-2.0/conn_server.h \
2480- libdrizzle-2.0/constants.h \
2481- libdrizzle-2.0/drizzle.h \
2482- libdrizzle-2.0/drizzle_client.h \
2483- libdrizzle-2.0/drizzle_server.h \
2484- libdrizzle-2.0/field_client.h \
2485- libdrizzle-2.0/field_server.h \
2486- libdrizzle-2.0/handshake_client.h \
2487- libdrizzle-2.0/handshake_server.h \
2488- libdrizzle-2.0/libdrizzle.h \
2489- libdrizzle-2.0/libdrizzle.hpp \
2490- libdrizzle-2.0/query.h \
2491- libdrizzle-2.0/result.h \
2492- libdrizzle-2.0/result_client.h \
2493- libdrizzle-2.0/result_server.h \
2494- libdrizzle-2.0/row_client.h \
2495- libdrizzle-2.0/row_server.h \
2496- libdrizzle-2.0/structs.h \
2497- libdrizzle-2.0/visibility.h
2498+nobase_include_HEADERS+= \
2499+ libdrizzle-2.0/column.h \
2500+ libdrizzle-2.0/column_client.h \
2501+ libdrizzle-2.0/column_server.h \
2502+ libdrizzle-2.0/command_client.h \
2503+ libdrizzle-2.0/command_server.h \
2504+ libdrizzle-2.0/conn.h \
2505+ libdrizzle-2.0/conn_client.h \
2506+ libdrizzle-2.0/conn_server.h \
2507+ libdrizzle-2.0/constants.h \
2508+ libdrizzle-2.0/drizzle.h \
2509+ libdrizzle-2.0/drizzle_client.h \
2510+ libdrizzle-2.0/drizzle_server.h \
2511+ libdrizzle-2.0/field_client.h \
2512+ libdrizzle-2.0/field_server.h \
2513+ libdrizzle-2.0/handshake_client.h \
2514+ libdrizzle-2.0/handshake_server.h \
2515+ libdrizzle-2.0/libdrizzle.h \
2516+ libdrizzle-2.0/libdrizzle.hpp \
2517+ libdrizzle-2.0/query.h \
2518+ libdrizzle-2.0/result.h \
2519+ libdrizzle-2.0/result_client.h \
2520+ libdrizzle-2.0/result_server.h \
2521+ libdrizzle-2.0/row_client.h \
2522+ libdrizzle-2.0/row_server.h \
2523+ libdrizzle-2.0/structs.h \
2524+ libdrizzle-2.0/visibility.h
2525
2526 noinst_HEADERS+= \
2527 libdrizzle-2.0/common.h \
2528@@ -170,9 +170,3 @@
2529 libdrizzle-2.0/pack.h \
2530 libdrizzle-2.0/state.h \
2531 libdrizzle-2.0/sha1.h
2532-
2533-
2534-libdrizzle: libdrizzle-2.0/libdrizzle-2.0.la
2535-install-libdrizzle: libdrizzle install-dist_libdrizzleinstallHEADERS
2536- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
2537- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) libdrizzle-2.0/libdrizzle-2.0.la "$(DESTDIR)$(libdir)"
2538
2539=== modified file 'libdrizzle-2.0/pack.h'
2540--- libdrizzle-2.0/pack.h 2011-11-04 21:06:16 +0000
2541+++ libdrizzle-2.0/pack.h 2011-11-08 00:09:24 +0000
2542@@ -34,14 +34,13 @@
2543 *
2544 */
2545
2546+#pragma once
2547+
2548 /**
2549 * @file
2550 * @brief Packing Declarations
2551 */
2552
2553-#ifndef __DRIZZLE_PACK_H
2554-#define __DRIZZLE_PACK_H
2555-
2556 #ifdef __cplusplus
2557 extern "C" {
2558 #endif
2559@@ -92,5 +91,3 @@
2560 #ifdef __cplusplus
2561 }
2562 #endif
2563-
2564-#endif /* __DRIZZLE_PACK_H */
2565
2566=== modified file 'libdrizzle-2.0/query.h'
2567--- libdrizzle-2.0/query.h 2011-11-04 21:06:16 +0000
2568+++ libdrizzle-2.0/query.h 2011-11-08 00:09:24 +0000
2569@@ -34,14 +34,13 @@
2570 *
2571 */
2572
2573+#pragma once
2574+
2575 /**
2576 * @file
2577 * @brief Query Declarations
2578 */
2579
2580-#ifndef __DRIZZLE_QUERY_H
2581-#define __DRIZZLE_QUERY_H
2582-
2583 #ifdef __cplusplus
2584 extern "C" {
2585 #endif
2586@@ -241,5 +240,3 @@
2587 #ifdef __cplusplus
2588 }
2589 #endif
2590-
2591-#endif /* __DRIZZLE_QUERY_H */
2592
2593=== modified file 'libdrizzle-2.0/result.cc'
2594--- libdrizzle-2.0/result.cc 2011-11-04 21:06:16 +0000
2595+++ libdrizzle-2.0/result.cc 2011-11-08 00:09:24 +0000
2596@@ -107,7 +107,9 @@
2597 {
2598 result= drizzle_result_create(con, result);
2599 if (result == NULL)
2600+ {
2601 return NULL;
2602+ }
2603
2604 result->options|= from->options & ~DRIZZLE_RESULT_ALLOCATED;
2605
2606@@ -128,8 +130,15 @@
2607 drizzle_column_st *column;
2608 uint64_t x;
2609
2610+ if (result == NULL)
2611+ {
2612+ return;
2613+ }
2614+
2615 for (column= result->column_list; column != NULL; column= result->column_list)
2616+ {
2617 drizzle_column_free(column);
2618+ }
2619
2620 delete[] result->column_buffer;
2621
2622@@ -160,61 +169,118 @@
2623 void drizzle_result_free_all(drizzle_con_st *con)
2624 {
2625 while (con->result_list != NULL)
2626+ {
2627 drizzle_result_free(con->result_list);
2628+ }
2629 }
2630
2631 drizzle_con_st *drizzle_result_drizzle_con(drizzle_result_st *result)
2632 {
2633+ if (result == NULL)
2634+ {
2635+ return NULL;
2636+ }
2637+
2638 return result->con;
2639 }
2640
2641 bool drizzle_result_eof(drizzle_result_st *result)
2642 {
2643+ if (result == NULL)
2644+ {
2645+ return false;
2646+ }
2647+
2648 return (result->options & DRIZZLE_RESULT_EOF_PACKET) ? true : false;
2649 }
2650
2651 const char *drizzle_result_info(drizzle_result_st *result)
2652 {
2653+ if (result == NULL)
2654+ {
2655+ return NULL;
2656+ }
2657+
2658 return result->info;
2659 }
2660
2661 const char *drizzle_result_error(drizzle_result_st *result)
2662 {
2663+ if (result == NULL)
2664+ {
2665+ return NULL;
2666+ }
2667+
2668 return result->info;
2669 }
2670
2671 uint16_t drizzle_result_error_code(drizzle_result_st *result)
2672 {
2673+ if (result == NULL)
2674+ {
2675+ return 0;
2676+ }
2677+
2678 return result->error_code;
2679 }
2680
2681 const char *drizzle_result_sqlstate(drizzle_result_st *result)
2682 {
2683+ if (result == NULL)
2684+ {
2685+ return NULL;
2686+ }
2687+
2688 return result->sqlstate;
2689 }
2690
2691 uint16_t drizzle_result_warning_count(drizzle_result_st *result)
2692 {
2693+ if (result == NULL)
2694+ {
2695+ return 0;
2696+ }
2697+
2698 return result->warning_count;
2699 }
2700
2701 uint64_t drizzle_result_insert_id(drizzle_result_st *result)
2702 {
2703+ if (result == NULL)
2704+ {
2705+ return 0;
2706+ }
2707+
2708 return result->insert_id;
2709 }
2710
2711 uint64_t drizzle_result_affected_rows(drizzle_result_st *result)
2712 {
2713+ if (result == NULL)
2714+ {
2715+ return 0;
2716+ }
2717+
2718 return result->affected_rows;
2719 }
2720
2721 uint16_t drizzle_result_column_count(drizzle_result_st *result)
2722 {
2723+ if (result == NULL)
2724+ {
2725+ return 0;
2726+ }
2727+
2728 return result->column_count;
2729 }
2730
2731 uint64_t drizzle_result_row_count(drizzle_result_st *result)
2732 {
2733+ if (result == NULL)
2734+ {
2735+ return 0;
2736+ }
2737+
2738 return result->row_count;
2739 }
2740
2741@@ -226,6 +292,18 @@
2742 drizzle_result_st *result,
2743 drizzle_return_t *ret_ptr)
2744 {
2745+ drizzle_return_t unused;
2746+ if (ret_ptr == NULL)
2747+ {
2748+ ret_ptr= &unused;
2749+ }
2750+
2751+ if (con == NULL)
2752+ {
2753+ *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT;
2754+ return NULL;
2755+ }
2756+
2757 if (drizzle_state_none(con))
2758 {
2759 con->result= drizzle_result_create(con, result);
2760@@ -245,6 +323,11 @@
2761
2762 drizzle_return_t drizzle_result_buffer(drizzle_result_st *result)
2763 {
2764+ if (result == NULL)
2765+ {
2766+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
2767+ }
2768+
2769 drizzle_return_t ret;
2770 drizzle_row_t row;
2771
2772@@ -291,6 +374,11 @@
2773
2774 size_t drizzle_result_row_size(drizzle_result_st *result)
2775 {
2776+ if (result == NULL)
2777+ {
2778+ return 0;
2779+ }
2780+
2781 return result->con->packet_size;
2782 }
2783
2784@@ -301,6 +389,11 @@
2785 drizzle_return_t drizzle_result_write(drizzle_con_st *con,
2786 drizzle_result_st *result, bool flush)
2787 {
2788+ if (con == NULL)
2789+ {
2790+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
2791+ }
2792+
2793 if (drizzle_state_none(con))
2794 {
2795 con->result= result;
2796@@ -316,6 +409,11 @@
2797
2798 void drizzle_result_set_row_size(drizzle_result_st *result, size_t size)
2799 {
2800+ if (result == NULL)
2801+ {
2802+ return;
2803+ }
2804+
2805 result->con->packet_size= size;
2806 }
2807
2808@@ -323,6 +421,11 @@
2809 const drizzle_field_t *field,
2810 const size_t *size)
2811 {
2812+ if (result == NULL)
2813+ {
2814+ return;
2815+ }
2816+
2817 uint16_t x;
2818
2819 result->con->packet_size= 0;
2820@@ -344,6 +447,11 @@
2821
2822 void drizzle_result_set_eof(drizzle_result_st *result, bool is_eof)
2823 {
2824+ if (result == NULL)
2825+ {
2826+ return;
2827+ }
2828+
2829 if (is_eof)
2830 result->options|= DRIZZLE_RESULT_EOF_PACKET;
2831 else
2832@@ -352,8 +460,15 @@
2833
2834 void drizzle_result_set_info(drizzle_result_st *result, const char *info)
2835 {
2836+ if (result == NULL)
2837+ {
2838+ return;
2839+ }
2840+
2841 if (info == NULL)
2842+ {
2843 result->info[0]= 0;
2844+ }
2845 else
2846 {
2847 strncpy(result->info, info, DRIZZLE_MAX_INFO_SIZE);
2848@@ -363,20 +478,37 @@
2849
2850 void drizzle_result_set_error(drizzle_result_st *result, const char *error)
2851 {
2852+ if (result == NULL)
2853+ {
2854+ return;
2855+ }
2856+
2857 drizzle_result_set_info(result, error);
2858 }
2859
2860 void drizzle_result_set_error_code(drizzle_result_st *result,
2861 uint16_t error_code)
2862 {
2863+ if (result == NULL)
2864+ {
2865+ return;
2866+ }
2867+
2868 result->error_code= error_code;
2869 }
2870
2871 void drizzle_result_set_sqlstate(drizzle_result_st *result,
2872 const char *sqlstate)
2873 {
2874+ if (result == NULL)
2875+ {
2876+ return;
2877+ }
2878+
2879 if (sqlstate == NULL)
2880+ {
2881 result->sqlstate[0]= 0;
2882+ }
2883 else
2884 {
2885 strncpy(result->sqlstate, sqlstate, DRIZZLE_MAX_SQLSTATE_SIZE + 1);
2886@@ -387,24 +519,44 @@
2887 void drizzle_result_set_warning_count(drizzle_result_st *result,
2888 uint16_t warning_count)
2889 {
2890+ if (result == NULL)
2891+ {
2892+ return;
2893+ }
2894+
2895 result->warning_count= warning_count;
2896 }
2897
2898 void drizzle_result_set_insert_id(drizzle_result_st *result,
2899 uint64_t insert_id)
2900 {
2901+ if (result == NULL)
2902+ {
2903+ return;
2904+ }
2905+
2906 result->insert_id= insert_id;
2907 }
2908
2909 void drizzle_result_set_affected_rows(drizzle_result_st *result,
2910 uint64_t affected_rows)
2911 {
2912+ if (result == NULL)
2913+ {
2914+ return;
2915+ }
2916+
2917 result->affected_rows= affected_rows;
2918 }
2919
2920 void drizzle_result_set_column_count(drizzle_result_st *result,
2921 uint16_t column_count)
2922 {
2923+ if (result == NULL)
2924+ {
2925+ return;
2926+ }
2927+
2928 result->column_count= column_count;
2929 }
2930
2931@@ -416,6 +568,12 @@
2932 {
2933 drizzle_return_t ret;
2934
2935+ if (con == NULL)
2936+ {
2937+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
2938+ }
2939+
2940+
2941 drizzle_log_debug(con->drizzle, "drizzle_state_result_read");
2942
2943 /* Assume the entire result packet will fit in the buffer. */
2944@@ -496,6 +654,11 @@
2945
2946 drizzle_return_t drizzle_state_result_write(drizzle_con_st *con)
2947 {
2948+ if (con == NULL)
2949+ {
2950+ return DRIZZLE_RETURN_INVALID_ARGUMENT;
2951+ }
2952+
2953 uint8_t *start= con->buffer_ptr + con->buffer_size;
2954 uint8_t *ptr;
2955 drizzle_result_st *result= con->result;
2956
2957=== modified file 'libdrizzle-2.0/result.h'
2958--- libdrizzle-2.0/result.h 2011-11-04 21:06:16 +0000
2959+++ libdrizzle-2.0/result.h 2011-11-08 00:09:24 +0000
2960@@ -34,14 +34,13 @@
2961 *
2962 */
2963
2964+#pragma once
2965+
2966 /**
2967 * @file
2968 * @brief Result Declarations
2969 */
2970
2971-#ifndef __DRIZZLE_RESULT_H
2972-#define __DRIZZLE_RESULT_H
2973-
2974 #ifdef __cplusplus
2975 extern "C" {
2976 #endif
2977@@ -153,5 +152,3 @@
2978 #ifdef __cplusplus
2979 }
2980 #endif
2981-
2982-#endif /* __DRIZZLE_RESULT_H */
2983
2984=== modified file 'libdrizzle-2.0/result_client.h'
2985--- libdrizzle-2.0/result_client.h 2011-11-04 21:06:16 +0000
2986+++ libdrizzle-2.0/result_client.h 2011-11-08 00:09:24 +0000
2987@@ -34,14 +34,13 @@
2988 *
2989 */
2990
2991+#pragma once
2992+
2993 /**
2994 * @file
2995 * @brief Result Declarations for Clients
2996 */
2997
2998-#ifndef __DRIZZLE_RESULT_CLIENT_H
2999-#define __DRIZZLE_RESULT_CLIENT_H
3000-
3001 #ifdef __cplusplus
3002 extern "C" {
3003 #endif
3004@@ -79,5 +78,3 @@
3005 #ifdef __cplusplus
3006 }
3007 #endif
3008-
3009-#endif /* __DRIZZLE_RESULT_CLIENT_H */
3010
3011=== modified file 'libdrizzle-2.0/result_server.h'
3012--- libdrizzle-2.0/result_server.h 2011-11-04 21:06:16 +0000
3013+++ libdrizzle-2.0/result_server.h 2011-11-08 00:09:24 +0000
3014@@ -34,14 +34,13 @@
3015 *
3016 */
3017
3018+#pragma once
3019+
3020 /**
3021 * @file
3022 * @brief Result Declarations for Servers
3023 */
3024
3025-#ifndef __DRIZZLE_RESULT_SERVER_H
3026-#define __DRIZZLE_RESULT_SERVER_H
3027-
3028 #ifdef __cplusplus
3029 extern "C" {
3030 #endif
3031@@ -140,5 +139,3 @@
3032 #ifdef __cplusplus
3033 }
3034 #endif
3035-
3036-#endif /* __DRIZZLE_RESULT_SERVER_H */
3037
3038=== modified file 'libdrizzle-2.0/row_client.h'
3039--- libdrizzle-2.0/row_client.h 2011-11-04 21:06:16 +0000
3040+++ libdrizzle-2.0/row_client.h 2011-11-08 00:09:24 +0000
3041@@ -34,14 +34,13 @@
3042 *
3043 */
3044
3045+#pragma once
3046+
3047 /**
3048 * @file
3049 * @brief Row Declarations for Clients
3050 */
3051
3052-#ifndef __DRIZZLE_ROW_CLIENT_H
3053-#define __DRIZZLE_ROW_CLIENT_H
3054-
3055 #ifdef __cplusplus
3056 extern "C" {
3057 #endif
3058@@ -129,5 +128,3 @@
3059 #ifdef __cplusplus
3060 }
3061 #endif
3062-
3063-#endif /* __DRIZZLE_ROW_CLIENT_H */
3064
3065=== modified file 'libdrizzle-2.0/row_server.h'
3066--- libdrizzle-2.0/row_server.h 2011-11-04 21:06:16 +0000
3067+++ libdrizzle-2.0/row_server.h 2011-11-08 00:09:24 +0000
3068@@ -34,14 +34,13 @@
3069 *
3070 */
3071
3072+#pragma once
3073+
3074 /**
3075 * @file
3076 * @brief Row Declarations for Servers
3077 */
3078
3079-#ifndef __DRIZZLE_ROW_SERVER_H
3080-#define __DRIZZLE_ROW_SERVER_H
3081-
3082 #ifdef __cplusplus
3083 extern "C" {
3084 #endif
3085@@ -65,5 +64,3 @@
3086 #ifdef __cplusplus
3087 }
3088 #endif
3089-
3090-#endif /* __DRIZZLE_ROW_SERVER_H */
3091
3092=== modified file 'libdrizzle-2.0/sha1.h'
3093--- libdrizzle-2.0/sha1.h 2011-11-04 21:06:16 +0000
3094+++ libdrizzle-2.0/sha1.h 2011-11-08 00:09:24 +0000
3095@@ -1,11 +1,10 @@
3096+#pragma once
3097+
3098 /**
3099 * @file
3100 * @brief SHA1 Declarations
3101 */
3102
3103-#ifndef _SHA1_H
3104-#define _SHA1_H
3105-
3106 #ifdef __cplusplus
3107 extern "C" {
3108 #endif
3109@@ -43,5 +42,3 @@
3110 #ifdef __cplusplus
3111 }
3112 #endif
3113-
3114-#endif /* _SHA1_H */
3115
3116=== modified file 'libdrizzle-2.0/state.cc'
3117--- libdrizzle-2.0/state.cc 2011-11-04 21:06:16 +0000
3118+++ libdrizzle-2.0/state.cc 2011-11-08 00:09:24 +0000
3119@@ -43,7 +43,7 @@
3120
3121 drizzle_return_t drizzle_state_loop(drizzle_con_st *con)
3122 {
3123- while (!drizzle_state_none(con))
3124+ while (drizzle_state_none(con) == false)
3125 {
3126 drizzle_return_t ret= con->state_stack[con->state_current - 1](con);
3127 if (ret != DRIZZLE_RETURN_OK)
3128
3129=== modified file 'libdrizzle-2.0/state.h'
3130--- libdrizzle-2.0/state.h 2011-11-04 21:06:16 +0000
3131+++ libdrizzle-2.0/state.h 2011-11-08 00:09:24 +0000
3132@@ -34,14 +34,13 @@
3133 *
3134 */
3135
3136+#pragma once
3137+
3138 /**
3139 * @file
3140 * @brief State Machine Declarations
3141 */
3142
3143-#ifndef __DRIZZLE_STATE_H
3144-#define __DRIZZLE_STATE_H
3145-
3146 #ifdef __cplusplus
3147 extern "C" {
3148 #endif
3149@@ -107,5 +106,3 @@
3150 #ifdef __cplusplus
3151 }
3152 #endif
3153-
3154-#endif /* __DRIZZLE_STATE_H */
3155
3156=== modified file 'libdrizzle-2.0/structs.h'
3157--- libdrizzle-2.0/structs.h 2011-11-04 21:06:16 +0000
3158+++ libdrizzle-2.0/structs.h 2011-11-08 00:09:24 +0000
3159@@ -34,14 +34,13 @@
3160 *
3161 */
3162
3163+#pragma once
3164+
3165 /**
3166 * @file
3167 * @brief Struct Definitions
3168 */
3169
3170-#ifndef __DRIZZLE_STRUCTS_H
3171-#define __DRIZZLE_STRUCTS_H
3172-
3173 #include <sys/types.h>
3174
3175 #ifndef NI_MAXHOST
3176@@ -365,5 +364,3 @@
3177 #ifdef __cplusplus
3178 }
3179 #endif
3180-
3181-#endif /* __DRIZZLE_STRUCTS_H */
3182
3183=== modified file 'libdrizzle-2.0/visibility.h'
3184--- libdrizzle-2.0/visibility.h 2011-11-04 21:06:16 +0000
3185+++ libdrizzle-2.0/visibility.h 2011-11-08 00:09:24 +0000
3186@@ -36,13 +36,13 @@
3187 * Implementation drawn from visibility.texi in gnulib.
3188 */
3189
3190+#pragma once
3191+
3192 /**
3193 * @file
3194 * @brief Visibility Control Macros
3195 */
3196
3197-#pragma once
3198-
3199 /**
3200 *
3201 * DRIZZLE_API is used for the public API symbols. It either DLL imports or
3202
3203=== added file 'libdrizzle/drizzle_client.h'
3204--- libdrizzle/drizzle_client.h 1970-01-01 00:00:00 +0000
3205+++ libdrizzle/drizzle_client.h 2011-11-08 00:09:24 +0000
3206@@ -0,0 +1,39 @@
3207+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3208+ *
3209+ * Libdrizzle Library
3210+ *
3211+ * Copyright (C) 2011 Brian Aker, brian@tangent.org
3212+ *
3213+ * Redistribution and use in source and binary forms, with or without
3214+ * modification, are permitted provided that the following conditions are
3215+ * met:
3216+ *
3217+ * * Redistributions of source code must retain the above copyright
3218+ * notice, this list of conditions and the following disclaimer.
3219+ *
3220+ * * Redistributions in binary form must reproduce the above
3221+ * copyright notice, this list of conditions and the following disclaimer
3222+ * in the documentation and/or other materials provided with the
3223+ * distribution.
3224+ *
3225+ * * The names of its contributors may not be used to endorse or
3226+ * promote products derived from this software without specific prior
3227+ * written permission.
3228+ *
3229+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3230+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3231+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3232+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3233+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3234+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3235+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3236+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3237+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3238+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3239+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3240+ *
3241+ */
3242+
3243+#pragma once
3244+
3245+#include <libdrizzle-1.0/drizzle_client.h>
3246
3247=== modified file 'libdrizzle/include.am'
3248--- libdrizzle/include.am 2011-11-02 23:53:56 +0000
3249+++ libdrizzle/include.am 2011-11-08 00:09:24 +0000
3250@@ -1,3 +1,4 @@
3251 # vim:ft=automake
3252
3253-nobase_include_HEADERS= libdrizzle/drizzle.h
3254+nobase_include_HEADERS+= libdrizzle/drizzle.h
3255+nobase_include_HEADERS+= libdrizzle/drizzle_client.h
3256
3257=== modified file 'support-files/drizzle7.pc.in'
3258--- support-files/drizzle7.pc.in 2011-02-11 22:57:37 +0000
3259+++ support-files/drizzle7.pc.in 2011-11-08 00:09:24 +0000
3260@@ -4,7 +4,8 @@
3261 pkgincludedir=@pkgincludedir@
3262
3263 Name: drizzle7
3264-Description: Drizzle Development Headers
3265+Description: Drizzle CLI
3266 Version: @VERSION@
3267+URL: http://drizzle.org/
3268 Cflags: -I${pkgincludedir}
3269
3270
3271=== modified file 'support-files/libdrizzle-1.0.pc.in'
3272--- support-files/libdrizzle-1.0.pc.in 2011-03-22 18:39:54 +0000
3273+++ support-files/libdrizzle-1.0.pc.in 2011-11-08 00:09:24 +0000
3274@@ -2,10 +2,10 @@
3275 exec_prefix=@exec_prefix@
3276 libdir=@libdir@
3277 includedir=@includedir@
3278-libdrizzleincludedir=@oldlibdrizzleincludedir@
3279
3280 Name: libdrizzle-1.0
3281-Description: Drizzle Client & Protocol Library
3282+Description: Drizzle Protocol Library
3283 Version: @PANDORA_RELEASE_VERSION@
3284 Libs: -L${libdir} -ldrizzle
3285-Cflags: -I${libdrizzleincludedir}
3286+URL: http://drizzle.org/
3287+Cflags: -I$@includedir@/libdrizzle-1.0
3288
3289=== modified file 'support-files/libdrizzle-2.0.pc.in'
3290--- support-files/libdrizzle-2.0.pc.in 2011-03-31 22:51:58 +0000
3291+++ support-files/libdrizzle-2.0.pc.in 2011-11-08 00:09:24 +0000
3292@@ -2,10 +2,10 @@
3293 exec_prefix=@exec_prefix@
3294 libdir=@libdir@
3295 includedir=@includedir@
3296-libdrizzleincludedir=@libdrizzleincludedir@
3297
3298 Name: libdrizzle-2.0
3299-Description: Drizzle Client & Protocol Library
3300+Description: Drizzle Protocol Library
3301 Version: @PANDORA_RELEASE_VERSION@
3302 Libs: -L${libdir} -ldrizzle-2.0
3303-Cflags: -I${libdrizzleincludedir}
3304+URL: http://drizzle.org/
3305+Cflags: -I$@includedir@/libdrizzle-2.0
3306
3307=== added file 'support-files/libdrizzle.pc.in'
3308--- support-files/libdrizzle.pc.in 1970-01-01 00:00:00 +0000
3309+++ support-files/libdrizzle.pc.in 2011-11-08 00:09:24 +0000
3310@@ -0,0 +1,11 @@
3311+prefix=@prefix@
3312+exec_prefix=@exec_prefix@
3313+libdir=@libdir@
3314+includedir=@includedir@
3315+
3316+Name: libdrizzle
3317+Description: Drizzle Protocol Library
3318+Version: @PANDORA_RELEASE_VERSION@
3319+Libs: -L${libdir} -ldrizzle
3320+URL: http://drizzle.org/
3321+Cflags: -I$@includedir@