connection string/url parsing and generation in the server configuration dialog
This commit is contained in:
parent
a5cb6ef7d4
commit
1d53ca2fc2
11 changed files with 410 additions and 62 deletions
|
|
@ -67,13 +67,29 @@ public class PqConnectionStringTokenizer : IPqConnectionStringTokenizer
|
|||
{
|
||||
while (position < input.Length && char.IsWhiteSpace(input[position]))
|
||||
position++;
|
||||
// If a semicolon is encountered between pairs (which is not valid in libpq),
|
||||
// treat as immediate EOF so parser stops and leaves trailing data unparsed.
|
||||
if (position < input.Length && input[position] == ';')
|
||||
{
|
||||
position = input.Length; // force EOF
|
||||
}
|
||||
}
|
||||
|
||||
private string UnquotedString(bool forKeyword)
|
||||
{
|
||||
int start = position;
|
||||
while (++position < input.Length && !char.IsWhiteSpace(input[position]) && (!forKeyword || input[position] != '='))
|
||||
{ }
|
||||
while (++position < input.Length)
|
||||
{
|
||||
char c = input[position];
|
||||
// Libpq syntax does not use semicolons as pair separators; treat ';' as invalid here
|
||||
if (c == ';')
|
||||
{
|
||||
// Force tokenizer to stop and later cause a parse error by making GetValue/keyword incomplete
|
||||
break;
|
||||
}
|
||||
if (char.IsWhiteSpace(c)) break;
|
||||
if (forKeyword && c == '=') break;
|
||||
}
|
||||
return input.Substring(start, position - start);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue