The matter is what happen in the driver when we use SqlDbType.Time and the
server is SQL2000.
which is the number of that issue ?

On Thu, Apr 21, 2011 at 12:46 PM, Neal Groothuis
<[email protected]>wrote:

> Fabio,
>
> As I noted before, I don't have access to a SQL 2000 or 2005
> instance.  I only have 2008.  However, I'm not sure that it's
> meaningful to do so; SQL 2000 and 2005 don't have a TIME type.
>
> If you'll reopen the issue, I'll attach the patch.
>
> - Neal
>
> On Apr 21, 10:48 am, Fabio Maulo <[email protected]> wrote:
> > does it works also for MsSQL2000 and MsSQL2005 ?
> > If yes, please attach the patch to your issue.
> >
> > On Thu, Apr 21, 2011 at 11:37 AM, Neal Groothuis
> > <[email protected]>wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I just verified that the unit test works with the change I suggested.
> > > The exact code that I added to NHibernate.Driver.SqlClientDriver is:
> >
> > >        protected override void InitializeParameter(IDbDataParameter
> > > dbParam, string name, SqlType sqlType)
> > >        {
> > >            base.InitializeParameter(dbParam, name, sqlType);
> > >             if (sqlType.DbType == DbType.Time)
> > >                ((SqlParameter) dbParam).SqlDbType = SqlDbType.Time;
> > >        }
> >
> > > This seems like it's the ideal place to work around MS's error, since
> > > the InitializeParameter() method is responsible for setting the name
> > > and type of the parameter.
> >
> > > On Apr 21, 7:50 am, Fabio Maulo <[email protected]> wrote:
> > > > That ok too
> >
> > > > On Wed, Apr 20, 2011 at 8:40 PM, Neal Groothuis <
> > > [email protected]>wrote:
> >
> > > > > I'm out for tonight, but hopefully I'll be able to do some more
> work
> > > > > on this tomorrow morning Eastern time (UTC-04).  I've got a copy of
> > > > > the NHibernate 3.1.0 source built and ready to hack on, and I'm
> happy
> > > > > to help test, but I'm not clear on what you're suggesting that I
> do.
> > > > > Where do you want me to copy the SqlClientDriver implementation to,
> > > > > and what does SetParameterSizes have to do with this?
> >
> > > > > My proposed solution was to override InitializeParameter() in
> > > > > NHibernate.Driver.SqlClientDriver, a la:
> >
> > > > > protected override void InitializeParameter(IDbDataParameter
> dbParam,
> > > > > string name, SqlType sqlType) {
> > > > >    base.InitializeParameter(dbParam, name, sqlType);
> > > > >    if(sqlType == Time)
> > > > >        ((SqlParameter)dbParam).SqlDbType = Time;
> > > > > }
> >
> > > > > Forgive me if this isn't quite right; I don't have VS on this
> machine,
> > > > > but that's the basic idea.
> >
> > > > > On Apr 20, 6:31 pm, Neal Groothuis <[email protected]>
> wrote:
> > > > > > I don't have access to SQL Server 2005 or 2000.
> >
> > > > > > On Apr 20, 6:28 pm, Fabio Maulo <[email protected]> wrote:
> >
> > > > > > > copy&paste our SqlClientDriver implementation and change
> > > > > > > the SetParameterSizes implementation setting the parameter type
> > > > > > > to SqlDbType.Time. We have to check if something wrong happen
> for
> > > > > MsSQL2005
> > > > > > > and MsSQL2000.
> >
> > > > > > > On Wed, Apr 20, 2011 at 6:54 PM, Neal Groothuis <
> > > > > [email protected]>wrote:
> >
> > > > > > > > Fabio,
> >
> > > > > > > > I'm not certain what you're asking me to check.
> >
> > > > > > > > As for "pushing" Microsoft:  what, specifically, are you
> > > proposing
> > > > > > > > that I do?
> >
> > > > > > > > - Neal
> >
> > > > > > > > On Apr 20, 5:16 pm, Fabio Maulo <[email protected]>
> wrote:
> > > > > > > > > So we have to change the SqlClientDrive...
> > > > > > > > > Have you time to check something ?
> > > > > > > > > ARG!!! somebody have changed the SqlClientDriver methods to
> > > > > static...
> > > > > > > > > I'll fix it later...
> > > > > > > > > Well... copy&paste our SqlClientDriver implementation and
> > > change
> > > > > > > > > the SetParameterSizes implementation setting the parameter
> type
> > > > > > > > > to SqlDbType.Time. We have to check if something wrong
> happen
> > > for
> > > > > > > > MsSQL2005
> > > > > > > > > and MsSQL2000.
> > > > > > > > > If nothing wrong happen we can maintain just one
> > > implementation.
> > > > > > > > > Were it fail, we have to implement another drive.
> >
> > > > > > > > > btw, Neal, the fact remain: we have to push ppl in
> Microsoft to
> > > > > respect
> > > > > > > > > their rules
> > > > > > > > > When setting command parameters, the SqlDbType and
> > > > > > > > > DbType<
> >
> > >
> http://msdn.microsoft.com/en-us/library/system.data.dbtype(v=VS.90).aspx>
> > > > > > > > > are
> > > > > > > > > linked. Therefore, setting the DbType changes the SqlDbType
> to
> > > a
> > > > > > > > supporting
> > > > > > > > > SqlDbType.
> >
> > > > > > > > > On Wed, Apr 20, 2011 at 6:01 PM, Neal Groothuis <
> > > > > > > > [email protected]>wrote:
> >
> > > > > > > > > > The SqlDbType enum is System.Data.SqlDbType, in the
> > > System.Data
> > > > > > > > > > assembly.
> >
> > > > > > > > > > On Apr 20, 4:56 pm, Fabio Maulo <[email protected]>
> > > wrote:
> > > > > > > > > > > In which assembly is the SqlType.Time ?
> >
> > > > > > > > > > > On Wed, Apr 20, 2011 at 5:54 PM, Neal Groothuis <
> > > > > > > > > > [email protected]>wrote:
> > > > > > > > > > > > Fabio,
> >
> > > > > > > > > > > > I don't see a way to practically get "Microsoft to
> follow
> > > > > their
> > > > > > > > > > > > rules", especially after they've said that, yes, it's
> a
> > > bug,
> > > > > but
> > > > > > > > they
> > > > > > > > > > > > believe that fixing it in existing versions of .NET
> would
> > > > > cause
> > > > > > > > more
> > > > > > > > > > > > harm than good.
> >
> > > > > > > > > > > > What's gained by forcing users to have to come up
> with
> > > ugly
> > > > > hacks
> > > > > > > > when
> > > > > > > > > > > > the problem can be accommodated easily and cleanly in
> the
> > > > > core of
> > > > > > > > > > > > NHibernate by overriding a method and adding two
> lines?
> >
> > > > > > > > > > > > - Neal
> >
> > > > > > > > > > > > On Apr 20, 2:55 pm, Fabio Maulo <
> [email protected]>
> > > > > wrote:
> > > > > > > > > > > > > In practice...
> > > > > > > > > > > > > When an OSS RDBMS does not follow DbType rules we
> ask
> > > them
> > > > > to fix
> > > > > > > > the
> > > > > > > > > > > > > problem.
> > > > > > > > > > > > > Microsoft said "good bye" to Oracle data-provider
> and
> > > now
> > > > > Oracle
> > > > > > > > have
> > > > > > > > > > to
> > > > > > > > > > > > > follow all rules defined by Microsoft.
> >
> > > > > > > > > > > > > We all should push Microsoft to follow his rules at
> > > first.
> >
> > > > > > > > > > > > > NOTE: the same is for the DbProviderFactories its
> > > famous
> > > > > > > > "invariant"
> > > > > > > > > > name
> > > > > > > > > > > > > and the first one breaking the rule who was...
> again
> > > > > Microsoft
> > > > > > > > for
> > > > > > > > > > SQLCe
> > > > > > > > > > > > > versions.
> >
> > > > > > > > > > > > > On Wed, Apr 20, 2011 at 3:49 PM, Fabio Maulo <
> > > > > > > > [email protected]>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > NH-2661 was closed.
> > > > > > > > > > > > > > Microsoft said:
> > > > > > > > > > > > > > "Thanks for reporting this issue. This is a bug
> in
> > > our
> > > > > product,
> > > > > > > > but
> > > > > > > > > > > > after
> > > > > > > > > > > > > > carefully investigating the issue, we have
> decided
> > > not to
> > > > > fix
> > > > > > > > the
> > > > > > > > > > bug.
> > > > > > > > > > > > "
> >
> > > > > > > > > > > > > > We say:
> > > > > > > > > > > > > > We are not the workaround fabric. If one of your
> > > > > customer, who
> > > > > > > > pay
> > > > > > > > > > to
> > > > > > > > > > > > have
> > > > > > > > > > > > > > your product, say that you have a bug and then
> you
> > > admit
> > > > > that
> > > > > > > > you
> > > > > > > > > > have
> > > > > > > > > > > > a
> > > > > > > > > > > > > > bug, then you have to fix it.
> >
> > > > > > > > > > > > > > On Wed, Apr 20, 2011 at 3:36 PM, Neal Groothuis <
> > > > > > > > > > > > [email protected]>wrote:
> >
> > > > > > > > > > > > > >> Hi Fabio,
> >
> > > > > > > > > > > > > >> I've raised two: NH-2660 and NH-2661, with
> failing
> > > tests
> > > > > > > > attached.
> > > > > > > > > > > > > >> I've also got potential solutions for both.  The
> > > Set()
> > > > > method
> > > > > > > > on
> > > > > > > > > > the
> > > > > > > > > > > > > >> custom TimeType in the test for NH-2661 is one
> > > possible
> > > > > fix
> > > > > > > > for
> > > > > > > > > > > > > >> NH-2660, and I've included a possible solution
> to
> > > > > NH-2661 in
> > > > > > > > the
> > > > > > > > > > > > > >> comments on the issue.
> >
> > > > > > > > > > > > > >> Please let me know if you have questions or if I
> can
> > > > > help
> > > > > > > > further!
> >
> > > > > > > > > > > > > >> - Neal
> >
> > > > > > > > > > > > > >> On Apr 19, 8:21 am, Fabio Maulo <
> > > [email protected]>
> > > > > wrote:
> > > > > > > > > > > > > >> > mmmm perhaps yes.
> > > > > > > > > > > > > >> > There is a problem in the Set.
> > > > > > > > > > > > > >> > Have you a failing test ?
> > > > > > > > > > > > > >> > If yes please file a JIRA ticket asap.
> > > > > > > > > > > > > >> > Thanks.
> >
> > > > > > > > > > > > > >> > On Tue, Apr 19, 2011 at 9:17 AM, Fabio Maulo <
> > > > > > > > > > [email protected]>
> > > > > > > > > > > > > >> wrote:
> > > > > > > > > > > > > >> > > public class MsSql2008Dialect :
> MsSql2005Dialect
> > > > > > > > > > > > > >> > > {
> > > > > > > > > > > > > >> > > protected override void
> > > > > RegisterDateTimeTypeMappings()
> > > > > > > > > > > > > >> > >  {
> > > > > > > > > > > > > >> > > base.RegisterDateTimeTypeMappings();
> > > > > > > > > > > > > >> > > RegisterColumnType(DbType.DateTime2,
> > > "DATETIME2");
> > > > > > > > > > > > > >> > >  RegisterColumnType(DbType.DateTimeOffset,
> > > > > > > > "DATETIMEOFFSET");
> > > > > > > > > > > > > >> > > RegisterColumnType(DbType.Date, "DATE");
> > > > > > > > > > > > > >> > >  RegisterColumnType(DbType.Time, "TIME");
> > > > > > > > > > > > > >> > > }
> >
> > > > > > > > > > > > > >> > > On Mon, Apr 18, 2011 at 7:11 PM, Neal
> Groothuis
> > > <
> > > > > > > > > > > > > >> [email protected]>wrote:
> >
> > > > > > > > > > > > > >> > >> Hey all,
> >
> > > > > > > > > > > > > >> > >> I have a table with two TIME columns on a
> SQL
> > > > > Server 2008
> > > > > > > > > > > > database.
> > > > > > > > > > > > > >> > >> I'm running into problems when I try to
> query
> > > > > against
> > > > > > > > them,
> > > > > > > > > > and I
> > > > > > > > > > > > > >> > >> think this is a bug in the Set() methods
> for
> > > the
> > > > > > > > > > > > TimeAsTimeSpanType,
> > > > > > > > > > > > > >> > >> TimeSpanType, and TimeType classes.
> >
> > > > > > > > > > > > > >> > >> All of these methods add the value that's
> > > passed to
> > > > > the
> > > > > > > > Set()
> > > > > > > > > > > > method
> > > > > > > > > > > > > >> > >> to the parameter array as a DateTime
> object,
> > > but at
> > > > > least
> > > > > > > > on
> > > > > > > > > > this
> > > > > > > > > > > > > >> MSDN
> > > > > > > > > > > > > >> > >> page (
> > > > > > > >http://msdn.microsoft.com/en-us/library/cc716729.aspx),
> > > > > > > > > > it
> > > > > > > > > > > > > >> shows
> > > > > > > > > > > > > >> > >> that the .NET type that's associated with
> >
> > ...
> >
> > read more ยป
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to