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
|
|
|
*/
|
1999-11-04 16:56:02 -05:00
|
|
|
#ifndef COMMON_H
|
|
|
|
|
#define COMMON_H
|
|
|
|
|
|
2001-02-09 21:31:31 -05:00
|
|
|
#include "postgres_fe.h"
|
2006-06-14 12:49:03 -04:00
|
|
|
#include <setjmp.h>
|
2000-02-16 08:15:26 -05:00
|
|
|
#include "libpq-fe.h"
|
1999-11-04 16:56:02 -05:00
|
|
|
|
2003-12-01 17:14:40 -05:00
|
|
|
#ifdef USE_ASSERT_CHECKING
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#define psql_assert(p) assert(p)
|
|
|
|
|
#else
|
|
|
|
|
#define psql_assert(p)
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-07-12 16:41:13 -04:00
|
|
|
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
|
|
|
|
|
|
2004-01-24 14:38:49 -05:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2004-01-24 22:07:22 -05:00
|
|
|
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);
|
1999-11-04 16:56:02 -05:00
|
|
|
|
2001-10-25 01:50:21 -04:00
|
|
|
extern bool setQFout(const char *fname);
|
1999-11-04 16:56:02 -05:00
|
|
|
|
2001-10-25 01:50:21 -04:00
|
|
|
extern void
|
2005-10-14 22:49:52 -04:00
|
|
|
psql_error(const char *fmt,...)
|
2001-10-03 17:58:28 -04:00
|
|
|
/* This lets gcc check the format string for consistency. */
|
2011-04-28 10:56:14 -04:00
|
|
|
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
|
2000-04-12 13:17:23 -04:00
|
|
|
|
2001-10-25 01:50:21 -04:00
|
|
|
extern void NoticeProcessor(void *arg, const char *message);
|
2000-04-12 13:17:23 -04:00
|
|
|
|
2006-06-14 12:49:03 -04:00
|
|
|
extern volatile bool sigint_interrupt_enabled;
|
2000-04-12 13:17:23 -04:00
|
|
|
|
2006-06-14 12:49:03 -04:00
|
|
|
extern sigjmp_buf sigint_interrupt_jmp;
|
|
|
|
|
|
|
|
|
|
extern volatile bool cancel_pressed;
|
2006-10-03 20:30:14 -04:00
|
|
|
|
2006-06-14 12:49:03 -04:00
|
|
|
/* Note: cancel_pressed is defined in print.c, see that file for reasons */
|
2003-03-20 01:00:12 -05:00
|
|
|
|
2004-10-30 19:11:27 -04:00
|
|
|
extern void setup_cancel_handler(void);
|
2006-06-14 12:49:03 -04:00
|
|
|
|
|
|
|
|
extern void SetCancelConn(void);
|
|
|
|
|
extern void ResetCancelConn(void);
|
2000-02-20 09:28:28 -05:00
|
|
|
|
2003-06-27 20:12:40 -04:00
|
|
|
extern PGresult *PSQLexec(const char *query, bool start_xact);
|
1999-11-04 16:56:02 -05:00
|
|
|
|
2001-10-25 01:50:21 -04:00
|
|
|
extern bool SendQuery(const char *query);
|
2001-10-28 01:26:15 -05:00
|
|
|
|
2003-06-27 20:12:40 -04:00
|
|
|
extern bool is_superuser(void);
|
2006-03-06 14:49:20 -05:00
|
|
|
extern bool standard_strings(void);
|
2003-09-03 18:05:09 -04:00
|
|
|
extern const char *session_username(void);
|
2003-06-27 20:12:40 -04:00
|
|
|
|
2004-01-09 16:12:20 -05:00
|
|
|
extern char *expand_tilde(char **filename);
|
|
|
|
|
|
2001-11-05 12:46:40 -05:00
|
|
|
#endif /* COMMON_H */
|