~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/shutdown_function/shutdown.cc

Merge Revision revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Merge from mysql-5.1-innodb:

Post-merge fixes: Remove the MYSQL_VERSION_ID checks, because they only
apply to the InnoDB Plugin. Fix potential race condition accessing
trx->op_info and trx->detailed_error.
------------------------------------------------------------
revno: 3466
revision-id: marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
parent: marko.makela@oracle.com-20100514130228-n3n42nw7ht78k0wn
committer: Marko Mkel <marko.makela@oracle.com>
branch nick: mysql-5.1-innodb2
timestamp: Fri 2010-05-14 16:08:15 +0300
message:
  Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
  Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

  This fixes the bugs in the InnoDB Plugin.

  ha_innodb.h: Use trx_query_string() instead of trx_query() when
  available (MySQL 5.1.42 or later).

  innobase_get_stmt(): New function, to retrieve the currently running
  SQL statement.

  struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead.

  dict_strip_comments(): Add and observe the parameter sql_length. Treat
  /*/ as the start of a comment.

  dict_create_foreign_constraints(), row_table_add_foreign_constraints():
  Add the parameter sql_length.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2010 Brian Aker
 
5
 */
 
6
 
 
7
#include "config.h"
 
8
 
 
9
#include <signal.h>
 
10
#include <drizzled/session.h>
 
11
#include <drizzled/function/str/strfunc.h>
 
12
 
 
13
using namespace drizzled;
 
14
 
 
15
#define SHUTDOWN_MESSAGE "Beginning shutdown"
 
16
 
 
17
class Shutdown :public Item_str_func
 
18
{
 
19
public:
 
20
  Shutdown() :
 
21
    Item_str_func()
 
22
  { }
 
23
 
 
24
 
 
25
  void fix_length_and_dec()
 
26
  {
 
27
    max_length= sizeof(SHUTDOWN_MESSAGE) * system_charset_info->mbmaxlen;
 
28
    maybe_null= true;
 
29
  }
 
30
  const char *func_name() const { return "shutdown"; }
 
31
  const char *fully_qualified_func_name() const { return "shutdown()"; }
 
32
 
 
33
  String *val_str(String *str)
 
34
  {
 
35
    kill_drizzle();
 
36
 
 
37
    str->copy(SHUTDOWN_MESSAGE, sizeof(SHUTDOWN_MESSAGE) -1, system_charset_info);
 
38
 
 
39
    return str;
 
40
  }
 
41
};
 
42
 
 
43
static int initialize(drizzled::module::Context &context)
 
44
{
 
45
  context.add(new plugin::Create_function<Shutdown>("shutdown"));
 
46
  return 0;
 
47
}
 
48
 
 
49
DRIZZLE_DECLARE_PLUGIN
 
50
{
 
51
  DRIZZLE_VERSION_ID,
 
52
  "shutdown",
 
53
  "1.0",
 
54
  "Brian Aker",
 
55
  "Cause the database to shutdown.",
 
56
  PLUGIN_LICENSE_BSD,
 
57
  initialize, /* Plugin Init */
 
58
  NULL,   /* system variables */
 
59
  NULL    /* config options */
 
60
}
 
61
DRIZZLE_DECLARE_PLUGIN_END;