~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/oldlibdrizzle/oldlibdrizzle.cc

Removed client_capabilities from session and pushed functionality into protocol plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "pack.h"
25
25
#include "errmsg.h"
26
26
#include "oldlibdrizzle.h"
 
27
#include "libdrizzle.h"
27
28
 
28
29
#include <algorithm>
29
30
 
97
98
  return drizzleclient_net_more_data(&net);
98
99
}
99
100
 
100
 
void ProtocolOldLibdrizzle::enableCompression(void)
101
 
{
102
 
  net.compress= true;
103
 
}
104
 
 
105
101
bool ProtocolOldLibdrizzle::isReading(void)
106
102
{
107
103
  return net.reading_or_writing == 1;
164
160
  buff[0]=0;                    // No fields
165
161
  if (session->main_da.status() == Diagnostics_area::DA_OK)
166
162
  {
167
 
    pos=drizzleclient_net_store_length(buff+1,session->main_da.affected_rows());
 
163
    if (client_capabilities & CLIENT_FOUND_ROWS && session->main_da.found_rows())
 
164
      pos=drizzleclient_net_store_length(buff+1,session->main_da.found_rows());
 
165
    else
 
166
      pos=drizzleclient_net_store_length(buff+1,session->main_da.affected_rows());
168
167
    pos=drizzleclient_net_store_length(pos, session->main_da.last_insert_id());
169
168
    int2store(pos, session->main_da.server_status());
170
169
    pos+=2;
762
761
  if (session->packet.alloc(session->variables.net_buffer_length))
763
762
    return false; /* The error is set by alloc(). */
764
763
 
765
 
  session->client_capabilities= uint2korr(net.read_pos);
766
 
 
767
 
 
768
 
  session->client_capabilities|= ((uint32_t) uint2korr(net.read_pos + 2)) << 16;
 
764
  client_capabilities= uint2korr(net.read_pos);
 
765
 
 
766
 
 
767
  client_capabilities|= ((uint32_t) uint2korr(net.read_pos + 2)) << 16;
769
768
  session->max_client_packet_length= uint4korr(net.read_pos + 4);
770
769
  end= (char*) net.read_pos + 32;
771
770
 
773
772
    Disable those bits which are not supported by the server.
774
773
    This is a precautionary measure, if the client lies. See Bug#27944.
775
774
  */
776
 
  session->client_capabilities&= server_capabilites;
 
775
  client_capabilities&= server_capabilites;
777
776
 
778
777
  if (end >= (char*) net.read_pos + pkt_len + 2)
779
778
  {
798
797
    Cast *passwd to an unsigned char, so that it doesn't extend the sign for
799
798
    *passwd > 127 and become 2**32-127+ after casting to uint.
800
799
  */
801
 
  uint32_t passwd_len= session->client_capabilities & CLIENT_SECURE_CONNECTION ?
 
800
  uint32_t passwd_len= client_capabilities & CLIENT_SECURE_CONNECTION ?
802
801
    (unsigned char)(*passwd++) : strlen(passwd);
803
 
  l_db= session->client_capabilities & CLIENT_CONNECT_WITH_DB ? l_db + passwd_len + 1 : 0;
 
802
  l_db= client_capabilities & CLIENT_CONNECT_WITH_DB ? l_db + passwd_len + 1 : 0;
804
803
 
805
804
  /* strlen() can't be easily deleted without changing protocol */
806
805
  uint32_t db_len= l_db ? strlen(l_db) : 0;