Converts a bigint(int with 64 bits) variable to binary
| 1629 | |
| 1630 | // Converts a bigint(int with 64 bits) variable to binary |
| 1631 | FORCE_INLINE |
| 1632 | const char* convert_toBIGINT(int64_t context, int64_t value, int32_t* out_len) { |
| 1633 | *out_len = sizeof(value); |
| 1634 | char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *out_len)); |
| 1635 | |
| 1636 | if (ret == nullptr) { |
| 1637 | gdv_fn_context_set_error_msg(context, |
| 1638 | "Could not allocate memory for the output string"); |
| 1639 | |
| 1640 | *out_len = 0; |
| 1641 | return ""; |
| 1642 | } |
| 1643 | |
| 1644 | memcpy(ret, &value, *out_len); |
| 1645 | |
| 1646 | return ret; |
| 1647 | } |
| 1648 | |
| 1649 | FORCE_INLINE |
| 1650 | const char* convert_toBIGINT_be(int64_t context, int64_t value, int32_t* out_len) { |