rhett-thompson/cocoon-orm

Does cocoon support the parameterized SQL on mysql completely?

Closed this issue · 3 comments

cy598 commented

For example:

List<Ware> ware= new List<Ware>();
........
Database.Connection().ExecuteSql("INSERT INTO Ware VALUES @Ware, new { Ware = ware });

In this case, the Ware can be very complex, but the sql sentence will be contracted still ,even when the Ware class could have to be made a large change in the future, the sql need not do any change.

Hi - I'll have our lead developer follow up with this to confirm shortly.
Feel free to call 317-640-1305 to discuss if you like.

Mike

On Tue, Sep 8, 2015 at 2:38 AM, CY598 notifications@github.com wrote:

For example:

List ware= new List();
........
Database.Connection().ExecuteSql("INSERT INTO Ware VALUES @ware, new { Ware = ware });

In this case the Ware can be very complex, but the sql will be contracted
also ,even when the Ware have to make a large change, the sql need not do
any change.


Reply to this email directly or view it on GitHub
#8.

Guideline Technologies
mike.kersey@guidelinetech.com
www.guidelinetech.com
Cell: 317-640-1305
Corp: 888-963-8917

Hi cy598,

Currently cocoon does not "expand" the object for you with a single parameter, although that is a fantastic idea. For example, if object Ware had parameters Prop1, Prop2, and Prop3, the resulting SQL (in your example) you would pass ExecuteSql would look like "INSERT INTO Ware VALUES (@Prop1, @prop2, @PROP3)". Very nice idea, actually.

A few other things. In your example ware is a List, but ExecuteSql can only deal with single objects. So at present that wouldn't work, would have to do that in a loop. This is something we are wanting to get into a future version; where cocoon is smart enough to know if you pass is an IEnumerable and generate many SQL insert/update statements.

Thanks for the question.

cy598 commented

Well, I'll be right here waiting for your next version.