~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/mysql_protocol.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-10 16:48:48 UTC
  • mto: This revision was merged to the branch mainline in revision 2396.
  • Revision ID: olafvdspek@gmail.com-20110810164848-3jlaz2c2xif0lxja
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
  counters.push_back(new drizzled::plugin::ListenCounter(new std::string("failed_connections"), &getCounters().failedConnections));
71
71
}
72
72
 
73
 
const std::string ListenMySQLProtocol::getHost(void) const
 
73
const std::string ListenMySQLProtocol::getHost() const
74
74
{
75
75
  return _hostname;
76
76
}
77
77
 
78
 
in_port_t ListenMySQLProtocol::getPort(void) const
 
78
in_port_t ListenMySQLProtocol::getPort() const
79
79
{
80
80
  return port.get();
81
81
}
219
219
  if (packet_length == 0)                       /* safety */
220
220
  {
221
221
    /* Initialize with COM_SLEEP packet */
222
 
    (*l_packet)[0]= (unsigned char) COM_SLEEP;
 
222
    (*l_packet)[0]= COM_SLEEP;
223
223
    packet_length= 1;
224
224
  }
225
225
  else
258
258
#ifdef NEVER
259
259
  /* See comment above. */
260
260
  /* Restore read timeout value */
261
 
  drizzleclient_net_set_read_timeout(&net,
262
 
                                     session->variables.net_read_timeout);
 
261
  drizzleclient_net_set_read_timeout(&net, session->variables.net_read_timeout);
263
262
#endif
264
263
 
265
264
  return true;
579
578
void ClientMySQLProtocol::store(int32_t from)
580
579
{
581
580
  char buff[12];
582
 
  netStoreData(buff, (internal::int10_to_str(from, buff, -10) - buff));
 
581
  netStoreData(buff, internal::int10_to_str(from, buff, -10) - buff);
583
582
}
584
583
 
585
584
void ClientMySQLProtocol::store(uint32_t from)
586
585
{
587
586
  char buff[11];
588
 
  netStoreData(buff, (size_t) (internal::int10_to_str(from, buff, 10) - buff));
 
587
  netStoreData(buff, internal::int10_to_str(from, buff, 10) - buff);
589
588
}
590
589
 
591
590
void ClientMySQLProtocol::store(int64_t from)
592
591
{
593
592
  char buff[22];
594
 
  netStoreData(buff, (size_t) (internal::int64_t10_to_str(from, buff, -10) - buff));
 
593
  netStoreData(buff, internal::int64_t10_to_str(from, buff, -10) - buff);
595
594
}
596
595
 
597
596
void ClientMySQLProtocol::store(uint64_t from)
598
597
{
599
598
  char buff[21];
600
 
  netStoreData(buff, (size_t) (internal::int64_t10_to_str(from, buff, 10) - buff));
 
599
  netStoreData(buff, internal::int64_t10_to_str(from, buff, 10) - buff);
601
600
}
602
601
 
603
602
void ClientMySQLProtocol::store(double from, uint32_t decimals, String *buffer)
695
694
  packet.alloc(buffer_length.get());
696
695
 
697
696
  client_capabilities= uint2korr(net.read_pos);
698
 
  if (!(client_capabilities & CLIENT_PROTOCOL_MYSQL41))
 
697
  if (not (client_capabilities & CLIENT_PROTOCOL_MYSQL41))
699
698
  {
700
699
    my_error(ER_HANDSHAKE_ERROR, MYF(0), user_identifier->address().c_str());
701
700
    return false;
847
846
 
848
847
unsigned char *ClientMySQLProtocol::storeLength(unsigned char *buffer, uint64_t length)
849
848
{
850
 
  if (length < (uint64_t) 251LL)
 
849
  if (length < 251)
851
850
  {
852
 
    *buffer=(unsigned char) length;
 
851
    *buffer= (unsigned char) length;
853
852
    return buffer+1;
854
853
  }
855
854
  /* 251 is reserved for NULL */
856
 
  if (length < (uint64_t) 65536LL)
 
855
  if (length < 65536)
857
856
  {
858
 
    *buffer++=252;
859
 
    int2store(buffer,(uint32_t) length);
 
857
    *buffer++= 252;
 
858
    int2store(buffer, (uint32_t) length);
860
859
    return buffer+2;
861
860
  }
862
 
  if (length < (uint64_t) 16777216LL)
 
861
  if (length < 16777216)
863
862
  {
864
863
    *buffer++=253;
865
 
    int3store(buffer,(uint32_t) length);
 
864
    int3store(buffer, (uint32_t) length);
866
865
    return buffer+3;
867
866
  }
868
867
  *buffer++=254;
869
 
  int8store(buffer,length);
 
868
  int8store(buffer, length);
870
869
  return buffer+8;
871
870
}
872
871