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 | |
17 | typedef void (*freestack_fptr) (int clientid, backend_stack stk); |
18 | typedef void (*freecode_fptr) (int clientid, backend_code code, backend_stack stk, int nr, char *name); |
19 | |
20 | typedef char *(*create_user_fptr) (ptr mvc, char *user, char *passwd, char enc, char *fullname, sqlid schema_id, sqlid grantor_id); |
21 | typedef int (*drop_user_fptr) (ptr mvc, char *user); |
22 | typedef int (*find_user_fptr) (ptr mvc, char *user); |
23 | typedef void (*create_privileges_fptr) (ptr mvc, sql_schema *s); |
24 | typedef int (*schema_has_user_fptr) (ptr mvc, sql_schema *s); |
25 | typedef int (*alter_user_fptr) (ptr mvc, str user, str passwd, char enc, sqlid schema_id, str oldpasswd); |
26 | typedef int (*rename_user_fptr) (ptr mvc, str olduser, str newuser); |
27 | typedef void* (*schema_user_dependencies) (ptr mvc, int schema_id); |
28 | typedef void (*create_function) (ptr mvc, str name, sql_rel *rel, sql_table *t); |
29 | typedef int (*resolve_function) (ptr mvc, sql_func *f); |
30 | |
31 | /* backing struct for this interface */ |
32 | typedef 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 | |
46 | extern void backend_freestack(int clientid, backend_stack stk); |
47 | extern void backend_freecode(int clientid, backend_code code, backend_stack stk, int nr, char *name); |
48 | |
49 | extern char *backend_create_user(ptr mvc, char *user, char *passwd, char enc, char *fullname, sqlid defschemid, sqlid grantor); |
50 | extern int backend_drop_user(ptr mvc, char *user); |
51 | extern int backend_find_user(ptr mp, char *user); |
52 | extern void backend_create_privileges(ptr mvc, sql_schema *s); |
53 | extern int backend_schema_has_user(ptr mvc, sql_schema *s); |
54 | extern int backend_alter_user(ptr mvc, str user, str passwd, char enc, sqlid schema_id, str oldpasswd); |
55 | extern int backend_rename_user(ptr mvc, str olduser, str newuser); |
56 | extern void* backend_schema_user_dependencies(ptr trans, sqlid schema_id); |
57 | extern int backend_resolve_function(ptr trans, sql_func *f); |
58 | |
59 | extern backend_functions be_funcs; |
60 | |
61 | #endif /* _SQL_BACKEND_H_ */ |
62 | |