MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mock_create_field.h
1 /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
15 
16 #ifndef MOCK_CREATE_FIELD_H
17 #define MOCK_CREATE_FIELD_H
18 
19 #include "field.h"
20 
22 {
23  LEX_STRING m_lex_string;
24 public:
25  Mock_create_field(enum_field_types field_type,
26  Item* insert_default, Item* update_default)
27  {
28  /*
29  Only TIMESTAMP is implemented for now.
30  Other types would need different parameters (fld_length, etc).
31  */
32  DBUG_ASSERT(field_type == MYSQL_TYPE_TIMESTAMP ||
33  field_type == MYSQL_TYPE_TIMESTAMP2);
34  init(NULL, // THD *thd
35  NULL, // char *fld_name
36  field_type,
37  NULL, // char *fld_length
38  NULL, // char *fld_decimals,
39  0, // uint fld_type_modifier
40  insert_default, // Item *fld_default_value,
41  update_default, // Item *fld_on_update_value,
42  /*
43  Pointer can't be NULL, or Create_field::init() will
44  core dump. This is undocumented, of
45  course. </sarcasm>
46  */
47  &m_lex_string, // LEX_STRING *fld_comment,
48  NULL, // char *fld_change,
49  NULL, // List<String> *fld_interval_list,
50  NULL, // const CHARSET_INFO *fld_charset,
51  0 // uint fld_geom_type
52  );
53  }
54 };
55 
56 #endif // MOCK_CREATE_FIELD_H