~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/drizzle_protocol/drizzle_protocol.cc

  • Committer: Prafulla Tekawade
  • Date: 2010-06-30 16:55:32 UTC
  • mto: (1643.1.3 build) (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1644.
  • Revision ID: prafulla_t@users.sourceforge.net-20100630165532-3og7y5biaqrsqg4s
Reverting the fix for 592473

I checked with mysql source code.
In Join::Optimize code, whenever where condition is optimized, number of
tables to be read this->table needs to be set to zero. This avoided
later code to go over join->join_tab and creating problem such as the bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "drizzled/internal/my_sys.h"
27
27
#include "drizzled/internal/m_string.h"
28
28
#include <algorithm>
29
 
#include <iostream>
30
 
#include <boost/program_options.hpp>
31
 
#include <drizzled/module/option_map.h>
 
29
 
32
30
#include "pack.h"
33
31
#include "errmsg.h"
34
32
#include "drizzle_protocol.h"
40
38
{
41
39
extern uint32_t global_thread_id;
42
40
}
43
 
namespace po= boost::program_options;
 
41
 
44
42
using namespace drizzled;
45
43
using namespace std;
46
44
 
814
812
  drizzleclient_net_write(&net, buff, 5);
815
813
}
816
814
 
 
815
static ListenDrizzleProtocol *listen_obj= NULL;
 
816
 
817
817
static int init(module::Context &context)
818
818
{
819
 
  const module::option_map &vm= context.getOptions();
820
 
  if (vm.count("port"))
821
 
  { 
822
 
    if (port > 65535)
823
 
    {
824
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of port\n"));
825
 
      exit(-1);
826
 
    }
827
 
  }
828
 
 
829
 
  if (vm.count("connect-timeout"))
830
 
  {
831
 
    if (connect_timeout < 1 || connect_timeout > 300)
832
 
    {
833
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for connect_timeout\n"));
834
 
      exit(-1);
835
 
    }
836
 
  }
837
 
 
838
 
  if (vm.count("read-timeout"))
839
 
  {
840
 
    if (read_timeout < 1 || read_timeout > 300)
841
 
    {
842
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read_timeout\n"));
843
 
      exit(-1);
844
 
    }
845
 
  }
846
 
 
847
 
  if (vm.count("write-timeout"))
848
 
  {
849
 
    if (write_timeout < 1 || write_timeout > 300)
850
 
    {
851
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for write_timeout\n"));
852
 
      exit(-1);
853
 
    }
854
 
  }
855
 
 
856
 
  if (vm.count("retry-count"))
857
 
  {
858
 
    if (retry_count < 1 || retry_count > 100)
859
 
    {
860
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for retry_count\n"));
861
 
      exit(-1);
862
 
    }
863
 
  }
864
 
 
865
 
  if (vm.count("buffer-length"))
866
 
  {
867
 
    if (buffer_length < 1024 || buffer_length > 1024*1024)
868
 
    {
869
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer_length\n"));
870
 
      exit(-1);
871
 
    }
872
 
  }
873
 
 
874
 
  if (vm.count("bind-address"))
875
 
  {
876
 
    bind_address= strdup(vm["bind-address"].as<string>().c_str());
877
 
  }
878
 
 
879
 
  else
880
 
  {
881
 
    bind_address= NULL;
882
 
  }
883
 
  
884
 
  context.add(new ListenDrizzleProtocol("drizzle_protocol", false)); 
 
819
  listen_obj= new ListenDrizzleProtocol("drizzle_protocol", false);
 
820
  context.add(listen_obj); 
885
821
  return 0;
886
822
}
887
823
 
906
842
static DRIZZLE_SYSVAR_STR(bind_address, bind_address, PLUGIN_VAR_READONLY,
907
843
                          N_("Address to bind to."), NULL, NULL, NULL);
908
844
 
909
 
static void init_options(drizzled::module::option_context &context)
910
 
{
911
 
  context("port",
912
 
          po::value<uint32_t>(&port)->default_value(0),
913
 
          N_("Port number to use for connection or 0 for "
914
 
                              "default to, in order of "
915
 
                              "preference, drizzle.cnf, $DRIZZLE_TCP_PORT, "
916
 
                              "built-in default (4427)."));
917
 
  context("connect-timeout",
918
 
          po::value<uint32_t>(&connect_timeout)->default_value(10),
919
 
          N_("Connect Timeout."));
920
 
  context("read-timeout",
921
 
          po::value<uint32_t>(&read_timeout)->default_value(30),
922
 
          N_("Read Timeout."));
923
 
  context("write-timeout",
924
 
          po::value<uint32_t>(&write_timeout)->default_value(60),
925
 
          N_("Write Timeout."));
926
 
  context("retry-count",
927
 
          po::value<uint32_t>(&retry_count)->default_value(10),
928
 
          N_("Retry Count."));
929
 
  context("buffer-length",
930
 
          po::value<uint32_t>(&buffer_length)->default_value(16384),
931
 
          N_("Buffer length."));
932
 
  context("bind-address",
933
 
          po::value<string>(),
934
 
          N_("Address to bind to."));
935
 
}
936
 
 
937
845
static drizzle_sys_var* sys_variables[]= {
938
846
  DRIZZLE_SYSVAR(port),
939
847
  DRIZZLE_SYSVAR(connect_timeout),
947
855
 
948
856
} /* namespace drizzle_protocol */
949
857
 
950
 
DRIZZLE_PLUGIN(drizzle_protocol::init, drizzle_protocol::sys_variables, drizzle_protocol::init_options);
 
858
DRIZZLE_PLUGIN(drizzle_protocol::init, drizzle_protocol::sys_variables);