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

Capture storage cannot be fetched #83

Open
Nefarious46 opened this issue Oct 29, 2024 · 2 comments
Open

Capture storage cannot be fetched #83

Nefarious46 opened this issue Oct 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Nefarious46
Copy link
Contributor

Description
fetching storages for capture results in an error.

@Nefarious46 Nefarious46 added the bug Something isn't working label Oct 29, 2024
@Nefarious46
Copy link
Contributor Author

Apparently there has been brainfart with the checking if capture_id exists.
File R__Procedure_Retrieve_Capture_Storages.sql has null check where

  if (select count(id) from cfe_18.capture_def_x_flow_targets where capture_def_id = capture_id = 0) then
        SELECT JSON_OBJECT('id', capture_id, 'message', 'Capture storage does not exist with given ID') into @cs;
        signal sqlstate '45000' set message_text = @cs;

should be

    if ((select count(id) from cfe_18.capture_def_x_flow_targets where capture_def_id=capture_id)= 0) then
        SELECT JSON_OBJECT('id', capture_id, 'message', 'Capture storage does not exist with given ID') into @cs;
        signal sqlstate '45000' set message_text = @cs;

NOTICE missing parentheses from when count is taken from existing records. Above code snippet results always on TRUE due to assigning the value and not handling the count correctly.

This is currently applied locally but different pull request should be created where this is fixed.

@Nefarious46
Copy link
Contributor Author

Nefarious46 commented Oct 29, 2024

There appears to be unit test that checks this functionality but it does not seem to catch the error...?

File StorageControllerTest.java, Line:403

Should investigate why such error is not caught and implement such measures to other unit tests aswell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant