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