Skip to content
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

unstable inserting or updating fields=false in release #127

Open
Styletto opened this issue Jul 7, 2022 · 1 comment
Open

unstable inserting or updating fields=false in release #127

Styletto opened this issue Jul 7, 2022 · 1 comment
Assignees

Comments

@Styletto
Copy link

Styletto commented Jul 7, 2022

Unstable updating of fields equal to false in release. I have tested tst_benchmark with a little sophisticated code. Tested MySql, SQLite3 in kubuntu, win11 (mscvc 2019, VS 2022 and mingw64). The errors are the same. Stored value may be NULL or 0 (NULL or false in SQLite) if value to store or update equal to false. No errors in Debug versions.

Steps to reproduce the behavior:

  1. Change some code from tst_benchmark.cpp

void BenchmarkTest::insert1kPost() {
QElapsedTimer t;
t.start();
for (int i = 0; i < 1000; ++i) {
auto newPost = Nut::create();
auto number = ' ' + QString::number(i + 1);
newPost->setTitle(QStringLiteral("post title") + number);
newPost->setBody(QStringLiteral("post body") + number);
(i % 2) == 0 ? newPost->setPublic(false) : newPost->setPublic(true);
newPost->setSaveDate(QDateTime::currentDateTime());
db.posts()->append(newPost);
}
db.saveChanges();
qDebug("1k post inserted in %lld ms", t.elapsed());
}

Field isPublic each even record of table "posts" should contain 'true' (or 1 in mysql) and and so it is. The fields of odd records should contain 'false" (or 0 in mysql) but this is not always the case. NULL not equal to false therefore, an execution error or logic error occurs. Similar behavior when updating to 'false' the bool field equal to "true" (1).
All files and screenshot from 2 OS each 2 drivers (QSQLITE, QMYSQL) attached.
Development platform:

  • OS: Win11 x64, Kubuntu 22.04
  • Qt version: QtTest library 6.2.4
  • Compiler: mingw_64 (GCC 11.2.0), MSVC2019 (VS 2022), G++-11 (Kubuntu)

No errors in Debug versions!!

linux-tests.zip
windows-test.zip

@HamedMasafi
Copy link
Owner

Hi @Styletto
Thanks for reporting

I'll check it as soon as possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants