Drizzled Public API Documentation

engine_states.cc

00001 /*
00002   Copyright (C) 2010 Stewart Smith
00003 
00004   This program is free software; you can redistribute it and/or
00005   modify it under the terms of the GNU General Public License
00006   as published by the Free Software Foundation; either version 2
00007   of the License, or (at your option) any later version.
00008 
00009   This program is distributed in the hope that it will be useful,
00010   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012   GNU General Public License for more details.
00013 
00014   You should have received a copy of the GNU General Public License
00015   along with this program; if not, write to the Free Software
00016   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017 */
00018 
00019 #include <config.h>
00020 #include <string>
00021 #include <map>
00022 #include <boost/unordered_map.hpp>
00023 
00024 using namespace std;
00025 
00026 typedef multimap<string, string> state_multimap;
00027 typedef multimap<string, string>::value_type state_pair;
00028 typedef multimap<string, string>::iterator state_multimap_iter;
00029 void load_engine_state_transitions(state_multimap &states);
00030 
00031 void load_engine_state_transitions(state_multimap &states)
00032 {
00033   states.insert(state_pair("INIT", "::SEAPITester()"));
00034   states.insert(state_pair("::SEAPITester()", "::~SEAPITester()"));
00035   states.insert(state_pair("::SEAPITester()", "::max_supported_key_length()"));
00036   states.insert(state_pair("::max_supported_key_length()", "::max_supported_keys()"));
00037   states.insert(state_pair("::max_supported_key_length()", "::max_supported_key_parts()"));
00038   states.insert(state_pair("::max_supported_keys()", "::doCreateTable()"));
00039 
00040   states.insert(state_pair("::max_supported_keys()", "::max_supported_key_part_length()"));
00041 
00042   // what the
00043   states.insert(state_pair("::max_supported_keys()", "END STATEMENT"));
00044 
00045   states.insert(state_pair("::max_supported_key_part_length()", "::max_supported_key_part_length()"));
00046   states.insert(state_pair("::max_supported_key_part_length()", "::doCreateTable()"));
00047 
00048   states.insert(state_pair("::max_supported_key_parts()", "::max_supported_key_parts()"));
00049   states.insert(state_pair("::max_supported_key_parts()", "::max_supported_keys()"));
00050 
00051   // what the
00052   states.insert(state_pair("START STATEMENT", "::max_supported_key_length()"));
00053 
00054   states.insert(state_pair("::doCreateTable()", "::SEAPITester()"));
00055 /*  states.insert(state_pair("::SEAPITester()", "::create()"));
00056     states.insert(state_pair("::create()", "::SEAPITester()"));*/
00057   states.insert(state_pair("::SEAPITester()", "BEGIN"));
00058   states.insert(state_pair("BEGIN", "In Transaction"));
00059   states.insert(state_pair("In Transaction", "START STATEMENT"));
00060 
00061   /* really a bug */
00062   states.insert(state_pair("In Transaction", "END STATEMENT"));
00063   /* also a bug */
00064   states.insert(state_pair("::SEAPITester()", "COMMIT"));
00065 
00066   states.insert(state_pair("In Transaction", "COMMIT"));
00067   states.insert(state_pair("In Transaction", "ROLLBACK"));
00068   states.insert(state_pair("START STATEMENT", "END STATEMENT"));
00069   states.insert(state_pair("START STATEMENT", "ROLLBACK STATEMENT"));
00070   states.insert(state_pair("ROLLBACK STATEMENT", "In Transaction"));
00071   states.insert(state_pair("END STATEMENT", "START STATEMENT"));
00072   states.insert(state_pair("END STATEMENT", "COMMIT STATEMENT"));
00073   states.insert(state_pair("COMMIT STATEMENT", "In Transaction"));
00074   states.insert(state_pair("END STATEMENT", "COMMIT"));
00075   states.insert(state_pair("END STATEMENT", "ROLLBACK"));
00076   states.insert(state_pair("END STATEMENT", "ROLLBACK STATEMENT"));
00077 
00078   states.insert(state_pair("In Transaction", "SET SAVEPOINT"));
00079   states.insert(state_pair("In Transaction", "ROLLBACK TO SAVEPOINT"));
00080   states.insert(state_pair("In Transaction", "RELEASE SAVEPOINT"));
00081   states.insert(state_pair("SET SAVEPOINT", "In Transaction"));
00082   states.insert(state_pair("ROLLBACK TO SAVEPOINT", "BEGIN"));
00083   states.insert(state_pair("RELEASE SAVEPOINT", "BEGIN"));
00084 
00085   states.insert(state_pair("COMMIT", "::SEAPITester()"));
00086   states.insert(state_pair("ROLLBACK", "::SEAPITester()"));
00087   states.insert(state_pair("::SEAPITester()", "::doGetTableDefinition()"));
00088   states.insert(state_pair("::doGetTableDefinition()", "::SEAPITester()"));
00089 
00090   /* below just for autocommit statement. doesn't seem right to me */
00091   states.insert(state_pair("::SEAPITester()", "START STATEMENT"));
00092 }