26
26
#include <drizzled/protocol.h>
27
27
#include <drizzled/session.h>
30
Function called by drizzleclient_net_init() to set some check variables
34
void drizzleclient_net_local_init(NET *net)
36
net->max_packet= (uint32_t) global_system_variables.net_buffer_length;
38
drizzleclient_net_set_read_timeout(net,
39
(uint32_t)global_system_variables.net_read_timeout);
40
drizzleclient_net_set_write_timeout(net,
41
(uint32_t)global_system_variables.net_write_timeout);
43
net->retry_count= (uint32_t) global_system_variables.net_retry_count;
44
net->max_packet_size= cmax(global_system_variables.net_buffer_length,
45
global_system_variables.max_allowed_packet);
29
49
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
30
50
/* Declared non-static only because of the embedded library. */
31
51
static void net_send_error_packet(Session *session, uint32_t sql_errno, const char *err);
32
52
static void write_eof_packet(Session *session, NET *net,
33
53
uint32_t server_status, uint32_t total_warn_count);
55
bool Protocol::io_ok()
57
return session->net.vio != 0;
60
void Protocol::set_read_timeout(uint32_t timeout)
62
drizzleclient_net_set_read_timeout(&session->net, timeout);
65
void Protocol::set_write_timeout(uint32_t timeout)
67
drizzleclient_net_set_write_timeout(&session->net, timeout);
70
void Protocol::set_retry_count(uint32_t count)
72
session->net.retry_count=count;
75
void Protocol::set_error(char error)
77
session->net.error= error;
80
bool Protocol::have_error(void)
82
return session->net.error || session->net.vio == 0;
85
bool Protocol::have_compression(void)
87
return session->net.compress;
91
* To disable results we set session->net.vio to 0.
94
void Protocol::disable_results(void)
96
save_vio= session->net.vio;
100
void Protocol::enable_results(void)
102
session->net.vio= save_vio;
35
106
bool Protocol::net_store_data(const unsigned char *from, size_t length)
37
108
size_t packet_length= packet->length();