-
Notifications
You must be signed in to change notification settings - Fork 234
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
Make parameter length based on underlying column length except for complex ops #2627
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you for raising and then solving this issue. Just had a few nits, and a question.
It’s to cover the edge case of matching with the LiKE that you get with contains and starts with, and also the escaping of values that occurs in the predicates. If you don’t you can end up with false positives and false negatives
Simon Sabin
________________________________
From: aaronburtle ***@***.***>
Sent: Thursday, March 20, 2025 9:19:26 PM
To: Azure/data-api-builder ***@***.***>
Cc: Simon Sabin ***@***.***>; Author ***@***.***>
Subject: Re: [Azure/data-api-builder] Make parameter length based on underlying column length except for complex ops (PR #2627)
@aaronburtle commented on this pull request.
________________________________
In src/Service.Tests/DatabaseSchema-MsSql.sql<#2627 (comment)>:
@@ -514,7 +514,7 @@ SET IDENTITY_INSERT books ON
INSERT INTO books(id, title, publisher_id)
VALUES (1, 'Awesome book', 1234),
(2, 'Also Awesome book', 1234),
-(3, 'Great wall of china explained', 2345),
+(3, 'Great wall of china explained]', 2345),
I am curious, why the extra "]"?
—
Reply to this email directly, view it on GitHub<#2627 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAJHM2Z7OZVBM5HTNT3F6SD2VMWF5AVCNFSM6AAAAABZOI6YHOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDOMBUGEZTOMRTG4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Co-authored-by: aaronburtle <[email protected]>
Co-authored-by: aaronburtle <[email protected]>
applied suggested changes |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
Pipeline failures are just whitespace format. |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
src/Service.Tests/SqlTests/GraphQLQueryTests/MsSqlGraphQLQueryTests.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/SqlTests/GraphQLQueryTests/MsSqlGraphQLQueryTests.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/SqlTests/GraphQLQueryTests/MsSqlGraphQLQueryTests.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/SqlTests/GraphQLQueryTests/MsSqlGraphQLQueryTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you again for finding this issue and fixing it as well!!
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for making these changes, looks great.
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
Why make this change?
Fixes issue #2626
What is this change?
Where a parameter is linked to an underlying column in the data model the length is stored
When the query is executed the length is used to ensure parameters have consistent lengths
For certain operations the value is padded with escape characters or %s, these need to be allowed for. In those cases the length is set to -1 (max) in order that the extra characters are allowed for AND consistent lengths are maintained
How was this tested?
Checking the resultant query is using the right length was done using trace. Not sure with the architecture whether it would be possible to mock at that level.
Sample Request(s)
See new tests TestFilterParamForStringFilterWorkWithComplexOp and TestFilterParamForStringFilterWorkWithNotContains