MCPcopy Create free account
hub / github.com/apache/cloudberry / main

Function main

src/bin/scripts/dropuser.c:24–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23
24int
25main(int argc, char *argv[])
26{
27 static int if_exists = 0;
28
29 static struct option long_options[] = {
30 {"host", required_argument, NULL, 'h'},
31 {"port", required_argument, NULL, 'p'},
32 {"username", required_argument, NULL, 'U'},
33 {"no-password", no_argument, NULL, 'w'},
34 {"password", no_argument, NULL, 'W'},
35 {"echo", no_argument, NULL, 'e'},
36 {"interactive", no_argument, NULL, 'i'},
37 {"if-exists", no_argument, &if_exists, 1},
38 {NULL, 0, NULL, 0}
39 };
40
41 const char *progname;
42 int optindex;
43 int c;
44
45 char *dropuser = NULL;
46 char *host = NULL;
47 char *port = NULL;
48 char *username = NULL;
49 enum trivalue prompt_password = TRI_DEFAULT;
50 ConnParams cparams;
51 bool echo = false;
52 bool interactive = false;
53
54 PQExpBufferData sql;
55
56 PGconn *conn;
57 PGresult *result;
58
59 pg_logging_init(argv[0]);
60 progname = get_progname(argv[0]);
61 set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
62
63 handle_help_version_opts(argc, argv, "dropuser", help);
64
65 while ((c = getopt_long(argc, argv, "h:p:U:wWei", long_options, &optindex)) != -1)
66 {
67 switch (c)
68 {
69 case 'h':
70 host = pg_strdup(optarg);
71 break;
72 case 'p':
73 port = pg_strdup(optarg);
74 break;
75 case 'U':
76 username = pg_strdup(optarg);
77 break;
78 case 'w':
79 prompt_password = TRI_NO;
80 break;
81 case 'W':

Callers

nothing calls this directly

Calls 15

pg_logging_initFunction · 0.85
get_prognameFunction · 0.85
set_pglocale_pgserviceFunction · 0.85
handle_help_version_optsFunction · 0.85
getopt_longFunction · 0.85
pg_strdupFunction · 0.85
simple_promptFunction · 0.85
yesno_promptFunction · 0.85
initPQExpBufferFunction · 0.85
appendPQExpBufferFunction · 0.85
fmtIdEncFunction · 0.85

Tested by

no test coverage detected