Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef COMMON_H
00010 #define COMMON_H
00011
00012 #include "libpq-fe.h"
00013 #include "getopt_long.h"
00014 #include "pqexpbuffer.h"
00015
00016 enum trivalue
00017 {
00018 TRI_DEFAULT,
00019 TRI_NO,
00020 TRI_YES
00021 };
00022
00023 typedef void (*help_handler) (const char *progname);
00024
00025 extern const char *get_user_name(const char *progname);
00026
00027 extern void handle_help_version_opts(int argc, char *argv[],
00028 const char *fixed_progname,
00029 help_handler hlp);
00030
00031 extern PGconn *connectDatabase(const char *dbname, const char *pghost,
00032 const char *pgport, const char *pguser,
00033 enum trivalue prompt_password, const char *progname,
00034 bool fail_ok);
00035
00036 extern PGconn *connectMaintenanceDatabase(const char *maintenance_db,
00037 const char *pghost, const char *pgport, const char *pguser,
00038 enum trivalue prompt_password, const char *progname);
00039
00040 extern PGresult *executeQuery(PGconn *conn, const char *query,
00041 const char *progname, bool echo);
00042
00043 extern void executeCommand(PGconn *conn, const char *query,
00044 const char *progname, bool echo);
00045
00046 extern bool executeMaintenanceCommand(PGconn *conn, const char *query,
00047 bool echo);
00048
00049 extern bool yesno_prompt(const char *question);
00050
00051 extern void setup_cancel_handler(void);
00052
00053 #endif