~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/oldlibdrizzle/oldlibdrizzle.cc

  • Committer: devananda
  • Date: 2009-06-30 14:27:54 UTC
  • mfrom: (1030.2.4 trunk)
  • mto: (1093.1.7 captain)
  • mto: This revision was merged to the branch mainline in revision 1095.
  • Revision ID: devananda.vdv@gmail.com-20090630142754-vm9w374yxkf1pikc
mergeĀ fromĀ lp

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 */
19
19
 
20
 
/**
21
 
  @file
22
 
 
23
 
  Low level functions for storing data to be send to the MySQL client.
24
 
  The actual communction is handled by the net_xxx functions in net_serv.cc
25
 
*/
26
 
 
27
20
#include <drizzled/server_includes.h>
28
21
#include <drizzled/error.h>
29
22
#include <drizzled/sql_state.h>
30
 
#include <drizzled/protocol.h>
31
23
#include <drizzled/session.h>
32
24
#include <drizzled/data_home.h>
33
25
#include "pack.h"
34
26
#include "errmsg.h"
35
27
#include "oldlibdrizzle.h"
36
28
 
37
 
/*
38
 
  Function called by drizzleclient_net_init() to set some check variables
39
 
*/
 
29
#define PROTOCOL_VERSION 10
 
30
 
 
31
extern uint32_t drizzled_tcp_port;
40
32
 
41
33
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
 
34
static uint32_t _port= 0;
 
35
 
 
36
ListenOldLibdrizzle::ListenOldLibdrizzle()
 
37
{
 
38
  port= (in_port_t) _port;
 
39
}
 
40
 
 
41
in_port_t ListenOldLibdrizzle::getPort(void) const
 
42
{
 
43
  if (port == 0)
 
44
    return (in_port_t ) drizzled_tcp_port;
 
45
 
 
46
  return port;
 
47
}
 
48
 
 
49
Protocol *ListenOldLibdrizzle::protocolFactory(void) const
 
50
{
 
51
  return new ProtocolOldLibdrizzle;
 
52
}
42
53
 
43
54
static void write_eof_packet(Session *session, NET *net,
44
55
                             uint32_t server_status, uint32_t total_warn_count);
301
312
  net.vio= 0;
302
313
}
303
314
 
 
315
ProtocolOldLibdrizzle::~ProtocolOldLibdrizzle()
 
316
{
 
317
  if (net.vio)
 
318
    drizzleclient_vio_close(net.vio);
 
319
}
 
320
 
304
321
void ProtocolOldLibdrizzle::setSession(Session *session_arg)
305
322
{
306
323
  session= session_arg;
727
744
 
728
745
    /* At this point we write connection message and read reply */
729
746
    if (drizzleclient_net_write_command(&net
730
 
          , (unsigned char) protocol_version
 
747
          , (unsigned char) PROTOCOL_VERSION
731
748
          , (unsigned char*) ""
732
749
          , 0
733
750
          , (unsigned char*) buff
804
821
  return session->checkUser(passwd, passwd_len, l_db);
805
822
}
806
823
 
807
 
static ProtocolFactoryOldLibdrizzle *factory= NULL;
 
824
static ListenOldLibdrizzle listen_obj;
808
825
 
809
826
static int init(PluginRegistry &registry)
810
827
{
811
 
  factory= new ProtocolFactoryOldLibdrizzle;
812
 
  registry.add(factory); 
 
828
  registry.add(listen_obj); 
813
829
  return 0;
814
830
}
815
831
 
816
832
static int deinit(PluginRegistry &registry)
817
833
{
818
 
  if (factory)
819
 
  {
820
 
    registry.remove(factory);
821
 
    delete factory;
822
 
  }
 
834
  registry.remove(listen_obj);
823
835
  return 0;
824
836
}
825
837