Skip to content
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

Error while passing a named parameter with a value of type *float64 #214

Closed
esdrasbeleza opened this issue Apr 11, 2024 · 0 comments · Fixed by #215
Closed

Error while passing a named parameter with a value of type *float64 #214

esdrasbeleza opened this issue Apr 11, 2024 · 0 comments · Fixed by #215

Comments

@esdrasbeleza
Copy link
Contributor

Summary

If I have a variable typed as *float64 as pass it down to a query as a named parameter, the query won't work because it will be valued as "%!s(float64=3.289113e+06)".

Details

I have the following named parameter:

someFloat := float64(3289113)
namedParam := sql.Named("float64Param", &someFloat)

When inferTypes is called, it's passed down as

Parameter{
  Name: "float64Param",
  Type: SqlUnkown,
  Value: interface{}(float64) 3289113,
}

and the function converts it to

Parameter{
  Name: "float64Param",
  Type: SqlString,
  Value: interface {}(string) "%!s(float64=3.289113e+06)", // wrong!
}

So if I call my query SELECT * FROM table WHERE someField = :float64Param, it won't work because someField won't match "%!s(float64=3.289113e+06)".

kravets-levko pushed a commit that referenced this issue Apr 12, 2024
Attempt to fix #214

Signed-off-by: Esdras Beleza <esdras@esdrasbeleza.com>
esdrasbeleza added a commit to esdrasbeleza/databricks-sql-go that referenced this issue Apr 15, 2024
Attempt to fix databricks#214

Signed-off-by: Esdras Beleza <esdras@esdrasbeleza.com>
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 a pull request may close this issue.

1 participant