| 1943 | } |
| 1944 | |
| 1945 | void 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. |
no test coverage detected