* makeArrayResultAny - produce final result of accumArrayResultAny * * astate is working state (must not be NULL) * rcontext is where to construct result * release is true if okay to release working state */
| 5736 | * release is true if okay to release working state |
| 5737 | */ |
| 5738 | Datum |
| 5739 | makeArrayResultAny(ArrayBuildStateAny *astate, |
| 5740 | MemoryContext rcontext, bool release) |
| 5741 | { |
| 5742 | Datum result; |
| 5743 | |
| 5744 | if (astate->scalarstate) |
| 5745 | { |
| 5746 | /* Must use makeMdArrayResult to support "release" parameter */ |
| 5747 | int ndims; |
| 5748 | int dims[1]; |
| 5749 | int lbs[1]; |
| 5750 | |
| 5751 | /* If no elements were presented, we want to create an empty array */ |
| 5752 | ndims = (astate->scalarstate->nelems > 0) ? 1 : 0; |
| 5753 | dims[0] = astate->scalarstate->nelems; |
| 5754 | lbs[0] = 1; |
| 5755 | |
| 5756 | result = makeMdArrayResult(astate->scalarstate, ndims, dims, lbs, |
| 5757 | rcontext, release); |
| 5758 | } |
| 5759 | else |
| 5760 | { |
| 5761 | result = makeArrayResultArr(astate->arraystate, |
| 5762 | rcontext, release); |
| 5763 | } |
| 5764 | return result; |
| 5765 | } |
| 5766 | |
| 5767 | |
| 5768 | Datum |
no test coverage detected