MySQL 9.1.0
Source Code Documentation
sql_xa_start.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef XA_SQL_CMD_XA_START
25#define XA_SQL_CMD_XA_START
26
27#include "sql/sql_cmd.h" // Sql_cmd
28#include "sql/xa.h" // xid_t
29
30/**
31 @class Sql_cmd_xa_start
32
33 This class represents the `XA START ...` SQL statement which starts an XA
34 transaction with the given xid value.
35
36 @see Sql_cmd
37*/
38class Sql_cmd_xa_start : public Sql_cmd {
39 public:
40 /**
41 Class constructor.
42
43 @param xid_arg XID of the XA transacation about to start
44 @param xa_option Additional options for the `XA START` command
45 */
46 Sql_cmd_xa_start(xid_t *xid_arg, enum xa_option_words xa_option);
47 virtual ~Sql_cmd_xa_start() override = default;
48
49 /**
50 Retrieves the SQL command code for this class, `SQLCOM_XA_START`.
51
52 @see Sql_cmd::sql_command_code
53
54 @return The SQL command code for this class, `SQLCOM_XA_START`.
55 */
56 enum_sql_command sql_command_code() const override;
57 /**
58 Executes the SQL command.
59
60 @see Sql_cmd::execute
61
62 @param thd The `THD` session object within which the command is being
63 executed.
64
65 @return false if the execution is successful, true otherwise.
66 */
67 bool execute(THD *thd) override;
68
69 private:
70 /** The XID associated with the underlying XA transaction. */
72 /** Options associated with the underlying `XA START` */
74
75 /**
76 Start a XA transaction with the given xid value.
77
78 @param thd Current thread
79
80 @retval false Success
81 @retval true Failure
82 */
83 bool trans_xa_start(THD *thd);
84};
85
86#endif // XA_SQL_CMD_XA_START
This class represents the XA START ... SQL statement which starts an XA transaction with the given xi...
Definition: sql_xa_start.h:38
enum xa_option_words m_xa_opt
Options associated with the underlying XA START
Definition: sql_xa_start.h:73
enum_sql_command sql_command_code() const override
Retrieves the SQL command code for this class, SQLCOM_XA_START.
Definition: sql_xa_start.cc:37
Sql_cmd_xa_start(xid_t *xid_arg, enum xa_option_words xa_option)
Class constructor.
Definition: sql_xa_start.cc:33
virtual ~Sql_cmd_xa_start() override=default
bool trans_xa_start(THD *thd)
Start a XA transaction with the given xid value.
Definition: sql_xa_start.cc:52
bool execute(THD *thd) override
Executes the SQL command.
Definition: sql_xa_start.cc:41
xid_t * m_xid
The XID associated with the underlying XA transaction.
Definition: sql_xa_start.h:71
Representation of an SQL command.
Definition: sql_cmd.h:83
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
enum_sql_command
Definition: my_sqlcommand.h:46
Representation of an SQL command.
struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification,...
Definition: xa.h:83
xa_option_words
Definition: xa.h:53