sqlite_orm
sqlite_orm copied to clipboard
Inserting primary key value is ignored
When inserting values into a simple two-column storage the primary key gets ignored as if set to null:
#include <iostream>
#include "sqlite_orm.h"
struct ipv4 {
uint64_t ip;
std::string name;
};
using namespace sqlite_orm;
int main (int argc, char const* argv[]) {
auto storage = make_storage("db.sqlite",
make_table("ipv4",
make_column("ip", &ipv4::ip, primary_key()),
make_column("name", &ipv4::name)
)
);
ipv4 test_add{18ul, "test"};
auto test_id = storage.insert(test_add);
std::cout << "id: " << test_id << "\n";
}
This results in a row "1|test".
use replace instead
Works as intended. Thank you!