2005-08-15 17:02:26 -04:00
|
|
|
/*
|
|
|
|
|
* common.h
|
|
|
|
|
* Common support routines for bin/scripts/
|
|
|
|
|
*
|
2007-01-05 17:20:05 -05:00
|
|
|
* Copyright (c) 2003-2007, PostgreSQL Global Development Group
|
2005-08-15 17:02:26 -04:00
|
|
|
*
|
2007-01-05 17:20:05 -05:00
|
|
|
* $PostgreSQL: pgsql/src/bin/scripts/common.h,v 1.16 2007/01/05 22:19:50 momjian Exp $
|
2005-08-15 17:02:26 -04:00
|
|
|
*/
|
|
|
|
|
#ifndef COMMON_H
|
|
|
|
|
#define COMMON_H
|
2003-03-18 17:19:47 -05:00
|
|
|
|
|
|
|
|
#include "libpq-fe.h"
|
2003-08-07 17:11:58 -04:00
|
|
|
#include "getopt_long.h"
|
2006-07-14 10:52:27 -04:00
|
|
|
#include "pqexpbuffer.h"
|
2003-03-18 17:19:47 -05:00
|
|
|
|
2004-11-27 13:51:08 -05:00
|
|
|
#ifndef HAVE_INT_OPTRESET
|
2005-10-14 22:49:52 -04:00
|
|
|
extern int optreset;
|
2003-03-18 17:19:47 -05:00
|
|
|
#endif
|
|
|
|
|
|
2005-08-15 17:02:26 -04:00
|
|
|
typedef void (*help_handler) (const char *progname);
|
2003-03-18 17:19:47 -05:00
|
|
|
|
2005-08-15 17:02:26 -04:00
|
|
|
extern const char *get_user_name(const char *progname);
|
2003-03-18 17:19:47 -05:00
|
|
|
|
2005-08-15 17:02:26 -04:00
|
|
|
extern void handle_help_version_opts(int argc, char *argv[],
|
2005-10-14 22:49:52 -04:00
|
|
|
const char *fixed_progname,
|
|
|
|
|
help_handler hlp);
|
2003-03-18 17:19:47 -05:00
|
|
|
|
2005-08-15 17:02:26 -04:00
|
|
|
extern PGconn *connectDatabase(const char *dbname, const char *pghost,
|
2005-10-14 22:49:52 -04:00
|
|
|
const char *pgport, const char *pguser,
|
|
|
|
|
bool require_password, const char *progname);
|
2003-03-18 17:19:47 -05:00
|
|
|
|
2005-08-15 17:02:26 -04:00
|
|
|
extern PGresult *executeQuery(PGconn *conn, const char *query,
|
2005-10-14 22:49:52 -04:00
|
|
|
const char *progname, bool echo);
|
2003-05-27 15:36:55 -04:00
|
|
|
|
2005-08-15 17:02:26 -04:00
|
|
|
extern void executeCommand(PGconn *conn, const char *query,
|
2005-10-14 22:49:52 -04:00
|
|
|
const char *progname, bool echo);
|
2005-08-15 17:02:26 -04:00
|
|
|
|
2006-09-22 14:50:41 -04:00
|
|
|
extern bool yesno_prompt(const char *question);
|
2005-08-15 17:02:26 -04:00
|
|
|
|
2005-10-14 22:49:52 -04:00
|
|
|
#endif /* COMMON_H */
|