/ Get the value used for calculating the array. */ /
| 512 | /* Get the value used for calculating the array. */ |
| 513 | /*********************************************************************************/ |
| 514 | PVAL JSNX::GetCalcValue(PGLOBAL g, PJAR jap, int n) |
| 515 | { |
| 516 | // For calculated arrays, a local Value must be used |
| 517 | int lng = 0; |
| 518 | short type= 0, prec= 0; |
| 519 | bool b = n < Nod - 1; |
| 520 | PVAL valp; |
| 521 | PJVAL vlp, vp; |
| 522 | OPVAL op = Nodes[n].Op; |
| 523 | |
| 524 | switch (op) { |
| 525 | case OP_NUM: |
| 526 | type = TYPE_INT; |
| 527 | break; |
| 528 | case OP_ADD: |
| 529 | case OP_MULT: |
| 530 | if (!IsTypeNum(Buf_Type)) { |
| 531 | type = TYPE_INT; |
| 532 | prec = 0; |
| 533 | |
| 534 | for (vlp = jap->GetArrayValue(0); vlp; vlp = vlp->Next) { |
| 535 | vp = (b && vlp->GetJsp()) ? GetRowValue(g, vlp, n + 1) : vlp; |
| 536 | |
| 537 | switch (vp->DataType) { |
| 538 | case TYPE_BINT: |
| 539 | if (type == TYPE_INT) |
| 540 | type = TYPE_BIGINT; |
| 541 | |
| 542 | break; |
| 543 | case TYPE_DBL: |
| 544 | case TYPE_FLOAT: |
| 545 | type = TYPE_DOUBLE; |
| 546 | prec = MY_MAX(prec, vp->Nd); |
| 547 | break; |
| 548 | default: |
| 549 | break; |
| 550 | } // endswitch Type |
| 551 | |
| 552 | } // endfor vlp |
| 553 | |
| 554 | } else { |
| 555 | type = Buf_Type; |
| 556 | prec = GetPrecision(); |
| 557 | } // endif Buf_Type |
| 558 | |
| 559 | break; |
| 560 | case OP_SEP: |
| 561 | if (IsTypeChar(Buf_Type)) { |
| 562 | type = TYPE_DOUBLE; |
| 563 | prec = 2; |
| 564 | } else { |
| 565 | type = Buf_Type; |
| 566 | prec = GetPrecision(); |
| 567 | } // endif Buf_Type |
| 568 | |
| 569 | break; |
| 570 | case OP_MIN: |
| 571 | case OP_MAX: |
nothing calls this directly
no test coverage detected