Closed Techcraft7 closed 1 year ago
When using the REST Driver, any variables in the query that arent in the vars dictionary have their $ symbol removed.
$
However, this only happens when the vars dictionary is not empty, resulting in a call to FormatVarsSlow.
FormatVarsSlow
EX:
LET $x = 5;
With the vars dictionary { ["y"] = 6 }
{ ["y"] = 6 }
Would become:
LET x = 5;
This causes the query to fail.
This bug appears to be caused by this line. Adding result.Append('$'); before this line might be the solution to this issue.
result.Append('$');
string? result = typeof(DatabaseRest).GetMethod( "FormatVarsSlow", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) // "db" is the driver instance ?.Invoke(db, new object[] { @"LET $x = 5", new Dictionary<string, object?>() { ["y"] = 6 } }) as string;
result
"LET x = 5"
IDatabase.Query should not do anything to any variables that are not in the vars dictionary parameter.
IDatabase.Query
1.0.8
v1.0.0-beta.8
Thanks a lot for the PR!
oops forgot to close this fixed with #115
Describe the bug
When using the REST Driver, any variables in the query that arent in the vars dictionary have their
$
symbol removed.However, this only happens when the vars dictionary is not empty, resulting in a call to
FormatVarsSlow
.EX:
With the vars dictionary
{ ["y"] = 6 }
Would become:
This causes the query to fail.
This bug appears to be caused by this line. Adding
result.Append('$');
before this line might be the solution to this issue.Steps to reproduce
FormatVarsSlow
, the method responsible for replacing variables in the query.result
will be"LET x = 5"
Expected behaviour
IDatabase.Query
should not do anything to any variables that are not in the vars dictionary parameter.Surreal.NET driver version
1.0.8
SurrealDB version
v1.0.0-beta.8
Is there an existing issue for this?