~drizzle-trunk/drizzle/development

383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
390.1.3 by Monty Taylor
Copyright header fixes.
8
 *  the Free Software Foundation; version 2 of the License.
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
779.3.37 by Monty Taylor
Renmaed libdrizzle in the tree to libdrizzleclient to avoid namespace clashes
20
#ifndef LIBDRIZZLECLIENT_DRIZZLE_H
21
#define LIBDRIZZLECLIENT_DRIZZLE_H
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
22
779.3.37 by Monty Taylor
Renmaed libdrizzle in the tree to libdrizzleclient to avoid namespace clashes
23
#include <drizzled/common.h>
24
#include "drizzle_field.h"
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
25
#include "options.h"
779.3.37 by Monty Taylor
Renmaed libdrizzle in the tree to libdrizzleclient to avoid namespace clashes
26
#include "drizzle_res.h"
27
#include "net_serv.h"
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
28
29
#include <stdint.h>
30
390.1.6 by Monty Taylor
Oh dear god the changes. The changes. I'd tell you what they are, but I'd just be making stuff up. Suffice it to day it's mostly all around splitting files in libdrizzle into different files and removing interdepends. And whatever else I happened to see...
31
#ifdef  __cplusplus
32
extern "C" {
33
#endif
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
34
35
struct st_drizzle_methods;
36
37
enum drizzle_status
38
{
39
  DRIZZLE_STATUS_READY,DRIZZLE_STATUS_GET_RESULT,DRIZZLE_STATUS_USE_RESULT
40
};
41
42
typedef struct st_drizzle
43
{
44
  NET    net;      /* Communication parameters */
45
  unsigned char  *connector_fd;    /* ConnectorFd for SSL */
46
  char    *host,*user,*passwd,*unix_socket,*server_version,*host_info;
47
  char          *info, *db;
48
  DRIZZLE_FIELD  *fields;
49
  uint64_t affected_rows;
50
  uint64_t insert_id;    /* id if insert on table with NEXTNR */
51
  uint64_t extra_info;    /* Not used */
52
  uint32_t thread_id;    /* Id for connection in server */
53
  uint32_t packet_length;
54
  uint32_t  port;
55
  uint32_t client_flag,server_capabilities;
56
  uint32_t  protocol_version;
57
  uint32_t  field_count;
58
  uint32_t  server_status;
59
  uint32_t  server_language;
60
  uint32_t  warning_count;
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
61
  struct st_drizzleclient_options options;
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
62
  enum drizzle_status status;
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
63
  bool  free_me;    /* If free in drizzleclient_close */
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
64
  bool  reconnect;    /* set to 1 if automatic reconnect */
65
66
  /* session-wide random string */
67
  char          scramble[SCRAMBLE_LENGTH+1];
68
  bool unused1;
69
  void *unused2, *unused3, *unused4, *unused5;
70
71
  const struct st_drizzle_methods *methods;
72
  void *thd;
73
  /*
74
    Points to boolean flag in DRIZZLE_RES  or DRIZZLE_STMT. We set this flag
75
    from drizzle_stmt_close if close had to cancel result set of this object.
76
  */
77
  bool *unbuffered_fetch_owner;
78
  /* needed for embedded server - no net buffer to store the 'info' */
79
  char *info_buffer;
80
  void *extension;
81
} DRIZZLE;
82
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
83
DRIZZLE * drizzleclient_create(DRIZZLE *drizzle);
84
DRIZZLE * drizzleclient_connect(DRIZZLE *drizzle, const char *host,
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
85
             const char *user,
86
             const char *passwd,
87
             const char *db,
88
             uint32_t port,
89
             const char *unix_socket,
90
             uint32_t clientflag);
390.1.5 by Monty Taylor
Moved more functions into drizzle.c as part of the split of code.
91
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
92
int32_t    drizzleclient_select_db(DRIZZLE *drizzle, const char *db);
93
int32_t    drizzleclient_query(DRIZZLE *drizzle, const char *q);
94
int32_t    drizzleclient_send_query(DRIZZLE *drizzle, const char *q, uint32_t length);
95
int32_t    drizzleclient_real_query(DRIZZLE *drizzle, const char *q, uint32_t length);
96
97
DRIZZLE_RES * drizzleclient_store_result(DRIZZLE *drizzle);
98
DRIZZLE_RES * drizzleclient_use_result(DRIZZLE *drizzle);
99
100
uint32_t drizzleclient_field_count(const DRIZZLE *drizzle);
101
uint64_t drizzleclient_affected_rows(const DRIZZLE *drizzle);
102
uint64_t drizzleclient_insert_id(const DRIZZLE *drizzle);
103
uint32_t drizzleclient_errno(const DRIZZLE *drizzle);
104
const char * drizzleclient_error(const DRIZZLE *drizzle);
105
const char * drizzleclient_sqlstate(const DRIZZLE *drizzle);
106
uint32_t drizzleclient_warning_count(const DRIZZLE *drizzle);
107
const char * drizzleclient_info(const DRIZZLE *drizzle);
108
uint32_t drizzleclient_thread_id(const DRIZZLE *drizzle);
390.1.5 by Monty Taylor
Moved more functions into drizzle.c as part of the split of code.
109
const char * drizzle_character_set_name(const DRIZZLE *drizzle);
110
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
111
bool   drizzleclient_change_user(DRIZZLE *drizzle, const char *user,
390.1.5 by Monty Taylor
Moved more functions into drizzle.c as part of the split of code.
112
                           const char *passwd, const char *db);
113
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
114
/* local infile support */
115
116
#define LOCAL_INFILE_ERROR_LEN 512
117
118
void
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
119
drizzleclient_set_local_infile_handler(DRIZZLE *drizzle,
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
120
        int (*local_infile_init)(void **, const char *, void *),
121
        int (*local_infile_read)(void *, char *, unsigned int),
122
        void (*local_infile_end)(void *),int (*local_infile_error)
123
        (void *, char*, unsigned int), void *);
124
125
void
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
126
drizzleclient_set_local_infile_default(DRIZZLE *drizzle);
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
127
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
128
int32_t    drizzleclient_shutdown(DRIZZLE *drizzle);
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
129
int32_t    drizzle_dump_debug_info(DRIZZLE *drizzle);
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
130
int32_t    drizzleclient_refresh(DRIZZLE *drizzle, uint32_t refresh_options);
131
int32_t    drizzleclient_ping(DRIZZLE *drizzle);
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
132
const char *  drizzle_stat(DRIZZLE *drizzle);
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
133
const char *  drizzleclient_get_server_info(const DRIZZLE *drizzle);
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
134
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
135
const char *  drizzleclient_get_host_info(const DRIZZLE *drizzle);
136
uint32_t  drizzleclient_get_server_version(const DRIZZLE *drizzle);
137
uint32_t  drizzleclient_get_proto_info(const DRIZZLE *drizzle);
138
DRIZZLE_RES *  drizzleclient_list_tables(DRIZZLE *drizzle,const char *wild);
139
DRIZZLE_RES *  drizzleclient_list_processes(DRIZZLE *drizzle);
140
int32_t    drizzleclient_options(DRIZZLE *drizzle, enum drizzle_option option,
923.1.7 by Brian Aker
Remove dead COM for Field lists.
141
                                 const void *arg);
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
142
bool         drizzleclient_read_query_result(DRIZZLE *drizzle);
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
143
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
144
bool drizzleclient_commit(DRIZZLE *drizzle);
145
bool drizzleclient_rollback(DRIZZLE *drizzle);
146
bool drizzleclient_autocommit(DRIZZLE *drizzle, bool auto_mode);
147
bool drizzleclient_more_results(const DRIZZLE *drizzle);
148
int drizzleclient_next_result(DRIZZLE *drizzle);
149
void drizzleclient_close(DRIZZLE *drizzle);
150
bool drizzleclient_reconnect(DRIZZLE *drizzle);
151
void drizzleclient_disconnect(DRIZZLE *drizzle);
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
152
383.1.49 by Monty Taylor
Got rid of client_settings.h
153
bool
840.1.20 by Monty Taylor
Renamed non-prefixed things from libdrizzleclient to drizzleclient.
154
drizzleclient_cli_advanced_command(DRIZZLE *drizzle, enum enum_server_command command,
390.1.5 by Monty Taylor
Moved more functions into drizzle.c as part of the split of code.
155
                     const unsigned char *header, uint32_t header_length,
156
                     const unsigned char *arg, uint32_t arg_length,
157
                     bool skip_check);
840.1.20 by Monty Taylor
Renamed non-prefixed things from libdrizzleclient to drizzleclient.
158
uint32_t drizzleclient_cli_safe_read(DRIZZLE *drizzle);
159
DRIZZLE_FIELD * drizzleclient_cli_list_fields(DRIZZLE *drizzle);
160
DRIZZLE_DATA * drizzleclient_cli_read_rows(DRIZZLE *drizzle,DRIZZLE_FIELD *drizzle_fields,
390.1.5 by Monty Taylor
Moved more functions into drizzle.c as part of the split of code.
161
                             unsigned int fields);
840.1.20 by Monty Taylor
Renamed non-prefixed things from libdrizzleclient to drizzleclient.
162
int drizzleclient_cli_unbuffered_fetch(DRIZZLE *drizzle, char **row);
163
const char * drizzleclient_cli_read_statistics(DRIZZLE *drizzle);
383.1.49 by Monty Taylor
Got rid of client_settings.h
164
722.2.12 by Monty Taylor
Removed assert(0); Added function ptr in libdrizzle.
165
typedef bool (*safe_read_error_hook_func)(NET *net);
166
extern safe_read_error_hook_func safe_read_error_hook;
383.1.49 by Monty Taylor
Got rid of client_settings.h
167
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
168
#ifdef  __cplusplus
169
}
170
#endif
171
779.3.37 by Monty Taylor
Renmaed libdrizzle in the tree to libdrizzleclient to avoid namespace clashes
172
#endif /* LIBDRIZZLECLIENT_DRIZZLE_H */