| 288 | } |
| 289 | |
| 290 | void ProcedureScan::assignParams(thread_db* tdbb, |
| 291 | const dsc* from_desc, |
| 292 | const dsc* flag_desc, |
| 293 | const UCHAR* msg, |
| 294 | const dsc* to_desc, |
| 295 | SSHORT to_id, |
| 296 | Record* record) const |
| 297 | { |
| 298 | SSHORT indicator; |
| 299 | dsc desc2; |
| 300 | desc2.makeShort(0, &indicator); |
| 301 | |
| 302 | dsc desc1 = *flag_desc; |
| 303 | desc1.dsc_address = const_cast<UCHAR*>(msg) + (IPTR) flag_desc->dsc_address; |
| 304 | |
| 305 | MOV_move(tdbb, &desc1, &desc2); |
| 306 | |
| 307 | if (indicator) |
| 308 | { |
| 309 | record->setNull(to_id); |
| 310 | const USHORT len = to_desc->dsc_length; |
| 311 | UCHAR* const p = record->getData() + (IPTR) to_desc->dsc_address; |
| 312 | switch (to_desc->dsc_dtype) |
| 313 | { |
| 314 | case dtype_text: |
| 315 | /* YYY - not necessarily the right thing to do */ |
| 316 | /* YYY for text formats that don't have trailing spaces */ |
| 317 | if (len) |
| 318 | { |
| 319 | const CHARSET_ID chid = DSC_GET_CHARSET(to_desc); |
| 320 | /* |
| 321 | CVC: I don't know if we have to check for dynamic-127 charset here. |
| 322 | If that is needed, the line above should be replaced by the commented code here. |
| 323 | CHARSET_ID chid = INTL_TTYPE(to_desc); |
| 324 | if (chid == ttype_dynamic) |
| 325 | chid = INTL_charset(tdbb, chid); |
| 326 | */ |
| 327 | const char pad = chid == ttype_binary ? '\0' : ' '; |
| 328 | memset(p, pad, len); |
| 329 | } |
| 330 | break; |
| 331 | |
| 332 | case dtype_cstring: |
| 333 | *p = 0; |
| 334 | break; |
| 335 | |
| 336 | case dtype_varying: |
| 337 | *reinterpret_cast<SSHORT*>(p) = 0; |
| 338 | break; |
| 339 | |
| 340 | default: |
| 341 | if (len) |
| 342 | memset(p, 0, len); |
| 343 | break; |
| 344 | } |
| 345 | } |
| 346 | else |
| 347 | { |