45
44
static uint32_t buffer_length;
46
45
static char* bind_address;
48
const char* ListenOldLibdrizzle::getHost(void) const
47
const char* ListenDrizzleProtocol::getHost(void) const
50
49
return bind_address;
53
in_port_t ListenOldLibdrizzle::getPort(void) const
52
in_port_t ListenDrizzleProtocol::getPort(void) const
55
54
struct servent *serv_ptr;
58
if (using_mysql41_protocol)
59
return (in_port_t) mysql_port;
63
59
port= DRIZZLE_TCP_PORT;
77
73
return (in_port_t) port;
80
plugin::Client *ListenOldLibdrizzle::getClient(int fd)
76
plugin::Client *ListenDrizzleProtocol::getClient(int fd)
83
79
new_fd= acceptTcp(fd);
87
return new (nothrow) ClientOldLibdrizzle(new_fd, using_mysql41_protocol);
83
return new (nothrow) ClientDrizzleProtocol(new_fd, using_mysql41_protocol);
90
ClientOldLibdrizzle::ClientOldLibdrizzle(int fd, bool using_mysql41_protocol_arg):
86
ClientDrizzleProtocol::ClientDrizzleProtocol(int fd, bool using_mysql41_protocol_arg):
91
87
using_mysql41_protocol(using_mysql41_protocol_arg)
103
99
net.retry_count=retry_count;
106
ClientOldLibdrizzle::~ClientOldLibdrizzle()
102
ClientDrizzleProtocol::~ClientDrizzleProtocol()
109
105
drizzleclient_vio_close(net.vio);
112
int ClientOldLibdrizzle::getFileDescriptor(void)
108
int ClientDrizzleProtocol::getFileDescriptor(void)
114
110
return drizzleclient_net_get_sd(&net);
117
bool ClientOldLibdrizzle::isConnected()
113
bool ClientDrizzleProtocol::isConnected()
119
115
return net.vio != 0;
122
bool ClientOldLibdrizzle::isReading(void)
118
bool ClientDrizzleProtocol::isReading(void)
124
120
return net.reading_or_writing == 1;
127
bool ClientOldLibdrizzle::isWriting(void)
123
bool ClientDrizzleProtocol::isWriting(void)
129
125
return net.reading_or_writing == 2;
132
bool ClientOldLibdrizzle::flush()
128
bool ClientDrizzleProtocol::flush()
134
130
if (net.vio == NULL)
567
563
return netStoreData((const unsigned char *)str.ptr(), str.length());
570
bool ClientOldLibdrizzle::store(void)
566
bool ClientDrizzleProtocol::store(void)
573
569
buff[0]= (char)251;
574
570
return packet.append(buff, sizeof(buff), PACKET_BUFFER_EXTRA_ALLOC);
577
bool ClientOldLibdrizzle::store(int32_t from)
573
bool ClientDrizzleProtocol::store(int32_t from)
580
576
return netStoreData((unsigned char*) buff,
581
577
(size_t) (int10_to_str(from, buff, -10) - buff));
584
bool ClientOldLibdrizzle::store(uint32_t from)
580
bool ClientDrizzleProtocol::store(uint32_t from)
587
583
return netStoreData((unsigned char*) buff,
588
584
(size_t) (int10_to_str(from, buff, 10) - buff));
591
bool ClientOldLibdrizzle::store(int64_t from)
587
bool ClientDrizzleProtocol::store(int64_t from)
594
590
return netStoreData((unsigned char*) buff,
595
591
(size_t) (int64_t10_to_str(from, buff, -10) - buff));
598
bool ClientOldLibdrizzle::store(uint64_t from)
594
bool ClientDrizzleProtocol::store(uint64_t from)
601
597
return netStoreData((unsigned char*) buff,
602
598
(size_t) (int64_t10_to_str(from, buff, 10) - buff));
605
bool ClientOldLibdrizzle::store(double from, uint32_t decimals, String *buffer)
601
bool ClientDrizzleProtocol::store(double from, uint32_t decimals, String *buffer)
607
603
buffer->set_real(from, decimals, session->charset());
608
604
return netStoreData((unsigned char*) buffer->ptr(), buffer->length());
611
bool ClientOldLibdrizzle::store(const char *from, size_t length)
607
bool ClientDrizzleProtocol::store(const char *from, size_t length)
613
609
return netStoreData((const unsigned char *)from, length);
616
bool ClientOldLibdrizzle::wasAborted(void)
612
bool ClientDrizzleProtocol::wasAborted(void)
618
614
return net.error && net.vio != 0;
621
bool ClientOldLibdrizzle::haveMoreData(void)
617
bool ClientDrizzleProtocol::haveMoreData(void)
623
619
return drizzleclient_net_more_data(&net);
626
bool ClientOldLibdrizzle::haveError(void)
622
bool ClientDrizzleProtocol::haveError(void)
628
624
return net.error || net.vio == 0;
631
bool ClientOldLibdrizzle::checkConnection(void)
627
bool ClientDrizzleProtocol::checkConnection(void)
633
629
uint32_t pkt_len= 0;
811
807
drizzleclient_net_write(&net, buff, 5);
814
static ListenOldLibdrizzle *listen_obj= NULL;
815
static ListenOldLibdrizzle *listen_obj_mysql= NULL;
810
static ListenDrizzleProtocol *listen_obj= NULL;
817
812
static int init(drizzled::plugin::Registry ®istry)
819
listen_obj= new ListenOldLibdrizzle("oldlibdrizzle", false);
820
listen_obj_mysql= new ListenOldLibdrizzle("oldlibdrizzle_mysql", true);
814
listen_obj= new ListenDrizzleProtocol("drizzle_protocol", false);
821
815
registry.add(listen_obj);
822
registry.add(listen_obj_mysql);
826
819
static int deinit(drizzled::plugin::Registry ®istry)
828
821
registry.remove(listen_obj);
829
registry.remove(listen_obj_mysql);
830
822
delete listen_obj;
831
delete listen_obj_mysql;
837
828
"preference, drizzle.cnf, $DRIZZLE_TCP_PORT, built-in default ("
838
829
STRINGIFY_ARG(DRIZZLE_TCP_PORT) ")."),
839
830
NULL, NULL, 0, 0, 65535, 0);
840
static DRIZZLE_SYSVAR_UINT(mysql_port, mysql_port, PLUGIN_VAR_RQCMDARG,
841
N_("Port number to use for connection or 0 for default to with MySQL "
843
NULL, NULL, 3306, 0, 65535, 0);
844
831
static DRIZZLE_SYSVAR_UINT(connect_timeout, connect_timeout,
845
832
PLUGIN_VAR_RQCMDARG, N_("Connect Timeout."),
846
833
NULL, NULL, 10, 1, 300, 0);