ClickHouse/src/Parsers/ASTTransactionControl.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.4 KiB
C++
Raw Normal View History

2021-03-31 17:55:04 +00:00
#include <Parsers/ASTTransactionControl.h>
#include <IO/Operators.h>
#include <Common/SipHash.h>
namespace DB
{
void ASTTransactionControl::formatImpl(const FormatSettings & format /*state*/, FormatState &, FormatStateStacked /*frame*/) const
{
switch (action)
{
case BEGIN:
format.ostr << (format.hilite ? hilite_keyword : "") << "BEGIN TRANSACTION" << (format.hilite ? hilite_none : "");
break;
case COMMIT:
format.ostr << (format.hilite ? hilite_keyword : "") << "COMMIT" << (format.hilite ? hilite_none : "");
break;
case ROLLBACK:
format.ostr << (format.hilite ? hilite_keyword : "") << "ROLLBACK" << (format.hilite ? hilite_none : "");
break;
2022-03-18 13:33:59 +00:00
case SET_SNAPSHOT:
format.ostr << (format.hilite ? hilite_keyword : "") << "SET TRANSACTION SNAPSHOT " << (format.hilite ? hilite_none : "") << snapshot;
break;
2021-03-31 17:55:04 +00:00
}
}
2023-02-02 01:11:16 +00:00
IAST::QueryKind ASTTransactionControl::getQueryKind() const
{
switch (action)
{
case BEGIN:
return QueryKind::Begin;
case COMMIT:
return QueryKind::Commit;
case ROLLBACK:
return QueryKind::Rollback;
case SET_SNAPSHOT:
return QueryKind::SetTransactionSnapshot;
}
}
2021-03-31 17:55:04 +00:00
void ASTTransactionControl::updateTreeHashImpl(SipHash & hash_state) const
{
hash_state.update(action);
}
}