https://bugs.kde.org/show_bug.cgi?id=524946

--- Comment #8 from kidakeh <[email protected]> ---
(In reply to caulier.gilles from comment #7)
> Done. The Windows Qt6 build based on Qt 6.11.1 and libmariadb for the QtSql
> plugin is now online and ready to test (note : this take 2 days to compile
> all from scratch - MSVC is really a mess as compiler)
> 
> https://files.kde.org/digikam/

This version is incompatible with MariaDB 10.11.19, causing the program to fail
on startup and displaying the error dialog:
"An error occurred during the internal server start." after 60 seconds.

Upgrading to MariaDB 12.3.3 allows the program to start normally, but the BUG
itself is not resolved.

When clicking "March 2026", the database log shows (relevant excerpts):

23 Connect      root@localhost on digikam using SSL/TLS
23 Query        SET NAMES utf8mb4
23 Init DB      digikam
23 Prepare      SELECT ? + ?
23 Close stmt   
23 Prepare      SET time_zone = '+00:00'
23 Close stmt   
23 Prepare      SELECT DISTINCT Images.id, Images.name, Images.album,   ...... 
AND ImageInformation.creationDate < ?    AND ImageInformation.creationDate >= ?
 ORDER BY Images.album
23 Reset stmt   
23 Execute      SELECT DISTINCT Images.id, Images.name, Images.album,  ......  
AND ImageInformation.creationDate < TIMESTAMP'2026-03-31 16:00:00'    AND
ImageInformation.creationDate >= TIMESTAMP'2026-02-28 16:00:00'  ORDER BY
Images.album
23 Close stmt   

The time range in the query condition is incorrect (2026-03-31 16:00:00 ~
2026-02-28 16:00:00);
SET time_zone = '+00:00' is only "Prepare" but never "Execute", so the session
time zone is not set to UTC.

The issue originates from the Qt MySQL driver plugin qssqlmysql.dll,
specifically in Commit 2781c3b (2024-03-15).
The intended purpose of this commit was to fix a daylight saving time (DST)
issue affecting timestamp storage/querying, by forcing the session time zone to
UTC and converting all TIMESTAMP values accordingly. A new function was
introduced:

static inline void setUtcTimeZone(MYSQL *mysql)
{
    static const char query[] = "SET time_zone = '+00:00'";
    if (mysql_stmt_prepare(stmt.get(), query, sizeof(query) - 1))
        mysql_stmt_execute(stmt.get());
}

error: The conditional logic is reversed – mysql_stmt_prepare returns 0 on
success and non‑zero on failure.
The current code executes mysql_stmt_execute only when Prepare fails, meaning
SET time_zone is never normally executed. As a result, the session time zone
remains unchanged.

Assuming your system's time zone is US Eastern Time (-05:00).  then setting a
picture's date to the first day of any month with a time earlier than 5:00 AM
will reliably reproduce the bug.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to