1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
7 */
8
9#ifndef _SQL_QUERY_H_
10#define _SQL_QUERY_H_
11
12#include "sql_relation.h"
13#include "sql_stack.h"
14#include "sql_mvc.h"
15
16typedef struct stacked_query {
17 sql_rel *rel;
18 int sql_state;
19} stacked_query;
20
21typedef struct sql_query {
22 mvc *sql;
23 sql_stack *outer;
24} sql_query;
25
26extern sql_query *query_create(mvc *sql);
27extern void query_push_outer(sql_query *q, sql_rel *r, int sql_state);
28extern sql_rel *query_pop_outer(sql_query *q);
29extern sql_rel *query_fetch_outer(sql_query *q, int i);
30extern int query_fetch_outer_state(sql_query *q, int i);
31extern void query_update_outer(sql_query *q, sql_rel *r, int i);
32extern int query_has_outer(sql_query *q); /* returns number of outer relations */
33
34#endif
35