Improve SQL Security and Optimize Bank Management System Functionality #2595
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.
This pull request includes the following updates and improvements to the bank management system:
Admin Table Fix:
Modified the logic to insert the admin record only if it does not already exist, preventing duplicate entries.
Parameterized Queries:
Replaced all string formatting queries with parameterized queries to enhance security and prevent SQL injection vulnerabilities.
Tuple Syntax Corrections:
Fixed the tuple syntax in functions such as check_balance(acc_no) and get_detail(acc_no) by using (acc_no,) instead of (acc_no).
Optimized Balance Operations:
Improved balance update and retrieval functions by leveraging SQL arithmetic operations instead of fetching, modifying, and then updating values manually.
These changes not only improve security and reliability but also streamline the overall code performance and maintainability. Please review the updates and let me know if there are any further changes needed.