MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / send_cancel_cnonce

Function send_cancel_cnonce

tools/cdb2sql/cdb2sql.cpp:1945–1978  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1943}
1944
1945void send_cancel_cnonce(const char *cnonce)
1946{
1947 if (!gbl_in_stmt) return;
1948 cdb2_hndl_tp *cdb2h_2 = NULL; // use a new db handle
1949 int rc;
1950 int flags = 0;
1951 char *type = dbtype;
1952
1953 if (dbhostname) {
1954 flags |= CDB2_DIRECT_CPU;
1955 type = dbhostname;
1956 }
1957
1958 if (isadmin)
1959 flags |= CDB2_ADMIN;
1960
1961 rc = cdb2_open(&cdb2h_2, dbname, type, flags);
1962 if (rc) {
1963 if (debug_trace)
1964 fprintf(stderr, "cdb2_open rc %d %s\n", rc, cdb2_errstr(cdb2h));
1965 cdb2_close(cdb2h_2);
1966 return;
1967 }
1968 char sql[256];
1969 snprintf(sql, 255, "exec procedure sys.cmd.send('sql cancelcnonce %s')",
1970 cnonce);
1971 if (debug_trace) printf("Cancel sql string '%s'\n", sql);
1972 rc = cdb2_run_statement(cdb2h_2, sql);
1973 if (!rc)
1974 gbl_sent_cancel_cnonce = 1;
1975 else if (debug_trace)
1976 fprintf(stderr, "failed to cancel rc %d with '%s'\n", rc, sql);
1977 cdb2_close(cdb2h_2);
1978}
1979
1980/* If ctrl_c was pressed to clear existing line and go to new line
1981 * If we see two ctrl_c in a row we exit.

Callers 1

int_handlerFunction · 0.85

Calls 4

cdb2_openFunction · 0.85
cdb2_errstrFunction · 0.85
cdb2_closeFunction · 0.85
cdb2_run_statementFunction · 0.85

Tested by

no test coverage detected