From: Yogesh J. (JIRA) <nh...@gm...> - 2011-02-20 04:52:45
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20569#action_20569 ] Yogesh Jagota commented on NH-2540: ----------------------------------- Patrick, it's not about conventions. My other conventions are working. It is only bools which are misbehaving. Even if I remove the convention completely, the bool is checked for string literals, instead of True & False. See these two queries v3.0.0.4000 only (after removing the convention): 2011-02-20 10:18:22,977 DEBUG INSERT INTO InvoiceDetails (InvoiceNumber, DocumentNumber, DocumentDate, DueDate, DivisionDetails, IsInvoice, IsCreditNote, OriginalAmount, Amount, LRNo, LRDate, DispatchedBy, CreditDays, CustomerId) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13); select last_insert_rowid();@p0 = 9070183358 [Type: Int64 (0)], @p1 = 28592879 [Type: Int64 (0)], @p2 = '20110210' [Type: String (0)], @p3 = '20110303' [Type: String (0)], @p4 = NULL [Type: String (0)], @p5 = True [Type: Boolean (0)], @p6 = False [Type: Boolean (0)], @p7 = 2685 [Type: Decimal (0)], @p8 = 2685 [Type: Decimal (0)], @p9 = NULL [Type: String (0)], @p10 = NULL [Type: String (0)], @p11 = NULL [Type: String (0)], @p12 = 21 [Type: Int32 (0)], @p13 = 101760 [Type: Int32 (0)] 2011-02-20 10:10:13,941 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 = 107233 [Type: Int32 (0)], @p1 = 'True' [Type: String (0)] In Inserts, the passed parameter is a Boolean (@p6), and in Selects, the parameter is a String (@p1). BTW, I upgraded from 2.1 and it also behaved the same way. Please look into. > Linq ignoring configured query-substitutions > -------------------------------------------- > > Key: NH-2540 > URL: http://216.121.112.228/browse/NH-2540 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.0.0.GA > Reporter: Yogesh Jagota > Assignee: Patrick Earl > Priority: Major > Fix For: 3.1.0 > > Attachments: Generated SQL.txt > > > 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. Generated SQL is attached. > Reason: > 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 the convention. > From generated SQL: > "!addInvoices" is passed as a string in the sql query and int in the previous version: > 3.0.0.1002: @p1 = True [Type: Int32 (0)] > 3.0.0.4000: @p1 = 'True' [Type: String (0)] > Also, the IsCreditNote database field is compared to 'true' and 'false' in the new version, and with 1 and 0 in the previous version. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |