Skip to content

Escape double quotes in connection string - #230

Merged
Z (zijchen) merged 7 commits into
masterfrom
zijchen/escape
Jun 27, 2024
Merged

Escape double quotes in connection string#230
Z (zijchen) merged 7 commits into
masterfrom
zijchen/escape

Conversation

@zijchen

Copy link
Copy Markdown
Contributor

Escape double quotes in connection string when passing to sqlpackage. Fixes #222 and #137

/**
* Returns the connection string escaped by double quotes.
*/
public get EscapedConnectionString() : string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do effectively the same thing with _parsedConnectionString and iterate through keys/values so that we don't need to parse a second time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did think about that but the issue with the key/value pair is the keys may have changed (e.g. Server becomes 'data source') and we'd still need to escape each value again. Since the full connection string is only used by sqlpackage, I wanted it to be as close to the one user supplied without changing it too much.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I see. Ok, I can live with that for sure. Can you put a comment here describing this decision?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

@zijchen
Z (zijchen) merged commit 439b52f into master Jun 27, 2024
@zijchen
Z (zijchen) deleted the zijchen/escape branch June 27, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use quotes in the connection string v2 - Connection string escaping for Authentication option

4 participants