00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022 #include <drizzled/show.h>
00023 #include <drizzled/session.h>
00024 #include <drizzled/statement/start_transaction.h>
00025
00026 namespace drizzled
00027 {
00028
00029 bool statement::StartTransaction::execute()
00030 {
00031 if (session().inTransaction())
00032 {
00033 push_warning_printf(&session(), DRIZZLE_ERROR::WARN_LEVEL_WARN,
00034 ER_TRANSACTION_ALREADY_STARTED,
00035 ER(ER_TRANSACTION_ALREADY_STARTED));
00036 return false;
00037 }
00038
00039 if (transaction().xid_state.xa_state != XA_NOTR)
00040 {
00041 my_error(ER_XAER_RMFAIL, MYF(0),
00042 xa_state_names[transaction().xid_state.xa_state]);
00043 return false;
00044 }
00045
00046
00047
00048 if (! session().startTransaction(start_transaction_opt))
00049 {
00050 return true;
00051 }
00052 session().my_ok();
00053 return false;
00054 }
00055
00056 }