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 BAT_UTILS_H
10#define BAT_UTILS_H
11
12#include "sql_storage.h"
13#include "gdk_logger.h"
14
15/* when returning a log_bid, errors are reported using BID_NIL */
16#define BID_NIL 0
17
18#define bat_set_access(b,access) b->batRestricted = access
19
20extern BAT *temp_descriptor(log_bid b);
21extern BAT *quick_descriptor(log_bid b);
22extern void temp_destroy(log_bid b);
23extern void temp_dup(log_bid b);
24extern log_bid temp_create(BAT *b);
25extern log_bid temp_copy(log_bid b, int temp);
26
27extern void bat_destroy(BAT *b);
28extern BAT *bat_new(int tt, BUN size, role_t role);
29extern void bat_clear(BAT *b);
30
31extern BUN append_inserted(BAT *b, BAT *i );
32
33extern BAT *ebats[MAXATOMS];
34
35#define isEbat(b) (ebats[b->ttype] && ebats[b->ttype] == b)
36
37extern log_bid ebat2real(log_bid b, oid ibase);
38extern log_bid e_bat(int type);
39extern BAT *e_BAT(int type);
40extern log_bid ebat_copy(log_bid b, oid ibase, int temp);
41extern int bat_utils_init(void);
42
43extern sql_table * tr_find_table( sql_trans *tr, sql_table *t);
44extern sql_column * tr_find_column( sql_trans *tr, sql_column *c);
45extern sql_idx * tr_find_idx( sql_trans *tr, sql_idx *i);
46
47
48#endif /* BAT_UTILS_H */
49