1 /*-------------------------------------------------------------------------
4 * Normalize query string.
6 * This header file is created from pg_stat_statements.c to implement
7 * normalization of query string.
9 * Portions Copyright (c) 2008-2013, PostgreSQL Global Development Group
11 #ifndef NORMALIZE_QUERY_H
12 #define NORMALIZE_QUERY_H
15 * Struct for tracking locations/lengths of constants during normalization
17 typedef struct pgssLocationLen
19 int location; /* start offset in query text */
20 int length; /* length in bytes, or -1 to ignore */
24 * Working state for computing a query jumble and producing a normalized
27 typedef struct pgssJumbleState
29 /* Jumble of current query tree */
30 unsigned char *jumble;
32 /* Number of bytes used in jumble[] */
35 /* Array of locations of constants that should be removed */
36 pgssLocationLen *clocations;
38 /* Allocated length of clocations array */
39 int clocations_buf_size;
41 /* Current number of valid entries in clocations array */
46 generate_normalized_query(pgssJumbleState *jstate, const char *query,
47 int *query_len_p, int encoding);
48 static void JumbleQuery(pgssJumbleState *jstate, Query *query);
50 #define JUMBLE_SIZE 1024
52 #endif /* NORMALIZE_QUERY_H */