bleroy / Nwazet.Commerce

Idiomatic commerce module for Orchard CMS.
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

Saving OrderPartRecord fails when contents is > 4000 characters using SQL Compact #54

Closed bleroy closed 8 years ago

bleroy commented 10 years ago

Originally reported by: Josh Berry (Bitbucket: joshberry, GitHub: joshberry)


Ran into this issue yesterday with an very large order. When the serialized order contents exceeds 4000 characters, the order fails with the following exception:

#!text

2014-10-16 15:46:14,828 [15] NHibernate.AdoNet.AbstractBatcher - Could not execute command: UPDATE Nwazet_Commerce_OrderPartRecord SET Status = @p0, Contents = @p1, Customer = @p2, Activity = @p3, TrackingUrl = @p4, Password = @p5, IsTestOrder = @p6, UserId = @p7, Store = @p8 WHERE Id = @p9
System.InvalidOperationException: @p1 : String truncation: max=4000, len=10144, value='<content subtotal="936" total="936">.........

Although the user receives an error message instead of the order confirmation page, the worst part is that the Stripe transaction is still processed and the New Order event is fired so any order confirmation emails you have setup are sent out.

From the research I've done, it sounds like SQL Compact can handle large ntext values but has issues with validating them on the way in depending on how the sql statement is constructed. The issue is described here.

One obvious solution would be to migrate the database to full SQL Server. I'm wondering if there is anything that can be done for SQL Compact though. I don't have any good ideas at this point. Thoughts?


bleroy commented 10 years ago

Original comment by Josh Berry (Bitbucket: joshberry, GitHub: joshberry):


Must have missed it. That commit did the trick. Thanks!

bleroy commented 10 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


I put the link in my first comment ;)

bleroy commented 10 years ago

Original comment by Josh Berry (Bitbucket: joshberry, GitHub: joshberry):


Cool. Do you know what commit it was on? I have some customizations that will need to be merged and I'd like to be able to cherry pick this fix and come back to it later when I have more time.

bleroy commented 10 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


Already fixed that one.

bleroy commented 10 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


Get the latest code. I'm pretty sure I fixed that one already: https://bitbucket.org/bleroy/nwazet.commerce/commits/3ada6266368c58673559e63868786d0337e64804. You may have to delete your mappings.bin.