~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/oldlibdrizzle/drizzle.h

  • Committer: Stewart Smith
  • Date: 2009-10-08 12:39:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1179.
  • Revision ID: stewart@flamingspork.com-20091008123927-qpf9hog04w4xc5aj
make directory_file_name() static to mysys/my_lib.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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; version 2 of the License.
 
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
 
 
20
#ifndef LIBDRIZZLECLIENT_DRIZZLE_H
 
21
#define LIBDRIZZLECLIENT_DRIZZLE_H
 
22
 
 
23
#include <drizzled/common.h>
 
24
#include "drizzle_field.h"
 
25
#include "options.h"
 
26
#include "drizzle_res.h"
 
27
#include "net_serv.h"
 
28
 
 
29
#include <stdint.h>
 
30
 
 
31
#ifdef  __cplusplus
 
32
extern "C" {
 
33
#endif
 
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_drizzleclient_options options;
 
62
  enum drizzle_status status;
 
63
  bool  free_me;    /* If free in drizzleclient_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
DRIZZLE * drizzleclient_create(DRIZZLE *drizzle);
 
84
DRIZZLE * drizzleclient_connect(DRIZZLE *drizzle, const char *host,
 
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);
 
91
 
 
92
int32_t    drizzleclient_select_db(DRIZZLE *drizzle, const char *db);
 
93
int32_t    drizzleclient_send_query(DRIZZLE *drizzle, const char *q, uint32_t length);
 
94
int32_t    drizzleclient_real_query(DRIZZLE *drizzle, const char *q, uint32_t length);
 
95
 
 
96
DRIZZLE_RES * drizzleclient_store_result(DRIZZLE *drizzle);
 
97
 
 
98
uint32_t drizzleclient_errno(const DRIZZLE *drizzle);
 
99
const char * drizzleclient_error(const DRIZZLE *drizzle);
 
100
const char * drizzle_character_set_name(const DRIZZLE *drizzle);
 
101
 
 
102
bool   drizzleclient_change_user(DRIZZLE *drizzle, const char *user,
 
103
                           const char *passwd, const char *db);
 
104
 
 
105
/* local infile support */
 
106
 
 
107
#define LOCAL_INFILE_ERROR_LEN 512
 
108
 
 
109
void
 
110
drizzleclient_set_local_infile_handler(DRIZZLE *drizzle,
 
111
        int (*local_infile_init)(void **, const char *, void *),
 
112
        int (*local_infile_read)(void *, char *, unsigned int),
 
113
        void (*local_infile_end)(void *),int (*local_infile_error)
 
114
        (void *, char*, unsigned int), void *);
 
115
 
 
116
void
 
117
drizzleclient_set_local_infile_default(DRIZZLE *drizzle);
 
118
 
 
119
int32_t    drizzle_dump_debug_info(DRIZZLE *drizzle);
 
120
int32_t    drizzleclient_refresh(DRIZZLE *drizzle, uint32_t refresh_options);
 
121
const char *  drizzle_stat(DRIZZLE *drizzle);
 
122
 
 
123
uint32_t  drizzleclient_get_server_version(const DRIZZLE *drizzle);
 
124
DRIZZLE_RES *  drizzleclient_list_processes(DRIZZLE *drizzle);
 
125
int32_t    drizzleclient_options(DRIZZLE *drizzle, enum drizzle_option option,
 
126
                                 const void *arg);
 
127
 
 
128
void drizzleclient_close(DRIZZLE *drizzle);
 
129
bool drizzleclient_reconnect(DRIZZLE *drizzle);
 
130
void drizzleclient_disconnect(DRIZZLE *drizzle);
 
131
 
 
132
bool
 
133
drizzleclient_cli_advanced_command(DRIZZLE *drizzle, enum enum_server_command command,
 
134
                     const unsigned char *header, uint32_t header_length,
 
135
                     const unsigned char *arg, uint32_t arg_length,
 
136
                     bool skip_check);
 
137
uint32_t drizzleclient_cli_safe_read(DRIZZLE *drizzle);
 
138
DRIZZLE_FIELD * drizzleclient_cli_list_fields(DRIZZLE *drizzle);
 
139
DRIZZLE_DATA * drizzleclient_cli_read_rows(DRIZZLE *drizzle,DRIZZLE_FIELD *drizzle_fields,
 
140
                             unsigned int fields);
 
141
int drizzleclient_cli_unbuffered_fetch(DRIZZLE *drizzle, char **row);
 
142
const char * drizzleclient_cli_read_statistics(DRIZZLE *drizzle);
 
143
 
 
144
typedef bool (*safe_read_error_hook_func)(NET *net);
 
145
extern safe_read_error_hook_func safe_read_error_hook;
 
146
 
 
147
#ifdef  __cplusplus
 
148
}
 
149
#endif
 
150
 
 
151
#endif /* LIBDRIZZLECLIENT_DRIZZLE_H */