X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=normalize_query.h;h=9357ce25fca2e862b7fb2b1caddc3ca72c4db1ee;hb=454f72a07c2bfa37816be9b223de17e01bdb23c8;hp=3ff5206d35872b4af7faba8a70f2abfe6acc96ce;hpb=10fa5fea72ccb635da012166dbcea8c44553eae4;p=pghintplan%2Fpg_hint_plan.git diff --git a/normalize_query.h b/normalize_query.h index 3ff5206..9357ce2 100644 --- a/normalize_query.h +++ b/normalize_query.h @@ -6,47 +6,12 @@ * This header file is created from pg_stat_statements.c to implement * normalization of query string. * - * Portions Copyright (c) 2008-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 2008-2020, PostgreSQL Global Development Group */ #ifndef NORMALIZE_QUERY_H #define NORMALIZE_QUERY_H -/* - * Struct for tracking locations/lengths of constants during normalization - */ -typedef struct pgssLocationLen -{ - int location; /* start offset in query text */ - int length; /* length in bytes, or -1 to ignore */ -} pgssLocationLen; - -/* - * Working state for computing a query jumble and producing a normalized - * query string - */ -typedef struct pgssJumbleState -{ - /* Jumble of current query tree */ - unsigned char *jumble; - - /* Number of bytes used in jumble[] */ - Size jumble_len; - - /* Array of locations of constants that should be removed */ - pgssLocationLen *clocations; - - /* Allocated length of clocations array */ - int clocations_buf_size; - - /* Current number of valid entries in clocations array */ - int clocations_count; -} pgssJumbleState; - static char * -generate_normalized_query(pgssJumbleState *jstate, const char *query, - int *query_len_p, int encoding); -static void JumbleQuery(pgssJumbleState *jstate, Query *query); - -#define JUMBLE_SIZE 1024 - +generate_normalized_query(JumbleState *jstate, const char *query, + int query_loc, int *query_len_p); #endif /* NORMALIZE_QUERY_H */