~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/object_creation_ctx.h

  • Committer: Brian Aker
  • Date: 2008-08-01 18:16:56 UTC
  • mfrom: (243.1.8 cleanup-mysql-priv)
  • Revision ID: brian@tangent.org-20080801181656-sut492wazlvp9glh
Merge from Jay.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000-2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef DRIZZLE_SERVER_OBJECT_CREATION_CTX_H
 
17
#define DRIZZLE_SERVER_OBJECT_CREATION_CTX_H
 
18
 
 
19
/**
 
20
 Object_creation_ctx -- interface for creation context of database objects
 
21
 (views, stored routines, events, triggers). Creation context -- is a set
 
22
 of attributes, that should be fixed at the creation time and then be used
 
23
 each time the object is parsed or executed.
 
24
*/
 
25
class Object_creation_ctx
 
26
{
 
27
public:
 
28
  Object_creation_ctx *set_n_backup(THD *thd);
 
29
 
 
30
  void restore_env(THD *thd, Object_creation_ctx *backup_ctx);
 
31
 
 
32
protected:
 
33
  Object_creation_ctx() {}
 
34
  virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0;
 
35
 
 
36
  virtual void change_env(THD *thd) const = 0;
 
37
 
 
38
public:
 
39
  virtual ~Object_creation_ctx()
 
40
  { }
 
41
};
 
42
 
 
43
/*************************************************************************/
 
44
 
 
45
/**
 
46
 Default_object_creation_ctx -- default implementation of
 
47
 Object_creation_ctx.
 
48
*/
 
49
 
 
50
class Default_object_creation_ctx : public Object_creation_ctx
 
51
{
 
52
public:
 
53
  CHARSET_INFO *get_client_cs()
 
54
  {
 
55
    return m_client_cs;
 
56
  }
 
57
 
 
58
  CHARSET_INFO *get_connection_cl()
 
59
  {
 
60
    return m_connection_cl;
 
61
  }
 
62
 
 
63
protected:
 
64
  Default_object_creation_ctx(THD *thd);
 
65
 
 
66
  Default_object_creation_ctx(CHARSET_INFO *client_cs,
 
67
                              CHARSET_INFO *connection_cl);
 
68
 
 
69
protected:
 
70
  virtual Object_creation_ctx *create_backup_ctx(THD *thd) const;
 
71
 
 
72
  virtual void change_env(THD *thd) const;
 
73
 
 
74
protected:
 
75
  /**
 
76
    client_cs stores the value of character_set_client session variable.
 
77
    The only character set attribute is used.
 
78
 
 
79
    Client character set is included into query context, because we save
 
80
    query in the original character set, which is client character set. So,
 
81
    in order to parse the query properly we have to switch client character
 
82
    set on parsing.
 
83
  */
 
84
  CHARSET_INFO *m_client_cs;
 
85
 
 
86
  /**
 
87
    connection_cl stores the value of collation_connection session
 
88
    variable. Both character set and collation attributes are used.
 
89
 
 
90
    Connection collation is included into query context, becase it defines
 
91
    the character set and collation of text literals in internal
 
92
    representation of query (item-objects).
 
93
  */
 
94
  CHARSET_INFO *m_connection_cl;
 
95
};
 
96
 
 
97
#endif /* DRIZZLE_SERVER_OBJECT_CREATION_CTX_H */