~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/console/console.cc

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
 
#include "config.h"
 
16
#include <config.h>
 
17
#include <drizzled/field.h>
17
18
#include <drizzled/gettext.h>
18
19
#include <drizzled/plugin/listen_tcp.h>
19
20
#include <drizzled/plugin/client.h>
20
21
#include <drizzled/session.h>
21
22
#include <drizzled/module/option_map.h>
22
 
 
23
23
#include <drizzled/plugin/catalog.h>
 
24
#include <drizzled/plugin.h>
24
25
 
25
26
#include <iostream>
26
27
 
115
116
  virtual bool authenticate(void)
116
117
  {
117
118
    printDebug("authenticate");
118
 
    identifier::User::shared_ptr user= identifier::User::make_shared();
 
119
    identifier::user::mptr user= identifier::User::make_shared();
119
120
    user->setUser(username);
120
121
    session->setUser(user);
121
122
 
187
188
 
188
189
  virtual bool sendFields(List<Item> *list)
189
190
  {
190
 
    List_iterator_fast<Item> it(*list);
 
191
    List<Item>::iterator it(list->begin());
191
192
    Item *item;
192
193
 
193
194
    column= 0;
292
293
    return false;
293
294
  }
294
295
 
295
 
  bool isConsole()
 
296
  bool isConsole() const
 
297
  {
 
298
    return true;
 
299
  }
 
300
 
 
301
  bool isInteractive() const
296
302
  {
297
303
    return true;
298
304
  }
361
367
static int init(drizzled::module::Context &context)
362
368
{
363
369
  const module::option_map &vm= context.getOptions();
364
 
  const string username(vm.count("username") ? vm["username"].as<string>() : "");
365
 
  const string password(vm.count("password") ? vm["password"].as<string>() : "");
366
 
  const string schema(vm.count("schema") ? vm["schema"].as<string>() : "");
367
 
 
368
 
  const std::string catalog(vm.count("catalog") ? vm["catalog"].as<string>() : "LOCAL");
369
 
 
370
 
  context.add(new ListenConsole("console", username, password, schema, catalog));
371
 
 
 
370
  context.add(new ListenConsole("console", vm["username"].as<string>(), 
 
371
    vm["password"].as<string>(), vm["schema"].as<string>(), vm["catalog"].as<string>()));
372
372
  return 0;
373
373
}
374
374
 
381
381
          po::value<bool>(&debug_enabled)->default_value(false)->zero_tokens(),
382
382
          N_("Turn on extra debugging."));
383
383
  context("username",
384
 
          po::value<string>(),
 
384
          po::value<string>()->default_value(""),
385
385
          N_("User to use for auth."));
386
386
  context("password",
387
 
          po::value<string>(),
 
387
          po::value<string>()->default_value(""),
388
388
          N_("Password to use for auth."));
389
389
  context("catalog",
390
 
          po::value<string>(),
 
390
          po::value<string>()->default_value("LOCAL"),
391
391
          N_("Default catalog to use."));
392
392
  context("schema",
393
 
          po::value<string>(),
 
393
          po::value<string>()->default_value(""),
394
394
          N_("Default schema to use."));
395
395
}
396
396