1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_TABLEOP_HOOKS_H
21
#define DRIZZLED_TABLEOP_HOOKS_H
28
Class for maintaining hooks used inside operations on tables such
29
as: create table functions, delete table functions, and alter table
32
Class is using the Template Method pattern to separate the public
33
usage interface from the private inheritance interface. This
34
imposes no overhead, since the public non-virtual function is small
37
The hooks are usually used for functions that does several things,
38
e.g., create_table_from_items(), which both create a table and lock
45
virtual ~Tableop_hooks() {}
47
inline void prelock(Table **tables, uint32_t count)
49
do_prelock(tables, count);
52
inline int postlock(Table **tables, uint32_t count)
54
return do_postlock(tables, count);
58
/* Function primitive that is called prior to locking tables */
59
virtual void do_prelock(Table **tables, uint32_t count);
62
Primitive called after tables are locked.
64
If an error is returned, the tables will be unlocked and error
67
@return Error code or zero.
69
virtual int do_postlock(Table **tables, uint32_t count);
73
#endif /* DRIZZLED_TABLEOP_HOOKS_H */