| 98 | } |
| 99 | |
| 100 | char *read_node(cdb2_hndl_tp *db) |
| 101 | { |
| 102 | char *host; |
| 103 | int rc; |
| 104 | |
| 105 | rc = cdb2_run_statement(db, "select comdb2_host()"); |
| 106 | if (rc) { |
| 107 | tdprintf(stderr, db, __func__, __LINE__, |
| 108 | "run: don't know what node I'm on\n"); |
| 109 | return NULL; |
| 110 | } |
| 111 | rc = cdb2_next_record(db); |
| 112 | if (rc != CDB2_OK) { |
| 113 | tdprintf(stderr, db, __func__, __LINE__, |
| 114 | "next: don't know what node I'm on\n"); |
| 115 | return NULL; |
| 116 | } |
| 117 | host = cdb2_column_value(db, 0); |
| 118 | if (host) host = strdup(host); |
| 119 | while (rc == CDB2_OK) { |
| 120 | rc = cdb2_next_record(db); |
| 121 | } |
| 122 | if (rc != CDB2_OK_DONE) { |
| 123 | tdprintf(stderr, db, __func__, __LINE__, "next read node rc %d %s\n", |
| 124 | rc, cdb2_errstr(db)); |
| 125 | return NULL; |
| 126 | } |
| 127 | |
| 128 | return host; |
| 129 | } |
| 130 | |
| 131 | void myexit(const char *func, int line, int status) |
| 132 | { |
no test coverage detected