From: Yogesh J. (JIRA) <nh...@gm...> - 2011-02-22 06:54:53
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20577#action_20577 ] Yogesh Jagota commented on NH-2540: ----------------------------------- I have attached the test case. Save outputs the correct SQL. Query<> again substitutes string literals in place of True and False. Output: NHibernate: INSERT INTO DomainClass (ByteData, Id) VALUES (@p0, @p1);@p0 = True [Type: Boolean (0)], @p1 = 1 [Type: Int32 (0)] NHibernate: select domainclas0_.Id as Id0_, domainclas0_.ByteData as ByteData0_ from DomainClass domainclas0_ where case when domainclas0_.ByteData=1 then 'true' else 'false' end=case when @p0='true' then 'true' else 'false' end;@p0 = 'True' [Type: String (0)] > 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 > Attachments: Generated SQL.txt, NH2540.zip > > > 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 |