Deconz-rest-plugin: DeRestPluginPrivate::clearDb also clears auth table

Created on 15 Jun 2020  路  10Comments  路  Source: dresden-elektronik/deconz-rest-plugin

Describe the bug

The file database.cpp has a function "DeRestPluginPrivate::clearDb()", and the comment on this function states:

Clears all content of tables of db except auth table

However in the function code is the following:

// clear tables

    const char *sql[] = {
        "DELETE FROM auth",

Either the comment is wrong, or outdated.
Or the "auth" table is cleaned by mistake.

Awaiting Merge Bug report

Most helpful comment

None of that info is relevant for this issue.

All 10 comments

As per bug report template, you've removed allot of requested info.

Please add that info, so we can determine on which version/firmware this is.

I'm sorry, what exactly do you want me to add here?
While working on another issue and looking up the code, I stumbled over this discrepancy.

There is a function which code apparently doesn't match the comment above the function. Can't provide more information than that.

Here is the function: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/database.cpp#L728

Someone else has to see if:

  • just leave the discrepancy until someone else discovers it again
  • the comment is correct and the table should not be cleaned out
  • the code is correct and the comment should be fixed

Please advise.

Environment

  • Host system: (Raspberry Pi / PC / NAS)
  • Running method: (Raspbian / Ubuntu / Home Assistent deCONZ Add-on / Marthoc Docker container / Windows / Virtual Machine)
  • Firmware version: (26xxyy00)
  • deCONZ version: (2.xx.yy)
  • Device: (ConBee I / ConBee II / RaspBee I / RaspBee II)
  • Do you use an USB extension cable: (yes / no) -- only relevant for ConBee I/II

There's allot of this missing here..

None of that info is relevant for this issue.

@Mimiix Seriously, what has any of the excluded information to do with a discrepancy in the code?
Please review what this report is about. This is not about a specific device, or a supported platform. It's simply a problem in the source code.

Fair enough :)

It looks like the function isn't used at all and seems to be dead code. I think we can safely remove it.

image

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Bump

Thanks for the reminder, I created a PR to remove this function.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

donnib picture donnib  路  102Comments

robertlandes picture robertlandes  路  161Comments

NicolasBoulanger picture NicolasBoulanger  路  155Comments

mathos77 picture mathos77  路  100Comments

kmplngj picture kmplngj  路  121Comments