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_BACKEND_H_
10#define _SQL_BACKEND_H_
11
12#include "sql_mem.h"
13#include "sql_catalog.h"
14#include "sql_relation.h"
15#include "sql_types.h"
16
17typedef void (*freestack_fptr) (int clientid, backend_stack stk);
18typedef void (*freecode_fptr) (int clientid, backend_code code, backend_stack stk, int nr, char *name);
19
20typedef char *(*create_user_fptr) (ptr mvc, char *user, char *passwd, char enc, char *fullname, sqlid schema_id, sqlid grantor_id);
21typedef int (*drop_user_fptr) (ptr mvc, char *user);
22typedef int (*find_user_fptr) (ptr mvc, char *user);
23typedef void (*create_privileges_fptr) (ptr mvc, sql_schema *s);
24typedef int (*schema_has_user_fptr) (ptr mvc, sql_schema *s);
25typedef int (*alter_user_fptr) (ptr mvc, str user, str passwd, char enc, sqlid schema_id, str oldpasswd);
26typedef int (*rename_user_fptr) (ptr mvc, str olduser, str newuser);
27typedef void* (*schema_user_dependencies) (ptr mvc, int schema_id);
28typedef void (*create_function) (ptr mvc, str name, sql_rel *rel, sql_table *t);
29typedef int (*resolve_function) (ptr mvc, sql_func *f);
30
31/* backing struct for this interface */
32typedef struct _backend_functions {
33 freestack_fptr fstack;
34 freecode_fptr fcode;
35 create_user_fptr fcuser;
36 drop_user_fptr fduser;
37 find_user_fptr ffuser;
38 create_privileges_fptr fcrpriv;
39 schema_has_user_fptr fshuser;
40 alter_user_fptr fauser;
41 rename_user_fptr fruser;
42 schema_user_dependencies fschuserdep;
43 resolve_function fresolve_function;
44} backend_functions;
45
46extern void backend_freestack(int clientid, backend_stack stk);
47extern void backend_freecode(int clientid, backend_code code, backend_stack stk, int nr, char *name);
48
49extern char *backend_create_user(ptr mvc, char *user, char *passwd, char enc, char *fullname, sqlid defschemid, sqlid grantor);
50extern int backend_drop_user(ptr mvc, char *user);
51extern int backend_find_user(ptr mp, char *user);
52extern void backend_create_privileges(ptr mvc, sql_schema *s);
53extern int backend_schema_has_user(ptr mvc, sql_schema *s);
54extern int backend_alter_user(ptr mvc, str user, str passwd, char enc, sqlid schema_id, str oldpasswd);
55extern int backend_rename_user(ptr mvc, str olduser, str newuser);
56extern void* backend_schema_user_dependencies(ptr trans, sqlid schema_id);
57extern int backend_resolve_function(ptr trans, sql_func *f);
58
59extern backend_functions be_funcs;
60
61#endif /* _SQL_BACKEND_H_ */
62