Drizzled Public API Documentation

drizzle.h

Go to the documentation of this file.
00001 /*
00002  * Drizzle Client & Protocol Library
00003  *
00004  * Copyright (C) 2008 Eric Day (eday@oddments.org)
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are
00009  * met:
00010  *
00011  *     * Redistributions of source code must retain the above copyright
00012  * notice, this list of conditions and the following disclaimer.
00013  *
00014  *     * Redistributions in binary form must reproduce the above
00015  * copyright notice, this list of conditions and the following disclaimer
00016  * in the documentation and/or other materials provided with the
00017  * distribution.
00018  *
00019  *     * The names of its contributors may not be used to endorse or
00020  * promote products derived from this software without specific prior
00021  * written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00026  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00027  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00028  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00029  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00030  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00031  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00032  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034  *
00035  */
00036 
00042 #ifndef __DRIZZLE_H
00043 #define __DRIZZLE_H
00044 
00045 
00046 #include <inttypes.h>
00047 #include <sys/types.h>
00048 
00049 #ifdef _WIN32
00050 # define WIN32_LEAN_AND_MEAN
00051 
00052 # include <Windows.h>
00053 # include <winsock2.h>
00054 # include <ws2tcpip.h>
00055 # include <io.h>
00056 
00057 # undef close
00058 # define close _close
00059 typedef unsigned int in_port_t;
00060 typedef long ssize_t;
00061 
00062 # define snprintf _snprintf
00063 # define inline __inline
00064 
00065 struct sockaddr_un
00066 {
00067   short int sun_family;
00068   char sun_path[108];
00069 };
00070 
00071 # define poll WSAPoll
00072 //# define pollfd WSAPOLLFD
00073 
00074 #if defined(__GNUC__)
00075 # include <stdbool.h>
00076 #else
00077 # if !defined(__cplusplus)
00078 typedef enum { false = 0, true = 1 } _Bool;
00079 typedef _Bool bool;
00080 #endif 
00081 #endif
00082 
00083 #else
00084 # if !defined(__cplusplus)
00085 #  include <stdbool.h>
00086 # endif
00087 # include <sys/socket.h>
00088 # include <netinet/in.h>
00089 # include <arpa/inet.h>
00090 # include <sys/un.h>
00091 # include <netdb.h>
00092 # include <poll.h>
00093 #endif
00094 
00095 #include <assert.h>
00096 #include <errno.h>
00097 
00098 #include <libdrizzle/visibility.h>
00099 #include <libdrizzle/constants.h>
00100 #include <libdrizzle/structs.h>
00101 #include <libdrizzle/conn.h>
00102 #include <libdrizzle/result.h>
00103 #include <libdrizzle/column.h>
00104 
00105 #ifdef  __cplusplus
00106 extern "C" {
00107 #endif
00108 
00128 DRIZZLE_API
00129 const char *drizzle_version(void);
00130 
00136 DRIZZLE_API
00137 const char *drizzle_bugreport(void);
00138 
00145 DRIZZLE_API
00146 const char *drizzle_verbose_name(drizzle_verbose_t verbose);
00147 
00156 DRIZZLE_API
00157 drizzle_st *drizzle_create(drizzle_st *drizzle);
00158 
00166 DRIZZLE_API
00167 drizzle_st *drizzle_clone(drizzle_st *drizzle, const drizzle_st *from);
00168 
00175 DRIZZLE_API
00176 void drizzle_free(drizzle_st *drizzle);
00177 
00185 DRIZZLE_API
00186 const char *drizzle_error(const drizzle_st *drizzle);
00187 
00195 DRIZZLE_API
00196 int drizzle_errno(const drizzle_st *drizzle);
00197 
00205 DRIZZLE_API
00206 uint16_t drizzle_error_code(const drizzle_st *drizzle);
00207 
00215 DRIZZLE_API
00216 const char *drizzle_sqlstate(const drizzle_st *drizzle);
00217 
00225 DRIZZLE_API
00226 drizzle_options_t drizzle_options(const drizzle_st *drizzle);
00227 
00235 DRIZZLE_API
00236 void drizzle_set_options(drizzle_st *drizzle, drizzle_options_t options);
00237 
00245 DRIZZLE_API
00246 void drizzle_add_options(drizzle_st *drizzle, drizzle_options_t options);
00247 
00255 DRIZZLE_API
00256 void drizzle_remove_options(drizzle_st *drizzle, drizzle_options_t options);
00257 
00265 DRIZZLE_API
00266 void *drizzle_context(const drizzle_st *drizzle);
00267 
00275 DRIZZLE_API
00276 void drizzle_set_context(drizzle_st *drizzle, void *context);
00277 
00286 DRIZZLE_API
00287 void drizzle_set_context_free_fn(drizzle_st *drizzle,
00288                                  drizzle_context_free_fn *function);
00289 
00298 DRIZZLE_API
00299 int drizzle_timeout(const drizzle_st *drizzle);
00300 
00309 DRIZZLE_API
00310 void drizzle_set_timeout(drizzle_st *drizzle, int timeout);
00311 
00319 DRIZZLE_API
00320 drizzle_verbose_t drizzle_verbose(const drizzle_st *drizzle);
00321 
00331 DRIZZLE_API
00332 void drizzle_set_verbose(drizzle_st *drizzle, drizzle_verbose_t verbose);
00333 
00344 DRIZZLE_API
00345 void drizzle_set_log_fn(drizzle_st *drizzle, drizzle_log_fn *function,
00346                         void *context);
00347 
00363 DRIZZLE_API
00364 void drizzle_set_event_watch_fn(drizzle_st *drizzle,
00365                                 drizzle_event_watch_fn *function,
00366                                 void *context);
00367 
00379 DRIZZLE_API
00380 drizzle_con_st *drizzle_con_create(drizzle_st *drizzle, drizzle_con_st *con);
00381 
00391 DRIZZLE_API
00392 drizzle_con_st *drizzle_con_clone(drizzle_st *drizzle, drizzle_con_st *con,
00393                                   const drizzle_con_st *from);
00394 
00401 DRIZZLE_API
00402 void drizzle_con_free(drizzle_con_st *con);
00403 
00410 DRIZZLE_API
00411 void drizzle_con_free_all(drizzle_st *drizzle);
00412 
00420 DRIZZLE_API
00421 drizzle_return_t drizzle_con_wait(drizzle_st *drizzle);
00422 
00430 DRIZZLE_API
00431 drizzle_con_st *drizzle_con_ready(drizzle_st *drizzle);
00432 
00435 #ifdef  __cplusplus
00436 }
00437 #endif
00438 
00439 #endif /* __DRIZZLE_H */