I know what the negation operator means.

What I wanted to say was, The latter version always returns the result
as this, regardless of the value of addInvoices...
where b.Customer == AddressedToCustomer && b.IsCreditNote == false

I found out the reason. The reason is that I am using a convention to
convert bools into ints (true=1, false=0). The previous version is
doing this conversion, the newer version isn't. The bool is converted
to a string in the newer version (as is the default in sqlite driver),
but it should be converted to int according to my convention.

See how "!addInvoices" is passed as a parameter in the sql query:
3.0.0.1002: @p1 = True [Type: Int32 (0)]
3.0.0.4000: @p1 = 'True' [Type: String (0)]

Also, the IsCreditNote is checked using 'true' and 'false' in the new
version, and with 1 and 0 in the previous version.

The summary is, 3.0.0.4000 is not taking my conventions into account.
I haven't changed anything except the references to the dlls.

I am using fluent hibernate, if that matters.

Thanks again.

On Feb 17, 5:40 pm, Fabio Maulo <[email protected]> wrote:
> == !addInvoices mean: equals to the negation of addInvoices
>
> On Thu, Feb 17, 2011 at 7:57 AM, Yogesh Jagota
> <[email protected]>wrote:
>
>
>
>
>
>
>
>
>
> > I have this query:
>
> > var items = (from b in session.Query<InvoiceDetail>()
> >                            where b.Customer == AddressedToCustomer &&
> > b.IsCreditNote == !
> > addInvoices
> >                            orderby b.DueDate , b.InvoiceNumber
> >                            select b).ToList();
>
> > This query works fine on 3.0.0.1002, but fails on 3.0.0.4000. The
> > latter version always returns the result as if addInvoices was always
> > true.
>
> > SQL Generated in 3.0.0.1002:
> > 2011-02-17 15:55:43,612 DEBUG select invoicedet0_.Id as Id3_,
> > invoicedet0_.InvoiceNumber as InvoiceN2_3_,
> > invoicedet0_.DocumentNumber as Document3_3_, invoicedet0_.DocumentDate
> > as Document4_3_, invoicedet0_.DueDate as DueDate3_,
> > invoicedet0_.DivisionDetails as Division6_3_, invoicedet0_.IsInvoice
> > as IsInvoice3_, invoicedet0_.IsCreditNote as IsCredit8_3_,
> > invoicedet0_.OriginalAmount as Original9_3_, invoicedet0_.Amount as
> > Amount3_, invoicedet0_.LRNo as LRNo3_, invoicedet0_.LRDate as
> > LRDate3_, invoicedet0_.DispatchedBy as Dispatc13_3_,
> > invoicedet0_.CreditDays as CreditDays3_, invoicedet0_.CustomerId as
> > CustomerId3_ from InvoiceDetails invoicedet0_ where
> > ((invoicedet0_.CustomerId is null) and (@p0 is null) or
> > invoicedet0_.CustomerId=@p0) and case when invoicedet0_.IsCreditNote=1
> > then 1 else 0 end=case when @p1=1 then 1 else 0 end order by
> > invoicedet0_.DueDate asc, invoicedet0_.InvoiceNumber asc;@p0 = 101790
> > [Type: Int32 (0)], @p1 = False [Type: Int32 (0)]
> > 2011-02-17 15:55:43,618 DEBUG select invoicedet0_.Id as Id3_,
> > invoicedet0_.InvoiceNumber as InvoiceN2_3_,
> > invoicedet0_.DocumentNumber as Document3_3_, invoicedet0_.DocumentDate
> > as Document4_3_, invoicedet0_.DueDate as DueDate3_,
> > invoicedet0_.DivisionDetails as Division6_3_, invoicedet0_.IsInvoice
> > as IsInvoice3_, invoicedet0_.IsCreditNote as IsCredit8_3_,
> > invoicedet0_.OriginalAmount as Original9_3_, invoicedet0_.Amount as
> > Amount3_, invoicedet0_.LRNo as LRNo3_, invoicedet0_.LRDate as
> > LRDate3_, invoicedet0_.DispatchedBy as Dispatc13_3_,
> > invoicedet0_.CreditDays as CreditDays3_, invoicedet0_.CustomerId as
> > CustomerId3_ from InvoiceDetails invoicedet0_ where
> > ((invoicedet0_.CustomerId is null) and (@p0 is null) or
> > invoicedet0_.CustomerId=@p0) and case when invoicedet0_.IsCreditNote=1
> > then 1 else 0 end=case when @p1=1 then 1 else 0 end order by
> > invoicedet0_.DueDate asc, invoicedet0_.InvoiceNumber asc;@p0 = 101790
> > [Type: Int32 (0)], @p1 = True [Type: Int32 (0)]
>
> > SQL Generated in 3.0.0.4000:
> > 2011-02-17 16:22:15,275 DEBUG select invoicedet0_.Id as Id3_,
> > invoicedet0_.InvoiceNumber as InvoiceN2_3_,
> > invoicedet0_.DocumentNumber as Document3_3_, invoicedet0_.DocumentDate
> > as Document4_3_, invoicedet0_.DueDate as DueDate3_,
> > invoicedet0_.DivisionDetails as Division6_3_, invoicedet0_.IsInvoice
> > as IsInvoice3_, invoicedet0_.IsCreditNote as IsCredit8_3_,
> > invoicedet0_.OriginalAmount as Original9_3_, invoicedet0_.Amount as
> > Amount3_, invoicedet0_.LRNo as LRNo3_, invoicedet0_.LRDate as
> > LRDate3_, invoicedet0_.DispatchedBy as Dispatc13_3_,
> > invoicedet0_.CreditDays as CreditDays3_, invoicedet0_.CustomerId as
> > CustomerId3_ from InvoiceDetails invoicedet0_ where
> > invoicedet0_.CustomerId=@p0 and case when invoicedet0_.IsCreditNote=1
> > then 'true' else 'false' end=case when @p1='true' then 'true' else
> > 'false' end order by invoicedet0_.DueDate asc,
> > invoicedet0_.InvoiceNumber asc;@p0 = 101790 [Type: Int32 (0)], @p1 =
> > 'False' [Type: String (0)]
> > 2011-02-17 16:22:15,279 DEBUG select invoicedet0_.Id as Id3_,
> > invoicedet0_.InvoiceNumber as InvoiceN2_3_,
> > invoicedet0_.DocumentNumber as Document3_3_, invoicedet0_.DocumentDate
> > as Document4_3_, invoicedet0_.DueDate as DueDate3_,
> > invoicedet0_.DivisionDetails as Division6_3_, invoicedet0_.IsInvoice
> > as IsInvoice3_, invoicedet0_.IsCreditNote as IsCredit8_3_,
> > invoicedet0_.OriginalAmount as Original9_3_, invoicedet0_.Amount as
> > Amount3_, invoicedet0_.LRNo as LRNo3_, invoicedet0_.LRDate as
> > LRDate3_, invoicedet0_.DispatchedBy as Dispatc13_3_,
> > invoicedet0_.CreditDays as CreditDays3_, invoicedet0_.CustomerId as
> > CustomerId3_ from InvoiceDetails invoicedet0_ where
> > invoicedet0_.CustomerId=@p0 and case when invoicedet0_.IsCreditNote=1
> > then 'true' else 'false' end=case when @p1='true' then 'true' else
> > 'false' end order by invoicedet0_.DueDate asc,
> > invoicedet0_.InvoiceNumber asc;@p0 = 101790 [Type: Int32 (0)], @p1 =
> > 'True' [Type: String (0)]
>
> > Can somebody help me in this regard.
>
> > Thanks.
>
> > --
> > 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