-
Notifications
You must be signed in to change notification settings - Fork 28
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
conditional quoting for database name and bypass syb_db_use() #59
base: master
Are you sure you want to change the base?
Conversation
- Addressed an issue with syb_db_use() truncating database names after 32chars in ct_command by bypassing the DSN "database" parameter entirely. - Instead, added an explicit "USE <database>" statement post-connection, ensuring the correct database context without triggering truncation behavior. This update improves connection stability and prevents issues with database names exceeding length limits, as encountered in some Sybase or FreeTDS configurations.
…ith length of database-names Updated database name assignment to add quotes if the name contains a hyphen (-), underscore (_) or dot (.), improving compatibility with database names requiring special handling. Addressed an issue with syb_db_use() truncating database names after 32 characters in ct_command by bypassing the DSN "database" parameter entirely. Added an explicit "USE " statement post-connection to set the database context directly, avoiding truncation issues in Sybase or FreeTDS configurations. These changes enhance connection stability and ensure proper handling of database names with special characters or length limitations.
PR summaryThis Pull Request addresses issues related to database name handling in the Sybase DBI plugin. It introduces conditional quoting for database names containing special characters such as hyphens, underscores, dots, and spaces, ensuring compatibility and stability during connection setup. Additionally, it resolves a problem with the SuggestionConsider adding unit tests to verify the correct handling of database names with various special characters and lengths. This would ensure that the changes work as expected across different scenarios and configurations. Additionally, updating the documentation to reflect these changes would help users understand the new behavior and its benefits. Disclaimer: This comment was entirely generated using AI. Be aware that the information provided may be incorrect. Current plan usage: 0.91% Have feedback or need help? |
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.
wrong parenthesis, it should look like this in line 21:
if (index($self->opts->currentdb, "-") != -1 || index($self->opts->currentdb, ".") != -1 || index($self->opts->currentdb, "_") != -1)
sorry!
… handling - Extended logic for handling database names to include spaces (" ") in the conditional quoting process. - Updated the condition to account for special characters, including hyphens (-), dots (.), underscores (_), and spaces. - Database names containing any of these characters are now enclosed in quotes to ensure proper handling during connection setup and queries. - Names without special characters continue to be passed directly without quotes. This update ensures robust handling of database names with complex characters, improving compatibility and stability across configurations.
Enhance database name handling and fix edge cases in DSN construction: This update is aimed at ensuring flexibility, stability, and correctness in database connections, particularly when dealing with diverse naming conventions. This update improves the handling of database names in the DSN construction and ensures compatibility with various edge cases. The following enhancements are included: Support for Special Characters: Database names containing hyphens (-), dots (.), underscores (_), or spaces ( ) are now automatically wrapped in double quotes (") to ensure proper handling during connection setup. Simplified Logic: The logic for determining when to add quotes around the database name has been streamlined, ensuring it covers all relevant cases while maintaining readability and maintainability. Names without special characters are passed as-is, avoiding unnecessary modifications and improving performance for common cases. Improved Stability: The changes ensure that database names with complex characters or whitespace do not cause connection errors or unexpected behavior, particularly in environments with stricter character handling. Example Cases Addressed: |
These changes enhance connection stability and ensure proper handling of database names with special characters or length limitations.