soci icon indicating copy to clipboard operation
soci copied to clipboard

`get_last_insert_id()`: change parameter type `long long &` to `std::int64_t &`

Open Spixmaster opened this issue 10 months ago • 1 comments

The function bool get_last_insert_id(std::string const &sequence, long long &value) has the unpleasant argument type long long &. This disallows passing even std::int64_t & because it equals to long &.

I prefer fixed width integers whose usage is not possible here.

clang-tidy also disencourages the usage of long long, https://releases.llvm.org/11.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/google-runtime-int.html.

Spixmaster avatar Apr 13 '25 10:04 Spixmaster

Changing it would break compatibility, which is not something we should do without good reason, but we could add an overload taking int64_t if it's a different type from long long (it might not be).

vadz avatar Apr 13 '25 12:04 vadz