~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/main.cc

  • Committer: lbieber
  • Date: 2010-09-26 03:23:39 UTC
  • mfrom: (1793.1.1 build)
  • Revision ID: lbieber@orisndriz08-20100926032339-59p5xxhkloa09759
Merge Monty - Beginning of catalog support, adds a default local catalog. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <signal.h>
24
24
#include <sys/resource.h>
25
25
#include <unistd.h>
 
26
#include <sys/stat.h>
 
27
#include <sys/types.h>
 
28
 
26
29
 
27
30
#if TIME_WITH_SYS_TIME
28
31
# include <sys/time.h>
39
42
# include <locale.h>
40
43
#endif
41
44
 
 
45
#include <boost/filesystem.hpp>
42
46
 
43
47
#include "drizzled/plugin.h"
44
48
#include "drizzled/gettext.h"
58
62
 
59
63
using namespace drizzled;
60
64
using namespace std;
 
65
namespace fs=boost::filesystem;
61
66
 
62
67
static pthread_t select_thread;
63
68
static uint32_t thr_kill_signal;
64
69
 
 
70
 
65
71
/**
66
72
  All global error messages are sent here where the first one is stored
67
73
  for the client.
241
247
  select_thread=pthread_self();
242
248
  select_thread_in_use=1;
243
249
 
244
 
  if (chdir(data_home_real) && !opt_help)
 
250
  if (not opt_help)
245
251
  {
246
 
    errmsg_printf(ERRMSG_LVL_ERROR, _("Data directory %s does not exist\n"), data_home_real);
247
 
    unireg_abort(1);
 
252
    if (chdir(getDataHome().c_str()))
 
253
    {
 
254
      errmsg_printf(ERRMSG_LVL_ERROR,
 
255
                    _("Data directory %s does not exist\n"),
 
256
                    getDataHome().c_str());
 
257
      unireg_abort(1);
 
258
    }
 
259
    if (mkdir("local", 0700))
 
260
    {
 
261
      /* We don't actually care */
 
262
    }
 
263
    if (chdir("local"))
 
264
    {
 
265
      errmsg_printf(ERRMSG_LVL_ERROR,
 
266
                    _("Local catalog %s/local does not exist\n"),
 
267
                    getDataHome().c_str());
 
268
      unireg_abort(1);
 
269
    }
 
270
    /* TODO: This is a hack until we can properly support std::string in sys_var*/
 
271
    char **data_home_ptr= getDatadirPtr();
 
272
    *data_home_ptr= new char[getDataHome().size()+1] ();
 
273
    fs::path full_data_home_path(fs::system_complete(fs::path(getDataHome())));
 
274
    std::string full_data_home(full_data_home_path.file_string());
 
275
    memcpy(*data_home_ptr, full_data_home.c_str(), full_data_home.size());
 
276
    getDataHomeCatalog()= "./";
 
277
    getDataHome()= "../";
248
278
  }
249
 
  data_home= data_home_buff;
250
 
  data_home[0]=FN_CURLIB;               // all paths are relative from here
251
 
  data_home[1]=0;
252
 
  data_home_len= 2;
 
279
 
 
280
 
253
281
 
254
282
  if (server_id == 0)
255
283
  {