•  
      request #46797 Drop usages of `LAST_INSERT_ID()`
    Infos
    #46797
    Kevin Traini (ktraini)
    2026-02-18 17:03
    2026-02-18 08:55
    48523
    Details
    Drop usages of `LAST_INSERT_ID()`

    We should stop using it in favor of driver call

    Current usages:

    • [x] Docman_ReportDao
    • [x] Docman_ApprovalTableItemDao
    • [x] Docman_MetadataDao
    • [x] Docman_MetadataListOfValuesElementDao
    • [x] Docman_MetadataValueDao
    • [x] Docman_VersionDao

    We ignore usages in install.sql, it should not have any impact as it is run only for plugins install

    Empty
    Empty
    Empty
    • [ ] enhancement
    • [x] internal improvement
    Empty
    Stage
    Empty
    Closed
    2026-02-18
    Attachments
    Empty
    References
    Referenced by request #46797

    Follow-ups

    User avatar
    Kevin Traini (ktraini)2026-02-18 17:00

    Remaining usages are:

    ❯ grep -rnw . -e 'LAST_INSERT_ID()'
    ./plugins/docman/db/install.sql:597:VALUES (LAST_INSERT_ID(), 0, 100, 'roottitle_lbl_key', '', UNIX_TIMESTAMP(NOW()), UNIX_TIMESTAMP(NOW()), NULL, 101, 100, 0, 0, 1, NULL, NULL, NULL);
    ./plugins/hudson/db/install.sql:44:FROM (SELECT LAST_INSERT_ID() as last_insert_id) AS R, `groups`;
    ./plugins/hudson/db/install.sql:55:FROM (SELECT LAST_INSERT_ID() as last_insert_id) AS R, `groups`;
    ./plugins/hudson/db/install.sql:66:FROM (SELECT LAST_INSERT_ID() as last_insert_id) AS R, `groups`;
    ./plugins/openidconnectclient/db/install.sql:67:VALUES ((SELECT LAST_INSERT_ID() FROM plugin_openidconnectclient_provider),
    

    We'll ignore them

    User avatar
    Thomas Gerbet (tgerbet)2026-02-18 16:57
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    • Status changed from Under implementation to Closed
    • Connected artifacts
    • Close date set to 2026-02-18
    User avatar
    Thomas Gerbet (tgerbet)2026-02-18 13:39
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    User avatar
    Thomas Gerbet (tgerbet)2026-02-18 13:32
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    User avatar
    Thomas Gerbet (tgerbet)2026-02-18 12:11
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    User avatar
    Kevin Traini (ktraini)2026-02-18 11:50
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    User avatar
    Kevin Traini (ktraini)2026-02-18 10:01
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes