MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / bindQuery

Method bindQuery

src/binder/bind/bind_query.cpp:44–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44std::unique_ptr<BoundRegularQuery> Binder::bindQuery(const Statement& statement) {
45 auto& regularQuery = statement.constCast<RegularQuery>();
46 std::vector<NormalizedSingleQuery> normalizedSingleQueries;
47 for (auto i = 0u; i < regularQuery.getNumSingleQueries(); i++) {
48 // Don't clear scope within bindSingleQuery() yet because it is also used for subquery
49 // binding.
50 scope.clear();
51 normalizedSingleQueries.push_back(bindSingleQuery(*regularQuery.getSingleQuery(i)));
52 }
53 validateUnionColumnsOfTheSameType(normalizedSingleQueries);
54 DASSERT(!normalizedSingleQueries.empty());
55 auto boundRegularQuery = std::make_unique<BoundRegularQuery>(regularQuery.getIsUnionAll(),
56 normalizedSingleQueries[0].getStatementResult()->copy());
57 for (auto& normalizedSingleQuery : normalizedSingleQueries) {
58 boundRegularQuery->addSingleQuery(std::move(normalizedSingleQuery));
59 }
60 validateIsAllUnionOrUnionAll(*boundRegularQuery);
61 return boundRegularQuery;
62}
63
64NormalizedSingleQuery Binder::bindSingleQuery(const SingleQuery& singleQuery) {
65 auto normalizedSingleQuery = NormalizedSingleQuery();

Callers 1

bindExportTableDataFunction · 0.80

Calls 11

getNumSingleQueriesMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
getSingleQueryMethod · 0.45
emptyMethod · 0.45
getIsUnionAllMethod · 0.45
copyMethod · 0.45
getStatementResultMethod · 0.45
addSingleQueryMethod · 0.45

Tested by

no test coverage detected