Implement proper quote handling for PostgreSQL connection strings#15
Implement proper quote handling for PostgreSQL connection strings#15
Conversation
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
wdconinc
left a comment
There was a problem hiding this comment.
@copilot The changes to Database.cpp tie the interface much too close to postgresql. We use sqlpp23 to have an intermediate, implementation-agnostic interface. Using PQconinfoOption violates this benefit. Re-assess this and find a solution for input validation and quoting that maintains the implementation-agnostic sqlpp23 interface.
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Reverted the PostgreSQL-specific implementation and replaced it with a custom parser that maintains the implementation-agnostic sqlpp23 interface. The new implementation properly handles quoted values and escaped characters without using |
The custom connection string parser did not handle quoted values, breaking passwords with spaces or special characters.
Changes
connection_configinterface, preserving the implementation-agnostic design principletrue/false,on/off,yes/no,1/0(case-insensitive)Example
Before:
After:
Documentation
Updated
docs/README.mdwith connection string format reference and examples showing proper quoting.Design Note
The implementation uses a custom parser rather than libpq's
PQconninfoParse()to maintain the implementation-agnostic interface provided by sqlpp23. This ensures the codebase doesn't become tightly coupled to PostgreSQL-specific types while still providing full quote handling support.Original prompt
<issue_description>See
Database.cpp:Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.