Slight Optimization to Logging and Paging Endpoints and Parameterized SQL Queries #681
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
Made some slight formatting/optimization fixes to the FarmData2 Logging Endpoint. In addition, I also parameterized(in lieu of concatenation) SQL queries so that user input is treated as data, not as part of the SQL command itself. This prevents SQL injection and stops unauthorized commands from being run via the endpoint. Prepared statements utilize ? as placeholders for logType, startTime, endTime, startIndex, and limit. I also removed pagination and instead handled that in the LIMIT section of the query.
I'm currently putting this in a "DRAFT" pull request because I would like to test out some more behaviors before making this reviewable.
Licensing Certification
FarmData2 is a Free Cultural Work and all accepted contributions are licensed as described in the LICENSE.md file. This requires that the contributor holds the rights to do so. By submitting this pull request I certify that I satisfy the terms of the Developer Certificate of Origin for its contents.