/ db / include /
/db/include/globalmacros.m4
1 dnl Copyright (C) 2012 The Meme Factory, Inc. http://www.meme.com/
2 dnl Copyright (C) 2006, 2008, Karl O. Pinc <kop@meme.com>
3 dnl
4 dnl This file is part of Gombe-MI.
5 dnl
6 dnl Gombe-MI is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3 of the License, or
9 dnl (at your option) any later version.
10 dnl
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
18 dnl
19 dnl Karl O. Pinc <kop@meme.com>
20 dnl
21 dnl Macros that are used by multiple subdirectories.
22 dnl
23 dnl
24 changequote([{[,]}])dnl m4 foolery so includes include only once.
25 dnl Once the macro is in the text, change the quotes back
26 ifdef([{[_globalmacros.m4]}], [{[changequote(`,')]}], [{[dnl
27 changequote(`,')dnl
28 dnl
29 dnl Standard test for having already included the file.
30 define(`_globalmacros.m4')dnl
31 dnl
32 dnl
33 dnl Discard any output. Copyright and edit warning is all that's output.
34 divert(-1)
35
36 dnl m4 includes
37 include(`constants.m4')
38
39 dnl SET clause used in all function definition statements.
40 define(`gmi_function_search_path', `gombemi, devel, pg_temp')
41 define(`gmi_function_set_search_path', `SET search_path = gmi_function_search_path')
42 dnl
43 dnl Inline expressions
44 dnl
45
46 dnl sql fragment to cast values which might be NULL to text.
47 dnl
48 dnl Syntax: textualize(expr)
49 dnl
50 dnl expr An expression which might be NULL.
51 dnl
52 dnl Remarks:
53 dnl Useful when raising errors to get a uniform external NULL
54 dnl representation.
55 dnl
56 changequote({,})
57 define({textualize},{CASE WHEN $1 IS NULL THEN 'NULL' ELSE $1::TEXT END
58 })dnl
59 changequote(`,')
60
61 dnl Turn output back on
62 divert`'dnl
63 ]}])dnl End of ifdef over the whole file.