Open GoogleCodeExporter opened 9 years ago
Defaults are currently awkard so yes, you need to quote them yourself. That
might not
be the workaround, it might be the solution.
Defaults have to support '0' as well as (getdate()), so we can't automatically
just
quote the string.
Original comment by geoffl...@gmail.com
on 20 Mar 2009 at 1:30
I just fixed the equivalent issue for Oracle (in our local copy), but went
about it
like this:
public override string Default(object defaultValue)
{
if (defaultValue is DateTime)
{
DateTime dt = (DateTime) defaultValue;
string dtString= dt.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss");
defaultValue =
string.Format("to_date('{0}', 'yyyy-mm-dd hh24:mi:ss')", dtString);
}
else if (defaultValue is string)
{
defaultValue = string.Format("'{0}'", defaultValue);
}
return base.Default(defaultValue);
}
I would say that the dialect should do the quoting, so that dialect
specificness
doesn't leak out into the Migrations. Then handle functions such as getdate()
as a
new class specific e.g class Fn {...} that Dialect.Default can test for as
above.
Original comment by richard....@googlemail.com
on 12 Jul 2009 at 12:15
Original issue reported on code.google.com by
jimmy.shimizu
on 12 Mar 2009 at 11:07