| 5294 | } |
| 5295 | |
| 5296 | void *cdb2_column_value(cdb2_hndl_tp *hndl, int col) |
| 5297 | { |
| 5298 | if (hndl->fdb_hndl) |
| 5299 | hndl = hndl->fdb_hndl; |
| 5300 | CDB2SQLRESPONSE *lastresponse = hndl->lastresponse; |
| 5301 | /* sanity check. just in case. */ |
| 5302 | if (lastresponse == NULL) |
| 5303 | return NULL; |
| 5304 | /* data came back in the child column structure */ |
| 5305 | if (lastresponse->value != NULL) { |
| 5306 | /* handle empty values */ |
| 5307 | if (lastresponse->value[col]->value.len == 0 && lastresponse->value[col]->has_isnull != 1 && |
| 5308 | lastresponse->value[col]->isnull != 1) { |
| 5309 | return (void *)""; |
| 5310 | } |
| 5311 | return lastresponse->value[col]->value.data; |
| 5312 | } |
| 5313 | /* sqlite row */ |
| 5314 | if (hndl->lastresponse->has_sqlite_row) |
| 5315 | return lastresponse->sqlite_row.data; |
| 5316 | /* data came back in the parent CDB2SQLRESPONSE structure */ |
| 5317 | if (col_values_flattened(lastresponse)) { |
| 5318 | /* handle empty values */ |
| 5319 | if (lastresponse->values[col].len == 0 && !lastresponse->isnulls[col]) |
| 5320 | return (void *)""; |
| 5321 | return lastresponse->values[col].data; |
| 5322 | } |
| 5323 | return NULL; |
| 5324 | } |
| 5325 | |
| 5326 | int cdb2_bind_param(cdb2_hndl_tp *hndl, const char *varname, int type, |
| 5327 | const void *varaddr, int length) |