Closed esdrasbeleza closed 2 months ago
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)".
*float64
"%!s(float64=3.289113e+06)"
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)".
SELECT * FROM table WHERE someField = :float64Param
someField
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:
When inferTypes is called, it's passed down as
and the function converts it to
So if I call my query
SELECT * FROM table WHERE someField = :float64Param
, it won't work becausesomeField
won't match"%!s(float64=3.289113e+06)"
.