3 * $Header: /cvsroot/pgpool/pgpool-II/parser/pool_parser.h,v 1.5 2008/01/29 01:56:39 y-asaba Exp $
5 * Copyright (c) 2006-2008, pgpool Global Development Group
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.
22 #include "../pool_type.h"
25 extern jmp_buf jmpbuffer;
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 *) */
36 #define InvalidOid ((Oid) 0)
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).
43 * NOTE that databases with different NAMEDATALEN's cannot interoperate!
45 #define NAMEDATALEN 64
48 /* date and datetime */
66 /* these are only for relative dates */
70 /* generic fields to help with parsing */
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)
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)
89 /* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */
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
99 #define ExclusiveLock 7 /* blocks ROW SHARE/SELECT...FOR
101 #define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE, VACUUM
102 * FULL, and unqualified LOCK TABLE */
104 #define DEFAULT_INDEX_TYPE "btree"
105 #define NUMERIC_MAX_PRECISION 1000
107 #define VARHDRSZ ((int32) sizeof(int32))
109 #define MaxAttrSize (10 * 1024 * 1024)
110 #define BITS_PER_BYTE 8
111 #define MAX_TIME_PRECISION 6
114 #define lengthof(array) (sizeof(array) / sizeof(((array)[0])))
115 #define endof(array) (&(array)[lengthof(array)])
117 #endif /* POOL_PARSER_H */