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

Select statement not showing whitespace #302

Open
Max-crosskey opened this issue Dec 5, 2024 · 2 comments
Open

Select statement not showing whitespace #302

Max-crosskey opened this issue Dec 5, 2024 · 2 comments

Comments

@Max-crosskey
Copy link

Describe the bug

Select statement doesn't include leading blanks in character field, for example if the field has value ' X' then the select and generated insert statement becomes 'X'-

To Reproduce

Insert leading blanks into a character field, then do select from DB2 for i Extension.

Expected behavior

Would expect the return statement to include leading blanks and be ' X'

Screenshots

VSC:
select
image
insert
image

STRSQL:
image

Environment

  • OS: Windows 10
  • Extension Version 1.7.0

Other

Thought it might be a setting for the job but couldn't find it so apologies if I'm just blind

@worksofliam
Copy link
Contributor

Similar to #256.

@ThePrez is there something in the Mapepire that is trimming spaces from string fields?

@dferrand
Copy link

dferrand commented Dec 6, 2024

I think there are two reasons why we don't see those whitespaces:

1/ It looks like Mapepire does trim white spaces, I suspect it is the

.trim()
on the
cellDataForResponse = cellData.toString().trim();
line in BlockRetrievableRequest.java.
Trimming trailing whitespaces might make sense for fixed length fields since they convey no information. I think they should be kept for varying length fields (even if SQL ignores them for comparisons, they are technically different values).
Leading whitespaces should never be trimmed.

2/ Even if the whitespaces were not trimmed by Mapepire, the result is displayed in a div in a td where the default html behavior will be to trim leading whitespaces (and collapse multiple whitespaces for that matter). This can be solved here with css (white-space: pre;).

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

No branches or pull requests

3 participants