Kuzu C++ API
Loading...
Searching...
No Matches
statement.h
Go to the documentation of this file.
1#pragma once
2
3#include "cast.h"
4#include "statement_type.h"
5
6namespace kuzu {
7namespace parser {
8
9class Statement {
10public:
11 explicit Statement(common::StatementType statementType)
12 : parsingTime{0}, statementType{statementType}, internal{false} {}
13
14 virtual ~Statement() = default;
15
16 common::StatementType getStatementType() const { return statementType; }
17 void setToInternal() { internal = true; }
18 bool isInternal() const { return internal; }
19 void setParsingTime(double time) { parsingTime = time; }
20 double getParsingTime() const { return parsingTime; }
21
22 bool requireTransaction() const {
23 switch (statementType) {
25 return false;
26 default:
27 return true;
28 }
29 }
30
31 template<class TARGET>
32 TARGET& cast() {
34 }
35 template<class TARGET>
36 const TARGET& constCast() const {
38 }
39 template<class TARGET>
40 const TARGET* constPtrCast() const {
42 }
43
44private:
45 double parsingTime;
46 common::StatementType statementType;
47 // By setting the statement to internal, we still execute the statement, but will not return the
48 // executio result as part of the query result returned to users.
49 // The use case for this is when a query internally generates other queries to finish first,
50 // e.g., `TableFunction::rewriteFunc`.
51 bool internal;
52};
53
54} // namespace parser
55} // namespace kuzu
double getParsingTime() const
Definition statement.h:20
bool isInternal() const
Definition statement.h:18
virtual ~Statement()=default
const TARGET * constPtrCast() const
Definition statement.h:40
const TARGET & constCast() const
Definition statement.h:36
bool requireTransaction() const
Definition statement.h:22
void setToInternal()
Definition statement.h:17
void setParsingTime(double time)
Definition statement.h:19
common::StatementType getStatementType() const
Definition statement.h:16
TARGET & cast()
Definition statement.h:32
Statement(common::StatementType statementType)
Definition statement.h:11
StatementType
Definition statement_type.h:8
@ TRANSACTION
Definition statement_type.h:19
TO ku_dynamic_cast(FROM *old)
Definition cast.h:11
Definition client_context.h:19
Definition array_utils.h:7