summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/result.cpp
blob: dd045b8d8894716f0fba352b1772c3a1db884d05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "result.h"

#include "context.h"

#include <util/stream/output.h>

namespace NSQLTranslationV1 {

bool Unwrap(TSQLStatus status) {
    EnsureUnwrappable(status);
    return static_cast<bool>(status);
}

std::unexpected<ESQLError> UnsupportedYqlSelect(TContext& ctx, TStringBuf message) {
    if (ctx.GetYqlSelectMode() == EYqlSelect::Force) {
        ctx.Error() << "YqlSelect unsupported: " << message;
    }

    return std::unexpected(ESQLError::UnsupportedYqlSelect);
}

} // namespace NSQLTranslationV1

template <>
void Out<NSQLTranslationV1::ESQLError>(IOutputStream& out, NSQLTranslationV1::ESQLError value) {
    switch (value) {
        case NSQLTranslationV1::ESQLError::Basic:
            out << "Basic";
            break;
        case NSQLTranslationV1::ESQLError::UnsupportedYqlSelect:
            out << "UnsupportedYqlSelect";
            break;
    }
}