| 5229 | } |
| 5230 | |
| 5231 | const char *cdb2_errstr(cdb2_hndl_tp *hndl) |
| 5232 | { |
| 5233 | char *ret; |
| 5234 | |
| 5235 | if (hndl == NULL) |
| 5236 | ret = "unallocated cdb2 handle"; |
| 5237 | else { |
| 5238 | if (hndl->fdb_hndl) |
| 5239 | hndl = hndl->fdb_hndl; |
| 5240 | if (hndl->firstresponse == NULL) { |
| 5241 | ret = hndl->errstr; |
| 5242 | } else if (hndl->lastresponse == NULL) { |
| 5243 | ret = hndl->firstresponse->error_string; |
| 5244 | } else { |
| 5245 | ret = hndl->lastresponse->error_string; |
| 5246 | } |
| 5247 | } |
| 5248 | |
| 5249 | if (!ret) |
| 5250 | ret = hndl->errstr; |
| 5251 | if (log_calls) |
| 5252 | fprintf(stderr, "%p> cdb2_errstr(%p) = \"%s\"\n", |
| 5253 | (void *)pthread_self(), hndl, ret ? ret : "NULL"); |
| 5254 | return ret; |
| 5255 | } |
| 5256 | |
| 5257 | int cdb2_column_type(cdb2_hndl_tp *hndl, int col) |
| 5258 | { |
no outgoing calls