postgresql/src/bin/psql/common.h

67 lines
1.6 KiB
C
Raw Normal View History

2000-01-18 18:30:24 -05:00
/*
* psql - the PostgreSQL interactive terminal
*
2011-01-01 13:18:15 -05:00
* Copyright (c) 2000-2011, PostgreSQL Global Development Group
2000-01-18 18:30:24 -05:00
*
2010-09-20 16:08:53 -04:00
* src/bin/psql/common.h
2000-01-18 18:30:24 -05:00
*/
#ifndef COMMON_H
#define COMMON_H
#include "postgres_fe.h"
#include <setjmp.h>
2000-02-16 08:15:26 -05:00
#include "libpq-fe.h"
#ifdef USE_ASSERT_CHECKING
#include <assert.h>
#define psql_assert(p) assert(p)
#else
#define psql_assert(p)
#endif
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
/*
* Safer versions of some standard C library functions. If an
* out-of-memory condition occurs, these functions will bail out
* safely; therefore, their return value is guaranteed to be non-NULL.
*/
extern char *pg_strdup(const char *string);
extern void *pg_malloc(size_t size);
extern void *pg_malloc_zero(size_t size);
extern void *pg_calloc(size_t nmemb, size_t size);
extern bool setQFout(const char *fname);
extern void
2005-10-14 22:49:52 -04:00
psql_error(const char *fmt,...)
/* This lets gcc check the format string for consistency. */
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
extern void NoticeProcessor(void *arg, const char *message);
extern volatile bool sigint_interrupt_enabled;
extern sigjmp_buf sigint_interrupt_jmp;
extern volatile bool cancel_pressed;
2006-10-03 20:30:14 -04:00
/* Note: cancel_pressed is defined in print.c, see that file for reasons */
extern void setup_cancel_handler(void);
extern void SetCancelConn(void);
extern void ResetCancelConn(void);
extern PGresult *PSQLexec(const char *query, bool start_xact);
extern bool SendQuery(const char *query);
extern bool is_superuser(void);
extern bool standard_strings(void);
extern const char *session_username(void);
extern char *expand_tilde(char **filename);
#endif /* COMMON_H */