--
You received this message because you are subscribed to the Google Groups "Npgsql Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to npgsql-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think the cast is missing also when EF is not used:using (var cmd = new Npgsql.NpgsqlCommand("select :ts", conn)){cmd.Connection.Open();cmd.Parameters.Add(new Npgsql.NpgsqlParameter("ts", new TimeSpan(1, 2, 3, 4)));using (var rdr = cmd.ExecuteReader()){while (rdr.Read()){Console.Out.WriteLine(rdr.GetTimeSpan(0));}}}That throws an exception because String could not be converted to TimeSpan.
2014-07-19 2:00 GMT+02:00 Emil Lenngren <>:
Same thing happens with TimeSpan, a literal string is generated for parameterized query, without a cast.In the EF sql generator, when having a TimeSpan as a literal, it is now generated as the literal string TIME '01:02:03' (in VisitedExpression.cs). Wouldn't it be better to use interval instead so days can be included too?
Den lördagen den 19:e juli 2014 kl. 00:02:36 UTC+2 skrev Emil Lenngren:Hi. I'm trying to implement some date/time functions in Entity Framework SQL generation.I notice that when I have parameters of type DateTime, the SQL will contain a parameter: @p__linq__1 which will later be converted to a string literal like (('2014-07-11 11:11:53.677724')). Since this is a string and not a timestamp data type, I get some exceptions for wrong data types.Is there a reason it is not serialized as (('2014-07-11 11:11:53.677724')::timestamp) or (timestamp '2014-07-11 11:11:53.677724')?I see that in AppendParameterValue in NpgsqlCommand.Rewrite.cs, parameter.UseCast is false instead of true.If I instead write an inline DateTime directly in the Linq query instead of having a variable, I get TIMESTAMP '2014-12-29T14:01:00.0000000' which works.
--
You received this message because you are subscribed to the Google Groups "Npgsql Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to npgsql-dev+unsubscribe@googlegroups.com.