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 STORE_SEQ_H |
10 | #define STORE_SEQ_H |
11 | |
12 | #include "sql_catalog.h" |
13 | |
14 | extern void* sequences_init(void); |
15 | extern void sequences_exit(void); |
16 | |
17 | extern int seq_get_value(sql_sequence *seq, lng *val); |
18 | extern int seq_next_value(sql_sequence *seq, lng *val); |
19 | extern int seq_restart(sql_sequence *seq, lng start); |
20 | |
21 | /* for bulk calls, the API is split in 3 parts */ |
22 | |
23 | typedef struct seqbulk { |
24 | void *internal_seq; |
25 | sql_sequence *seq; |
26 | BUN cnt; |
27 | int save; |
28 | } seqbulk; |
29 | |
30 | extern seqbulk *seqbulk_create(sql_sequence *seq, BUN cnt); |
31 | extern int seqbulk_get_value(seqbulk *seq, lng *val); |
32 | extern int seqbulk_next_value(seqbulk *seq, lng *val); |
33 | extern int seqbulk_restart(seqbulk *seq, lng start); |
34 | extern void seqbulk_destroy(seqbulk *seq); |
35 | |
36 | #endif /* STORE_SEQ_H */ |
37 | |