-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to fix update exception? #561
Comments
You should provide more information, at least the exception message that you get. |
And with the exception message, please also provide a minimal reproducible example. |
sorry,the exception message is:
minimal example: |
I could not find any obvious problems after looking at your source code. So I built your project on latest Fedora 39. I had to rename What platform (OS, compiler version, SQLite3 version, sqlpp11 version) are you building/running your demo on? The error that you are getting I would check for a mismatch between sqlite3 library headers and the corresponding sqlite3 dynamic/static library. If that is OK, then probably the most straightforward approach would be to run it under your platform debugger to see where it throws |
I don't have mingw on my Windows 10 machine at the moment, so I cannot test it. My prime suspect is the sqlite3 library that is linked to your app. You may want to check if the sqlite3 headers are for the same version as the sqlite library that you are linking to your executable. Also make sure that the sqlite3 library uses the same CRT DLL as your main executable, so that you don't have two memory heaps. Maybe try using http://dependencywalker.com/ or another similar tool to check if the main executable and the sqlite3 library use the same CRT DLL. |
@shishirong Any updates? |
I cannot comment on the dependency walker, maybe @MeanSquaredError can help with that? In the meantime:
|
I have a machine with Windows 10, so I will install mingw-64 and will try reproducing the problem tomorrow. I will post an update here once I try the demo program on my computer. |
Also from the screenshot of depwalker it seems that the program uses msvcrt.dll, the non-debug build of the crt library, which is a bit surprising given that you are making a debug build of your project. Also it is probably worth opening the dependencies of the libgcc_s_seh-1.dll and libstdc++-6.dll in depwalker and checking if they don't import a different build of the msvcrt library. |
OK, I tried installing mingw (the cygwin distribution) and the demo program worked correctly for me without crashing. I couldn't find your distribution That is why I just went with the internet install of cygwin. I did a default install and then used its setup program to additionally install gcc-core, g++, cmake and gnu make. Then I built and ran the demo. It exited normally without any crashes. I tried it several times, but it just seems to work normally. Here is my setup. OS: Windows 10 64-bit Just for your information, I also built the demo in MinGW with MSVC in debug mode and ran it. The program then complained that
is being accessed without being initialized first. So you could try changing it to
and see if that will make a difference when running it on your computer. |
OK, I think I found a (semi)decent download site for MinGW 8.1, so I will try it as well and will post an update. EDIT: I installed MinGW-W64 GCC-8.1.0 x86_64-posix-seh and after compiling the demo program it still worked correctly without any crashes. |
@MeanSquaredError very thanks, I tried build in terminal, but db(insert_into(user).set(user.userId = "123", user.userName = "user0", user.passwd = "user0"));
|
Thanks for confirming the runtime issues to be resolved. You should try to figure out what happens in qt-creator, but that's out of scope for this library, of course. As for the new problem you are facing: That's a compile time issue, and the static asserts often explain the issue:
Unfortunately, I have not found a decent way to indicate the exact column, but looking at your code and the demo.zip you sent earlier: You are missing a value for the "pid" column. |
yes, it is missing "pid" column; I don't know how to control generated |
@rbock @shishirong
So if you are intereseted in troubleshooting this issue, then you could try the following.
|
@MeanSquaredError I find the main difference is |
Columns require insert if they have no default (including auto increment) and are not marked to be nullable. |
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
pid INTEGER,
user_id TEXT,
user_name TEXT,
passwd TEXT
); I dont set |
When I run your table definition through the code generator, I get this column struct for struct Pid
{
struct _alias_t
{
static constexpr const char _literal[] = "pid";
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
template<typename T>
struct _member_t
{
T pid;
T& operator()() { return pid; }
const T& operator()() const { return pid; }
};
};
using _traits = sqlpp::make_traits<sqlpp::integer, sqlpp::tag::can_be_null>;
}; You seem to be getting something different for |
record in DBModels.h |
OK, we wandered far enough from the original topic of this issue :-) I created #569 |
on sqlite
update other table exception too.
The text was updated successfully, but these errors were encountered: