Write out local variable field data type.
| 370 | |
| 371 | // Write out local variable field data type. |
| 372 | void DsqlCompilerScratch::putLocalVariable(dsql_var* variable, const DeclareVariableNode* hostParam, |
| 373 | const MetaName& collationName) |
| 374 | { |
| 375 | dsql_fld* field = variable->field; |
| 376 | |
| 377 | appendUChar(blr_dcl_variable); |
| 378 | appendUShort(variable->number); |
| 379 | DDL_resolve_intl_type(this, field, collationName); |
| 380 | |
| 381 | //const USHORT dtype = field->dtype; |
| 382 | |
| 383 | putDtype(field, true); |
| 384 | //field->dtype = dtype; |
| 385 | |
| 386 | // Check for a default value, borrowed from define_domain |
| 387 | NestConst<ValueSourceClause> node = hostParam ? hostParam->dsqlDef->defaultClause : NULL; |
| 388 | |
| 389 | if (variable->type == dsql_var::TYPE_INPUT) |
| 390 | { |
| 391 | // Assign EXECUTE BLOCK's input parameter to its corresponding internal variable. |
| 392 | |
| 393 | appendUChar(blr_assignment); |
| 394 | |
| 395 | appendUChar(blr_parameter2); |
| 396 | appendUChar(variable->msgNumber); |
| 397 | appendUShort(variable->msgItem); |
| 398 | appendUShort(variable->msgItem + 1); |
| 399 | |
| 400 | appendUChar(blr_variable); |
| 401 | appendUShort(variable->number); |
| 402 | } |
| 403 | else if (node || (!field->fullDomain && !field->notNull)) |
| 404 | { |
| 405 | appendUChar(blr_assignment); |
| 406 | |
| 407 | if (node) |
| 408 | GEN_expr(this, Node::doDsqlPass(this, node->value, false)); |
| 409 | else |
| 410 | appendUChar(blr_null); // Initialize variable to NULL |
| 411 | |
| 412 | appendUChar(blr_variable); |
| 413 | appendUShort(variable->number); |
| 414 | } |
| 415 | else |
| 416 | { |
| 417 | appendUChar(blr_init_variable); |
| 418 | appendUShort(variable->number); |
| 419 | } |
| 420 | |
| 421 | if (variable->field->fld_name.hasData()) // Not a function return value |
| 422 | putDebugVariable(variable->number, variable->field->fld_name); |
| 423 | |
| 424 | ++hiddenVarsNumber; |
| 425 | } |
| 426 | |
| 427 | // Put maps in subroutines for outer variables/parameters usage. |
| 428 | void DsqlCompilerScratch::putOuterMaps() |
no test coverage detected