1
/* Copyright (C) 2000-2003 MySQL AB
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.
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.
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 */
16
#ifndef DRIZZLE_SERVER_OBJECT_CREATION_CTX_H
17
#define DRIZZLE_SERVER_OBJECT_CREATION_CTX_H
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.
25
class Object_creation_ctx
28
Object_creation_ctx *set_n_backup(THD *thd);
30
void restore_env(THD *thd, Object_creation_ctx *backup_ctx);
33
Object_creation_ctx() {}
34
virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0;
36
virtual void change_env(THD *thd) const = 0;
39
virtual ~Object_creation_ctx()
43
/*************************************************************************/
46
Default_object_creation_ctx -- default implementation of
50
class Default_object_creation_ctx : public Object_creation_ctx
53
CHARSET_INFO *get_client_cs()
58
CHARSET_INFO *get_connection_cl()
60
return m_connection_cl;
64
Default_object_creation_ctx(THD *thd);
66
Default_object_creation_ctx(CHARSET_INFO *client_cs,
67
CHARSET_INFO *connection_cl);
70
virtual Object_creation_ctx *create_backup_ctx(THD *thd) const;
72
virtual void change_env(THD *thd) const;
76
client_cs stores the value of character_set_client session variable.
77
The only character set attribute is used.
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
84
CHARSET_INFO *m_client_cs;
87
connection_cl stores the value of collation_connection session
88
variable. Both character set and collation attributes are used.
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).
94
CHARSET_INFO *m_connection_cl;
97
#endif /* DRIZZLE_SERVER_OBJECT_CREATION_CTX_H */