~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
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
21
#ifndef _libdrizzle_drizzle_h
22
#define _libdrizzle_drizzle_h
23
24
#ifdef  __cplusplus
25
extern "C" {
26
#endif
27
28
#include <stdint.h>
29
#include <libdrizzle/drizzle_com.h>
30
#include <libdrizzle/drizzle_field.h>
31
#include <libdrizzle/drizzle_options.h>
32
#include <libdrizzle/drizzle_res.h>
33
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;
61
  struct st_drizzle_options options;
62
  enum drizzle_status status;
63
  bool  free_me;    /* If free in drizzle_close */
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
83
uint32_t drizzle_field_count(const DRIZZLE *drizzle);
84
uint64_t drizzle_affected_rows(const DRIZZLE *drizzle);
85
uint64_t drizzle_insert_id(const DRIZZLE *drizzle);
86
uint32_t drizzle_errno(const DRIZZLE *drizzle);
87
const char * drizzle_error(const DRIZZLE *drizzle);
88
const char * drizzle_sqlstate(const DRIZZLE *drizzle);
89
uint32_t drizzle_warning_count(const DRIZZLE *drizzle);
90
const char * drizzle_info(const DRIZZLE *drizzle);
91
uint32_t drizzle_thread_id(const DRIZZLE *drizzle);
92
const char * drizzle_character_set_name(const DRIZZLE *drizzle);
93
int32_t          drizzle_set_character_set(DRIZZLE *drizzle, const char *csname);
94
95
DRIZZLE * drizzle_create(DRIZZLE *drizzle);
96
bool   drizzle_change_user(DRIZZLE *drizzle, const char *user,
97
            const char *passwd, const char *db);
98
DRIZZLE * drizzle_connect(DRIZZLE *drizzle, const char *host,
99
             const char *user,
100
             const char *passwd,
101
             const char *db,
102
             uint32_t port,
103
             const char *unix_socket,
104
             uint32_t clientflag);
105
int32_t    drizzle_select_db(DRIZZLE *drizzle, const char *db);
106
int32_t    drizzle_query(DRIZZLE *drizzle, const char *q);
107
int32_t    drizzle_send_query(DRIZZLE *drizzle, const char *q, uint32_t length);
108
int32_t    drizzle_real_query(DRIZZLE *drizzle, const char *q, uint32_t length);
109
DRIZZLE_RES * drizzle_store_result(DRIZZLE *drizzle);
110
DRIZZLE_RES * drizzle_use_result(DRIZZLE *drizzle);
111
112
/* local infile support */
113
114
#define LOCAL_INFILE_ERROR_LEN 512
115
116
void
117
drizzle_set_local_infile_handler(DRIZZLE *drizzle,
118
        int (*local_infile_init)(void **, const char *, void *),
119
        int (*local_infile_read)(void *, char *, unsigned int),
120
        void (*local_infile_end)(void *),int (*local_infile_error)
121
        (void *, char*, unsigned int), void *);
122
123
void
124
drizzle_set_local_infile_default(DRIZZLE *drizzle);
125
126
int32_t    drizzle_shutdown(DRIZZLE *drizzle, enum drizzle_enum_shutdown_level shutdown_level);
127
int32_t    drizzle_dump_debug_info(DRIZZLE *drizzle);
128
int32_t    drizzle_refresh(DRIZZLE *drizzle, uint32_t refresh_options);
129
int32_t    drizzle_kill(DRIZZLE *drizzle, uint32_t pid);
130
int32_t    drizzle_set_server_option(DRIZZLE *drizzle, enum enum_drizzle_set_option option);
131
int32_t    drizzle_ping(DRIZZLE *drizzle);
132
const char *  drizzle_stat(DRIZZLE *drizzle);
133
const char *  drizzle_get_server_info(const DRIZZLE *drizzle);
134
135
const char *  drizzle_get_host_info(const DRIZZLE *drizzle);
136
uint32_t  drizzle_get_server_version(const DRIZZLE *drizzle);
137
uint32_t  drizzle_get_proto_info(const DRIZZLE *drizzle);
138
DRIZZLE_RES *  drizzle_list_tables(DRIZZLE *drizzle,const char *wild);
139
DRIZZLE_RES *  drizzle_list_processes(DRIZZLE *drizzle);
140
int32_t    drizzle_options(DRIZZLE *drizzle,enum drizzle_option option, const void *arg);
141
DRIZZLE_RES *     drizzle_list_fields(DRIZZLE *drizzle, const char *table, const char *wild);
142
bool         drizzle_read_query_result(DRIZZLE *drizzle);
143
144
bool drizzle_commit(DRIZZLE *drizzle);
145
bool drizzle_rollback(DRIZZLE *drizzle);
146
bool drizzle_autocommit(DRIZZLE *drizzle, bool auto_mode);
147
bool drizzle_more_results(const DRIZZLE *drizzle);
148
int drizzle_next_result(DRIZZLE *drizzle);
149
void drizzle_close(DRIZZLE *sock);
150
151
383.1.49 by Monty Taylor
Got rid of client_settings.h
152
bool
153
cli_advanced_command(DRIZZLE *drizzle, enum enum_server_command command,
154
		     const unsigned char *header, uint32_t header_length,
155
		     const unsigned char *arg, uint32_t arg_length, bool skip_check);
156
uint32_t cli_safe_read(DRIZZLE *drizzle);
157
DRIZZLE_FIELD * cli_list_fields(DRIZZLE *drizzle);
158
DRIZZLE_DATA * cli_read_rows(DRIZZLE *drizzle,DRIZZLE_FIELD *drizzle_fields,
159
				   uint fields);
160
int cli_unbuffered_fetch(DRIZZLE *drizzle, char **row);
161
const char * cli_read_statistics(DRIZZLE *drizzle);
162
int cli_read_change_user_result(DRIZZLE *drizzle);
163
164
383.1.46 by Monty Taylor
Finished splitting libdrizzle header files.
165
#ifdef  __cplusplus
166
}
167
#endif
168
169
#endif /* _libdrizzle_drizzle_h */