You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These want a single deliberate answer rather than two accidental ones. Roughly:
Defer everywhere. Drop the ToParameterType call so both match AddParameter. Fixes AddNamedParameter sends a UTC DateTime as 'timestamp without time zone' and throws at execution #403 for free and is closest to what each ADO.NET driver does best, since drivers resolve per value. Changes behaviour for SQL Server / Oracle / MySQL / SQLite too, so it needs checking that their inference matches Weasel's mapping the way Npgsql's does.
Stamp everywhere, per value. Give providers a value-aware hook so PostgreSQL can answer timestamptz vs timestamp from DateTime.Kind. Keeps types explicit but duplicates driver logic in Weasel.
Note ToParameterType also throws for types with no mapping (and for arrays on SQL Server / Oracle / MySQL), so today AddNamedParameter can throw where AddParameter succeeds. Whichever direction is chosen should settle that too.
Split out of #398 / #402. Closely tied to #403.
Given no explicit
dbType, the two sibling APIs onDatabaseProviderdo opposite things:Observable difference:
Two knock-on effects:
DateTime.param.NpgsqlDbTypereportsUnknownuntil Npgsql's process-global type mapper has been seeded, which made a test flaky.These want a single deliberate answer rather than two accidental ones. Roughly:
ToParameterTypecall so both matchAddParameter. Fixes AddNamedParameter sends a UTC DateTime as 'timestamp without time zone' and throws at execution #403 for free and is closest to what each ADO.NET driver does best, since drivers resolve per value. Changes behaviour for SQL Server / Oracle / MySQL / SQLite too, so it needs checking that their inference matches Weasel's mapping the way Npgsql's does.timestamptzvstimestampfromDateTime.Kind. Keeps types explicit but duplicates driver logic in Weasel.Note
ToParameterTypealso throws for types with no mapping (and for arrays on SQL Server / Oracle / MySQL), so todayAddNamedParametercan throw whereAddParametersucceeds. Whichever direction is chosen should settle that too.