]> andersk Git - moira.git/blame_incremental - server/query.h
Add queries for manipulating the listsids and usersids tables.
[moira.git] / server / query.h
... / ...
CommitLineData
1/* $Id$
2 *
3 * Structures and constants used in the query dispatch table
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>.
8 */
9
10/* Query Types */
11enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL};
12
13/* Query Definition Structure */
14struct query
15{
16 char *name; /* query name */
17 char *shortname; /* abbreviated query name (must be 4 chars) */
18 int version; /* query version */
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 */
27 char *sort; /* fields to sort on */
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? */
31};
32
33/* Query Validation Structure */
34struct validate
35{
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 */
46 int (*acs_rtn)(struct query *q, char *Argv[], client *cl);
47 /* pre-processing routine (var setup only) */
48 int (*pre_rtn)(struct query *q, char *Argv[], client *cl);
49 /* post-processing routine */
50 int (*post_rtn)();
51};
52
53/* Validated Object Types */
54enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA, V_RENAME, V_CHAR,
55 V_LEN, V_NUM};
56
57/* Validated Object Definition */
58struct valobj
59{
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;
66};
67
68
69/* prototypes from cache.dc */
70void flush_cache(void);
71int name_to_id(char *name, enum tables type, int *id);
72int id_to_name(int id, enum tables type, char **name);
73int cache_entry(char *name, enum tables type, int id);
74void flush_name(char *name, enum tables type);
75void cache_commit(void);
76void cache_abort(void);
77
78/* prototypes from increment.dc */
79void incremental_before(enum tables table, char *qualx, char **argv);
80void incremental_clear_before(void);
81void incremental_after(enum tables table, char *qualx, char **argv);
82void incremental_clear_after(void);
83
84/* prototypes from qrtn.dc */
85int check_query_access(struct query *q, char *argv[], client *cl);
86int set_next_object_id(char *objectx, enum tables table, int limit);
87
88/* prototypes from qsubs.c */
89void list_queries(client *cl, int (*action)(int, char *[], void *),
90 void *actarg);
91void help_query(struct query *q, int (*action)(int, char *[], void *),
92 void *actarg);
93struct query *get_query_by_name(char *name, int version);
This page took 0.033648 seconds and 5 git commands to generate.