]> andersk Git - moira.git/blob - server/query.h
remove the (unused) table locking code
[moira.git] / server / query.h
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 */
11 enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL};
12
13 /* Query Definition Structure */
14 struct query
15 {
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 */
26   char *sort;                   /* fields to sort on */
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? */
30 };
31
32 /* Query Validation Structure */
33 struct validate
34 {
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 */
45   int (*acs_rtn)(struct query *q, char *Argv[], client *cl);
46   /* pre-processing routine (var setup only) */
47   int (*pre_rtn)(struct query *q, char *Argv[], client *cl);
48   /* post-processing routine */
49   int (*post_rtn)();
50 };
51
52 /* Validated Object Types */
53 enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA, V_RENAME, V_CHAR,
54               V_WILD, V_UPWILD, V_LEN, V_NUM};
55
56 /* Validated Object Definition */
57 struct valobj
58 {
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;
65 };
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
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 */
88 void list_queries(int (*action)(int, char *[], void *),
89                   void *actarg);
90 void help_query(struct query *q, int (*action)(int, char *[], void *),
91                 void *actarg);
92 struct query *get_query_by_name(char *name);
This page took 0.040917 seconds and 5 git commands to generate.