~drizzle-trunk/drizzle/development

1860.2.17 by Stewart Smith
add missing 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
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
19
#include <config.h>
1860.2.17 by Stewart Smith
add missing engine_states.cc
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()"));
1947.1.7 by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called
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
2170.6.1 by Stewart Smith
support Cursor::scan_time() in storage_engine_api_tester
48
  states.insert(state_pair("::max_supported_key_parts()", "::max_supported_key_parts()"));
1947.1.7 by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called
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
1860.2.17 by Stewart Smith
add missing engine_states.cc
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"));
1947.1.1 by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements.
58
  states.insert(state_pair("BEGIN", "In Transaction"));
59
  states.insert(state_pair("In Transaction", "START STATEMENT"));
1860.2.17 by Stewart Smith
add missing engine_states.cc
60
61
  /* really a bug */
1947.1.1 by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements.
62
  states.insert(state_pair("In Transaction", "END STATEMENT"));
1860.2.17 by Stewart Smith
add missing engine_states.cc
63
  /* also a bug */
64
  states.insert(state_pair("::SEAPITester()", "COMMIT"));
65
1947.1.1 by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements.
66
  states.insert(state_pair("In Transaction", "COMMIT"));
67
  states.insert(state_pair("In Transaction", "ROLLBACK"));
1860.2.17 by Stewart Smith
add missing engine_states.cc
68
  states.insert(state_pair("START STATEMENT", "END STATEMENT"));
1947.1.1 by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements.
69
  states.insert(state_pair("START STATEMENT", "ROLLBACK STATEMENT"));
70
  states.insert(state_pair("ROLLBACK STATEMENT", "In Transaction"));
1860.2.17 by Stewart Smith
add missing engine_states.cc
71
  states.insert(state_pair("END STATEMENT", "START STATEMENT"));
1947.1.1 by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements.
72
  states.insert(state_pair("END STATEMENT", "COMMIT STATEMENT"));
73
  states.insert(state_pair("COMMIT STATEMENT", "In Transaction"));
1860.2.17 by Stewart Smith
add missing engine_states.cc
74
  states.insert(state_pair("END STATEMENT", "COMMIT"));
75
  states.insert(state_pair("END STATEMENT", "ROLLBACK"));
1947.1.11 by Stewart Smith
because of fixing SEAPITester rollback statement/txn, we need to have the extra Engine state transition of end statemnet -> rollback stmt
76
  states.insert(state_pair("END STATEMENT", "ROLLBACK STATEMENT"));
1860.2.17 by Stewart Smith
add missing engine_states.cc
77
1947.1.23 by Stewart Smith
fix up savepoint states in SEAPITester
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"));
1947.1.20 by Stewart Smith
start a test for SEAPITester for savepoints. Taking David's small test case r.e. txn log and savepoints and adding engine_state transitions for savepoints. Currently, from looking at the log you can see that the calls are never made to the engine and the test case fails (because the savepoint wasn't created
82
  states.insert(state_pair("ROLLBACK TO SAVEPOINT", "BEGIN"));
83
  states.insert(state_pair("RELEASE SAVEPOINT", "BEGIN"));
84
1860.2.17 by Stewart Smith
add missing engine_states.cc
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
}