1 | This file documents the Grand OAF Database Query Language. |
---|
2 | |
---|
3 | Constants: |
---|
4 | |
---|
5 | Strings: As in SQL, delimited by single quotes. Example: 'mystring' |
---|
6 | |
---|
7 | Stringvs (string arrays): A comma-separated list of strings, surrounded by square brackets. Example: ['red','blue'] |
---|
8 | |
---|
9 | Numbers: Floating point decimals. (aka "whatever atof() accepts" :) |
---|
10 | |
---|
11 | Booleans: TRUE or FALSE (other common boolean value identifiers also accepted, but not encouraged). |
---|
12 | |
---|
13 | Field identifiers: |
---|
14 | |
---|
15 | Names of fields are attributes of a ServerInfo record. These include |
---|
16 | 'type', 'location_info', and 'iid', even though these are explicitly |
---|
17 | stored instead of just other attributes. |
---|
18 | |
---|
19 | Some pseudo-fields are also available - they are all prefaced with an underscore: |
---|
20 | _active - Whether the server is currently running (boolean) |
---|
21 | |
---|
22 | Variables: |
---|
23 | |
---|
24 | Variables are various miscellaneous data items that are part of the |
---|
25 | environment. The syntax for referring to a variable is a '$' sign |
---|
26 | followed by the variable name. The following variables are available: |
---|
27 | |
---|
28 | $hostname - the hostname that the requesting client is running on. |
---|
29 | $domain - the "domain" that the client is requesting activation in. |
---|
30 | |
---|
31 | Functions: |
---|
32 | |
---|
33 | Functions perform transformations on data and return a result. There are two possible syntaxes for a function call: |
---|
34 | funcname(arguments) |
---|
35 | field.funcname(other-arguments...) |
---|
36 | |
---|
37 | Internally, 'field.funcname(other-arguments...)' is translated to be |
---|
38 | exactly the same as 'funcname(field, other-arguments)', so |
---|
39 | 'priority.max()' is exactly the same as 'max(priority)'. The following functions are available: |
---|
40 | |
---|
41 | defined(expression) |
---|
42 | Returns a boolean value that indicates whether the given expression is defined for the current |
---|
43 | record. For example, using a field name would indicate whether that field is defined for the |
---|
44 | record. |
---|
45 | |
---|
46 | has_one(stringv1, stringv2) |
---|
47 | Returns a boolean value that indicates whether any of the strings |
---|
48 | in the 'stringv2' array are contained in the 'stringv1' array. |
---|
49 | |
---|
50 | has_all(stringv1, stringv2) |
---|
51 | Returns a boolean value that indicates whether all of the strings |
---|
52 | in the 'stringv2' array are contained in the 'stringv1' array. |
---|
53 | |
---|
54 | has(stringv, string) |
---|
55 | Returns a boolean value that indicates whether 'string' is contained in the 'stringv' array. |
---|
56 | |
---|
57 | prefer_by_list_order(string, stringv) |
---|
58 | This function is intended to use as a sort condition when you have a prioritized list of |
---|
59 | preferred values. It returns -1 if the 'string' is not in the 'stringv' array, otherwise |
---|
60 | it's position measured from the end of 'stringv'. The result is that the first item is |
---|
61 | most preferred, items after that are next most preferred, and items not in the list are |
---|
62 | lowest priority. |
---|
63 | |
---|
64 | max(expr) |
---|
65 | Evaluates 'expr' over all the available server information records in the database, and returns |
---|
66 | the maximum value as dictated by the normal sort order for the data type of 'expr'. |
---|
67 | This function is not valid for string vectors. |
---|
68 | |
---|
69 | min(expr) |
---|
70 | As with the 'max' function, but finds the minimum value. |
---|
71 | |
---|
72 | Function names are case insensitive. |
---|
73 | |
---|
74 | Operators: |
---|
75 | |
---|
76 | Binary relational operators |
---|
77 | |
---|
78 | == equal |
---|
79 | != not equal |
---|
80 | < less than |
---|
81 | > greater than |
---|
82 | <= less than or equal |
---|
83 | >= greater than or equal |
---|
84 | |
---|
85 | Binary boolean operators |
---|
86 | |
---|
87 | &&, AND and |
---|
88 | ||, OR or |
---|
89 | ^^, XOR exclusive or |
---|
90 | |
---|
91 | Unary boolean operators |
---|
92 | |
---|
93 | ~, NOT not |
---|
94 | |
---|
95 | Binary arithmetic operators |
---|
96 | |
---|
97 | / divided by |
---|
98 | + plus |
---|
99 | - minus |
---|
100 | * times |
---|
101 | |
---|
102 | Unary arithmetic operators |
---|
103 | |
---|
104 | - negate |
---|
105 | |
---|
106 | |
---|
107 | Example queries: |
---|
108 | |
---|
109 | To get a component implementing the IDL:GNOME/Graph/Layout interface you might use: |
---|
110 | |
---|
111 | CORBA_Object o = oaf_activate ("repo_ids.has ('IDL:GNOME/Graph/Layout:1.0')", |
---|
112 | NULL, 0, NULL, &ev); |
---|
113 | |
---|
114 | A more complicated query might be: |
---|
115 | |
---|
116 | "(repo_ids.has_all (['IDL:Bonobo/Control:1.0', |
---|
117 | 'IDL:Nautilus/ContentView:1.0']) OR |
---|
118 | repo_ids.has_one (['IDL:Bonobo/Control:1.0', |
---|
119 | 'IDL:Bonobo/Embeddable:1.0'])) AND |
---|
120 | repo_ids.has('IDL:Bonobo/PersistFile:1.0') AND |
---|
121 | foo:bar.defined()" |
---|
122 | |
---|
123 | This would get any component with both 'Control' and 'ContentView' or |
---|
124 | with either 'Control' or 'Embeddable' as long as they supported the |
---|
125 | 'PersistFile' interface, and defined the attribute 'foo:bar'. |
---|