Drizzled Public API Documentation

engine_states.cc
1 /*
2  Copyright (C) 2010 Stewart Smith
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License
6  as published by the Free Software Foundation; either version 2
7  of the License, or (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #include <config.h>
20 #include <string>
21 #include <map>
22 #include <boost/unordered_map.hpp>
23 
24 using namespace std;
25 
26 typedef multimap<string, string> state_multimap;
27 typedef multimap<string, string>::value_type state_pair;
28 typedef multimap<string, string>::iterator state_multimap_iter;
29 void load_engine_state_transitions(state_multimap &states);
30 
31 void load_engine_state_transitions(state_multimap &states)
32 {
33  states.insert(state_pair("INIT", "::SEAPITester()"));
34  states.insert(state_pair("::SEAPITester()", "::~SEAPITester()"));
35  states.insert(state_pair("::SEAPITester()", "::max_supported_key_length()"));
36  states.insert(state_pair("::max_supported_key_length()", "::max_supported_keys()"));
37  states.insert(state_pair("::max_supported_key_length()", "::max_supported_key_parts()"));
38  states.insert(state_pair("::max_supported_keys()", "::doCreateTable()"));
39 
40  states.insert(state_pair("::max_supported_keys()", "::max_supported_key_part_length()"));
41 
42  // what the
43  states.insert(state_pair("::max_supported_keys()", "END STATEMENT"));
44 
45  states.insert(state_pair("::max_supported_key_part_length()", "::max_supported_key_part_length()"));
46  states.insert(state_pair("::max_supported_key_part_length()", "::doCreateTable()"));
47 
48  states.insert(state_pair("::max_supported_key_parts()", "::max_supported_key_parts()"));
49  states.insert(state_pair("::max_supported_key_parts()", "::max_supported_keys()"));
50 
51  // what the
52  states.insert(state_pair("START STATEMENT", "::max_supported_key_length()"));
53 
54  states.insert(state_pair("::doCreateTable()", "::SEAPITester()"));
55 /* states.insert(state_pair("::SEAPITester()", "::create()"));
56  states.insert(state_pair("::create()", "::SEAPITester()"));*/
57  states.insert(state_pair("::SEAPITester()", "BEGIN"));
58  states.insert(state_pair("BEGIN", "In Transaction"));
59  states.insert(state_pair("In Transaction", "START STATEMENT"));
60 
61  /* really a bug */
62  states.insert(state_pair("In Transaction", "END STATEMENT"));
63  /* also a bug */
64  states.insert(state_pair("::SEAPITester()", "COMMIT"));
65 
66  states.insert(state_pair("In Transaction", "COMMIT"));
67  states.insert(state_pair("In Transaction", "ROLLBACK"));
68  states.insert(state_pair("START STATEMENT", "END STATEMENT"));
69  states.insert(state_pair("START STATEMENT", "ROLLBACK STATEMENT"));
70  states.insert(state_pair("ROLLBACK STATEMENT", "In Transaction"));
71  states.insert(state_pair("END STATEMENT", "START STATEMENT"));
72  states.insert(state_pair("END STATEMENT", "COMMIT STATEMENT"));
73  states.insert(state_pair("COMMIT STATEMENT", "In Transaction"));
74  states.insert(state_pair("END STATEMENT", "COMMIT"));
75  states.insert(state_pair("END STATEMENT", "ROLLBACK"));
76  states.insert(state_pair("END STATEMENT", "ROLLBACK STATEMENT"));
77 
78  states.insert(state_pair("In Transaction", "SET SAVEPOINT"));
79  states.insert(state_pair("In Transaction", "ROLLBACK TO SAVEPOINT"));
80  states.insert(state_pair("In Transaction", "RELEASE SAVEPOINT"));
81  states.insert(state_pair("SET SAVEPOINT", "In Transaction"));
82  states.insert(state_pair("ROLLBACK TO SAVEPOINT", "BEGIN"));
83  states.insert(state_pair("RELEASE SAVEPOINT", "BEGIN"));
84 
85  states.insert(state_pair("COMMIT", "::SEAPITester()"));
86  states.insert(state_pair("ROLLBACK", "::SEAPITester()"));
87  states.insert(state_pair("::SEAPITester()", "::doGetTableDefinition()"));
88  states.insert(state_pair("::doGetTableDefinition()", "::SEAPITester()"));
89 
90  /* below just for autocommit statement. doesn't seem right to me */
91  states.insert(state_pair("::SEAPITester()", "START STATEMENT"));
92 }