Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes16kdownloads
builtins.h137 linesDownload Raw Back to utils
1/*-------------------------------------------------------------------------2 *3 * builtins.h4 *	  Declarations for operations on built-in types.5 *6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/utils/builtins.h11 *12 *-------------------------------------------------------------------------13 */14#ifndef BUILTINS_H15#define BUILTINS_H16 17#include "fmgr.h"18#include "nodes/nodes.h"19#include "utils/fmgrprotos.h"20 21/* Sign + the most decimal digits an 8-byte number could have */22#define MAXINT8LEN 2023 24/* bool.c */25extern bool parse_bool(const char *value, bool *result);26extern bool parse_bool_with_len(const char *value, size_t len, bool *result);27 28/* domains.c */29extern void domain_check(Datum value, bool isnull, Oid domainType,30						 void **extra, MemoryContext mcxt);31extern int	errdatatype(Oid datatypeOid);32extern int	errdomainconstraint(Oid datatypeOid, const char *conname);33 34/* encode.c */35extern uint64 hex_encode(const char *src, size_t len, char *dst);36extern uint64 hex_decode(const char *src, size_t len, char *dst);37extern uint64 hex_decode_safe(const char *src, size_t len, char *dst,38							  Node *escontext);39 40/* int.c */41extern int2vector *buildint2vector(const int16 *int2s, int n);42 43/* name.c */44extern void namestrcpy(Name name, const char *str);45extern int	namestrcmp(Name name, const char *str);46 47/* numutils.c */48extern int16 pg_strtoint16(const char *s);49extern int16 pg_strtoint16_safe(const char *s, Node *escontext);50extern int32 pg_strtoint32(const char *s);51extern int32 pg_strtoint32_safe(const char *s, Node *escontext);52extern int64 pg_strtoint64(const char *s);53extern int64 pg_strtoint64_safe(const char *s, Node *escontext);54extern uint32 uint32in_subr(const char *s, char **endloc,55							const char *typname, Node *escontext);56extern uint64 uint64in_subr(const char *s, char **endloc,57							const char *typname, Node *escontext);58extern int	pg_itoa(int16 i, char *a);59extern int	pg_ultoa_n(uint32 value, char *a);60extern int	pg_ulltoa_n(uint64 value, char *a);61extern int	pg_ltoa(int32 value, char *a);62extern int	pg_lltoa(int64 value, char *a);63extern char *pg_ultostr_zeropad(char *str, uint32 value, int32 minwidth);64extern char *pg_ultostr(char *str, uint32 value);65 66/* oid.c */67extern oidvector *buildoidvector(const Oid *oids, int n);68extern Oid	oidparse(Node *node);69extern int	oid_cmp(const void *p1, const void *p2);70 71/* regexp.c */72extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive,73								 Oid collation, bool *exact);74 75/* ruleutils.c */76extern PGDLLIMPORT bool quote_all_identifiers;77extern const char *quote_identifier(const char *ident);78extern char *quote_qualified_identifier(const char *qualifier,79										const char *ident);80extern void generate_operator_clause(fmStringInfo buf,81									 const char *leftop, Oid leftoptype,82									 Oid opoid,83									 const char *rightop, Oid rightoptype);84 85/* varchar.c */86extern int	bpchartruelen(char *s, int len);87 88/* popular functions from varlena.c */89extern text *cstring_to_text(const char *s);90extern text *cstring_to_text_with_len(const char *s, int len);91extern char *text_to_cstring(const text *t);92extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len);93 94#define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s))95#define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d))96 97/* xid.c */98extern int	xidComparator(const void *arg1, const void *arg2);99extern int	xidLogicalComparator(const void *arg1, const void *arg2);100 101/* inet_cidr_ntop.c */102extern char *pg_inet_cidr_ntop(int af, const void *src, int bits,103							   char *dst, size_t size);104 105/* inet_net_pton.c */106extern int	pg_inet_net_pton(int af, const char *src,107							 void *dst, size_t size);108 109/* network.c */110extern double convert_network_to_scalar(Datum value, Oid typid, bool *failure);111extern Datum network_scan_first(Datum in);112extern Datum network_scan_last(Datum in);113extern void clean_ipv6_addr(int addr_family, char *addr);114 115/* numeric.c */116extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS);117 118/* format_type.c */119 120/* Control flags for format_type_extended */121#define FORMAT_TYPE_TYPEMOD_GIVEN	0x01	/* typemod defined by caller */122#define FORMAT_TYPE_ALLOW_INVALID	0x02	/* allow invalid types */123#define FORMAT_TYPE_FORCE_QUALIFY	0x04	/* force qualification of type */124#define FORMAT_TYPE_INVALID_AS_NULL	0x08	/* NULL if undefined */125extern char *format_type_extended(Oid type_oid, int32 typemod, bits16 flags);126 127extern char *format_type_be(Oid type_oid);128extern char *format_type_be_qualified(Oid type_oid);129extern char *format_type_with_typemod(Oid type_oid, int32 typemod);130 131extern int32 type_maximum_size(Oid type_oid, int32 typemod);132 133/* quote.c */134extern char *quote_literal_cstr(const char *rawstr);135 136#endif							/* BUILTINS_H */137 
codekingpro/portable-devtools · Team Ai