From: Yogesh J. (JIRA) <nh...@gm...> - 2011-02-17 15:44:26
|
3.0.0.4000 is not taking conventions into account when generating SQL for linq queries -------------------------------------------------------------------------------------- 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 Priority: Major 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-02-17 17:27:38
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Patrick Earl reassigned NH-2540: -------------------------------- Assignee: Patrick Earl > 3.0.0.4000 is not taking conventions into account when generating SQL for linq queries > -------------------------------------------------------------------------------------- > > 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 > > > 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 |
From: Fabio M. (JIRA) <nh...@gm...> - 2011-02-19 13:58:36
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo updated NH-2540: ---------------------------- Summary: Linq ignoring configured query-substitutions (was: 3.0.0.4000 is not taking conventions into account when generating SQL for linq queries) > 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 > > > 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-02-20 02:26:49
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20567#action_20567 ] Patrick Earl commented on NH-2540: ---------------------------------- The default for the SQLite Dialect is 0 and 1. The query would use the type of IsCreditNote, not the literal values. It seems like InvoiceDetail.IsCreditNote must be configured as a TrueFalse and not Boolean as you wish. Before GA, there was a bug that caused it to use the wrong type (probably resulting in the desired behavior you saw). > 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-02-20 02:26:50
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Patrick Earl resolved NH-2540. ------------------------------ Resolution: Not an Issue Fix Version/s: 3.1.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 > 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 |
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 |
From: Yogesh J. (JIRA) <nh...@gm...> - 2011-02-21 07:40:53
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20571#action_20571 ] Yogesh Jagota commented on NH-2540: ----------------------------------- When I said 2.1 behaved the same way, it meant it also passed addInvoices as Boolean and not String. So, I don't think it is standard behavior. > 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 |
From: Yogesh J. (JIRA) <nh...@gm...> - 2011-02-21 11:27:50
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20572#action_20572 ] Yogesh Jagota commented on NH-2540: ----------------------------------- This Criteria/QueryOver API works perfectly: var items = session.QueryOver<InvoiceDetail>() .Where(i => i.Customer == AddressedToCustomer) .And(i => i.IsCreditNote != addInvoices) .OrderBy(i => i.DueDate).Desc .ThenBy(i => i.InvoiceNumber).Desc .List(); So the issue is indeed with the linq provider. > 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 |
From: Phillip (JIRA) <nh...@gm...> - 2011-02-21 13:13:05
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20573#action_20573 ] Phillip commented on NH-2540: ----------------------------- This issue need's to be re-opened, there are many issues with the LINQ provider and this is one of them. > 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-02-21 17:54:48
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Patrick Earl reopened NH-2540: ------------------------------ I'll look into this again, but somebody needs to provide a full test case. See the JIRA welcome message for details on how to make one. I did indeed spend a while trying to reproduce this myself, but was unable to. While I'm happy to be proven wrong, this looks like a mapping issue at the moment. > 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 > > > 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-02-21 17:55:12
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Patrick Earl updated NH-2540: ----------------------------- Fix Version/s: (was: 3.1.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 > > > 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-02-22 04:57:55
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20575#action_20575 ] Patrick Earl commented on NH-2540: ---------------------------------- My theory about it being a "TrueFalse" mapping is nonsense, since that uses T or F. > 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 > > > 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 |
From: Yogesh J. (JIRA) <nh...@gm...> - 2011-02-22 06:51:51
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Yogesh Jagota updated NH-2540: ------------------------------ Attachment: NH2540.zip Added test case. > 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 |
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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-02-22 20:57:13
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20579#action_20579 ] Patrick Earl commented on NH-2540: ---------------------------------- Thanks for the test case Yogesh. I will look into this. > 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-03-05 16:34:14
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Patrick Earl updated NH-2540: ----------------------------- Summary: Linq generates invalid boolean case statements (was: Linq ignoring configured query-substitutions) (was: Linq ignoring configured query-substitutions) > Linq generates invalid boolean case statements (was: 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-03-27 17:00:24
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20764#action_20764 ] Patrick Earl commented on NH-2540: ---------------------------------- Can anyone confirm if this is fixed on the trunk? > Linq generates invalid boolean case statements (was: 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 |
From: Patrick E. (JIRA) <nh...@gm...> - 2011-04-14 04:11:12
|
[ http://216.121.112.228/browse/NH-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Patrick Earl resolved NH-2540. ------------------------------ Resolution: Fixed Fix Version/s: 3.2.0Beta1 This no longer appears to be a problem on the trunk. I did not track down exactly which revision fixed it. > Linq generates invalid boolean case statements (was: 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.2.0Beta1 > > 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 |