]>
Commit | Line | Data |
---|---|---|
7ac48069 | 1 | /* $Id$ |
0236bb42 | 2 | * |
3 | * Structures and constants used in the query dispatch table | |
7ac48069 | 4 | * |
5 | * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology. | |
6 | * For copying and distribution information, please see the file | |
7 | * <mit-copyright.h>. | |
0236bb42 | 8 | */ |
9 | ||
10 | /* Query Types */ | |
11 | enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL}; | |
12 | ||
13 | /* Query Definition Structure */ | |
14 | struct query | |
15 | { | |
5eaef520 | 16 | char *name; /* query name */ |
17 | char *shortname; /* abbreviated query name (must be 4 chars) */ | |
c44ddfa7 | 18 | int version; /* query version */ |
5eaef520 | 19 | enum query_type type; /* query type */ |
20 | char *rvar; /* range variable */ | |
21 | enum tables rtable; /* range table */ | |
22 | char *tlist; /* target list */ | |
23 | char **fields; /* input and output variable names (for help) */ | |
24 | int vcnt; /* variable count */ | |
25 | char *qual; /* format string for "where" clause */ | |
26 | int argc; /* number of args for qualifier */ | |
29028043 | 27 | char *sort; /* fields to sort on */ |
5eaef520 | 28 | struct validate *validate; /* validation support */ |
29 | int acl; /* hint as to query ACL for this query */ | |
30 | int everybody; /* is the default user on this ACL? */ | |
0236bb42 | 31 | }; |
32 | ||
33 | /* Query Validation Structure */ | |
34 | struct validate | |
35 | { | |
5eaef520 | 36 | /* object validation (e.g., user, filesys, type) */ |
37 | struct valobj *valobj; /* array of object validation descriptors */ | |
38 | int objcnt; /* size of array */ | |
39 | /* row validation - retrieve (exists = any(rvar.field where qual)) */ | |
40 | char *field; /* field to check for */ | |
41 | char *qual; /* format string for "where" clause */ | |
42 | int argc; /* number of args used in qual */ | |
43 | /* values field containing current max object id */ | |
44 | char *object_id; | |
45 | /* routine to verify access permission on objects */ | |
7ac48069 | 46 | int (*acs_rtn)(struct query *q, char *Argv[], client *cl); |
5eaef520 | 47 | /* pre-processing routine (var setup only) */ |
7ac48069 | 48 | int (*pre_rtn)(struct query *q, char *Argv[], client *cl); |
5eaef520 | 49 | /* post-processing routine */ |
50 | int (*post_rtn)(); | |
0236bb42 | 51 | }; |
5eaef520 | 52 | |
0236bb42 | 53 | /* Validated Object Types */ |
d1b3a4bf | 54 | enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA, V_RENAME, V_CHAR, |
263a36d4 | 55 | V_LEN, V_NUM}; |
0236bb42 | 56 | |
57 | /* Validated Object Definition */ | |
58 | struct valobj | |
59 | { | |
5eaef520 | 60 | enum vo_type type; |
61 | int index; /* index of object to validate */ | |
62 | enum tables table; /* table containing object */ | |
63 | char *namefield; /* table's fieldname for object */ | |
64 | char *idfield; /* table's corresponding id field (if any) */ | |
65 | int error; | |
0236bb42 | 66 | }; |
03c05291 | 67 | |
68 | ||
69 | /* prototypes from cache.dc */ | |
70 | void flush_cache(void); | |
71 | int name_to_id(char *name, enum tables type, int *id); | |
72 | int id_to_name(int id, enum tables type, char **name); | |
73 | int cache_entry(char *name, enum tables type, int id); | |
74 | void flush_name(char *name, enum tables type); | |
75 | void cache_commit(void); | |
76 | void cache_abort(void); | |
77 | ||
78 | /* prototypes from increment.dc */ | |
79 | void incremental_before(enum tables table, char *qualx, char **argv); | |
80 | void incremental_clear_before(void); | |
81 | void incremental_after(enum tables table, char *qualx, char **argv); | |
82 | void incremental_clear_after(void); | |
83 | ||
03c05291 | 84 | /* prototypes from qrtn.dc */ |
85 | int check_query_access(struct query *q, char *argv[], client *cl); | |
86 | int set_next_object_id(char *objectx, enum tables table, int limit); | |
87 | ||
88 | /* prototypes from qsubs.c */ | |
b40733c9 | 89 | void list_queries(client *cl, int (*action)(int, char *[], void *), |
7ac48069 | 90 | void *actarg); |
91 | void help_query(struct query *q, int (*action)(int, char *[], void *), | |
92 | void *actarg); | |
c44ddfa7 | 93 | struct query *get_query_by_name(char *name, int version); |