]> git.8kb.co.uk Git - pgpool-ii/pgpool-ii_2.2.5/blob - parser/pool_parser.h
Attempt to send a proper failure message to frontend when authentication
[pgpool-ii/pgpool-ii_2.2.5] / parser / pool_parser.h
1 /* -*-pgsql-c-*- */
2 /*
3  * $Header: /cvsroot/pgpool/pgpool-II/parser/pool_parser.h,v 1.5 2008/01/29 01:56:39 y-asaba Exp $
4  *
5  * Copyright (c) 2006-2008, pgpool Global Development Group
6  *
7  * Permission to use, copy, modify, and distribute this software and
8  * its documentation for any purpose and without fee is hereby
9  * granted, provided that the above copyright notice appear in all
10  * copies and that both that copyright notice and this permission
11  * notice appear in supporting documentation, and that the name of the
12  * author not be used in advertising or publicity pertaining to
13  * distribution of the software without specific, written prior
14  * permission. The author makes no representations about the
15  * suitability of this software for any purpose.  It is provided "as
16  * is" without express or implied warranty.
17  */
18
19 #ifndef POOL_PARSER_H
20 #define POOL_PARSER_H
21
22 #include "../pool_type.h"
23 #include <setjmp.h>
24
25 extern jmp_buf jmpbuffer;
26
27 /* integer */
28 typedef signed int int32;
29 typedef signed short int16;
30 typedef unsigned int PoolOid;
31 typedef unsigned int Index;
32 typedef short AttrNumber;
33 typedef unsigned long Datum;    /* XXX sizeof(long) >= sizeof(void *) */
34
35 #define Oid PoolOid
36 #define InvalidOid              ((Oid) 0)
37
38 /*
39  * NAMEDATALEN is the max length for system identifiers (e.g. table names,
40  * attribute names, function names, etc).  It must be a multiple of
41  * sizeof(int) (typically 4).
42  *
43  * NOTE that databases with different NAMEDATALEN's cannot interoperate!
44  */
45 #define NAMEDATALEN 64
46
47
48 /* date and datetime */
49 #define RESERV  0
50 #define MONTH   1
51 #define YEAR    2
52 #define DAY             3
53 #define JULIAN  4
54 #define TZ              5
55 #define DTZ             6
56 #define DTZMOD  7
57 #define IGNORE_DTF      8
58 #define AMPM    9
59 #define HOUR    10
60 #define MINUTE  11
61 #define SECOND  12
62 #define DOY             13
63 #define DOW             14
64 #define UNITS   15
65 #define ADBC    16
66 /* these are only for relative dates */
67 #define AGO             17
68 #define ABS_BEFORE              18
69 #define ABS_AFTER               19
70 /* generic fields to help with parsing */
71 #define ISODATE 20
72 #define ISOTIME 21
73 /* reserved for unrecognized string values */
74 #define UNKNOWN_FIELD   31
75 #define MAX_TIMESTAMP_PRECISION 6
76 #define MAX_INTERVAL_PRECISION 6
77 #define INTERVAL_FULL_RANGE (0x7FFF)
78 #define INTERVAL_RANGE_MASK (0x7FFF)
79 #define INTERVAL_FULL_PRECISION (0xFFFF)
80 #define INTERVAL_PRECISION_MASK (0xFFFF)
81
82 #define INTERVAL_MASK(b) (1 << (b))
83 #define INTERVAL_TYPMOD(p,r) ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK))
84 #define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK)
85 #define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK)
86
87
88 /* lock */
89 /* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */
90 #define NoLock                                  0
91
92 #define AccessShareLock                 1               /* SELECT */
93 #define RowShareLock                    2               /* SELECT FOR UPDATE/FOR SHARE */
94 #define RowExclusiveLock                3               /* INSERT, UPDATE, DELETE */
95 #define ShareUpdateExclusiveLock 4              /* VACUUM (non-FULL) */
96 #define ShareLock                               5               /* CREATE INDEX */
97 #define ShareRowExclusiveLock   6               /* like EXCLUSIVE MODE, but allows ROW
98                                                                                  * SHARE */
99 #define ExclusiveLock                   7               /* blocks ROW SHARE/SELECT...FOR
100                                                                                  * UPDATE */
101 #define AccessExclusiveLock             8               /* ALTER TABLE, DROP TABLE, VACUUM
102                                                                                  * FULL, and unqualified LOCK TABLE */
103
104 #define DEFAULT_INDEX_TYPE      "btree"
105 #define NUMERIC_MAX_PRECISION           1000
106
107 #define VARHDRSZ                ((int32) sizeof(int32))
108
109 #define MaxAttrSize             (10 * 1024 * 1024)
110 #define BITS_PER_BYTE           8
111 #define MAX_TIME_PRECISION 6
112
113 /* array */
114 #define lengthof(array) (sizeof(array) / sizeof(((array)[0])))
115 #define endof(array) (&(array)[lengthof(array)])
116
117 #endif /* POOL_PARSER_H */