Open MacroUniverse opened 7 months ago
This works for me (with apple clang 15)
int64_t i64 = 0;
statement.bind(1, i64);
Can you provide more information, code, platform, compiler, actual error?
I see, I think the problem is using long long
instead of int64_t
. The compiler says it's ambiguous with candidates:
void SQLite::Statement::bind(int, int32_t)
void SQLite::Statement::bind(int, uint32_t)
void SQLite::Statement::bind(int, int64_t)
void SQLite::Statement::bind(int, double)
It would be nice to have a version explicitly for long long
and use some template programming to redirect to one of the above.
I'm using g++ 11.4 on Ubuntu 22.04.
I see and I agree. I'd simply start with this:
void SQLite::Statement::bind(int index, long long value) {
static_assert(sizeof(long long) == sizeof(int64_t));
bind(index, int64_t(value));
}
And improve it only if there's a demand supporting platforms where sizeof(long long) is different.
I think the user should be aware of how sqlite expects the types, probably using some templates/concepts could help, however this should be optional as it will break for some users
Hi, I was trying to bind an SQLite::Statement with
?
to the typelong long
, with member functionbind(1, i)
. But there's a compiler error, I had to cast the integer to 32bit int to make it work. Is this a limitation of sqlite3 itself or just SQLiteCpp?I'm using version 3.2.1