~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/archive_reader.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (c) 2006 MySQL AB
5
 
 *  Copyright (c) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2006 MySQL AB
 
5
 *  Copyright (C) 2009 Sun Microsystems, Inc.
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
8
8
 *  it under the terms of the GNU General Public License as published by
25
25
#include <drizzled/configmake.h>
26
26
using namespace std;
27
27
#include <boost/program_options.hpp>
 
28
#include <boost/scoped_ptr.hpp>
28
29
namespace po= boost::program_options;
29
30
#include "azio.h"
30
31
#include <string.h>
32
33
#include <stdio.h>
33
34
#include <stdarg.h>
34
35
#include <fcntl.h>
 
36
#include <memory>
35
37
#include "drizzled/charset_info.h"
36
38
#include "drizzled/internal/m_string.h"
37
39
 
85
87
  ;
86
88
 
87
89
  unsigned int ret;
88
 
  azio_stream reader_handle;
 
90
  boost::scoped_ptr<azio_stream> reader_handle_ap(new azio_stream);
 
91
  azio_stream &reader_handle= *reader_handle_ap.get();
89
92
 
90
93
  std::string system_config_dir_archive_reader(SYSCONFDIR); 
91
94
  system_config_dir_archive_reader.append("/drizzle/archive_reader.cnf");
92
95
 
93
96
  std::string user_config_dir((getenv("XDG_CONFIG_HOME")? getenv("XDG_CONFIG_HOME"):"~/.config"));
 
97
 
 
98
  if (user_config_dir.compare(0, 2, "~/") == 0)
 
99
  {
 
100
    char *homedir;
 
101
    homedir= getenv("HOME");
 
102
    if (homedir != NULL)
 
103
      user_config_dir.replace(0, 1, homedir);
 
104
  }
94
105
  
95
106
  po::options_description long_options("Allowed Options");
96
107
  long_options.add(commandline_options).add(archive_reader_options);
155
166
 
156
167
  if (opt_autoincrement)
157
168
  {
158
 
    azio_stream writer_handle;
 
169
    boost::scoped_ptr<azio_stream> writer_handle_ap(new azio_stream);
 
170
    azio_stream &writer_handle= *writer_handle_ap.get();
159
171
 
160
172
    if (new_auto_increment_value)
161
173
    {
252
264
    uint64_t row_count= 0;
253
265
    char *buffer;
254
266
 
255
 
    azio_stream writer_handle;
 
267
    boost::scoped_ptr<azio_stream> writer_handle_ap(new azio_stream);
 
268
    azio_stream &writer_handle= *writer_handle_ap.get();
256
269
 
257
270
    buffer= (char *)malloc(reader_handle.longest_row);
258
271
    if (buffer == NULL)