everettm wrote:
So, from your response to my original post, Otis, it sounds like you would consider the scenario I described in that post as too marginal to add support for it?
Emitting the SELECT clause is a little more complex than emitting a functioncall as the value (or an expression).
Furthermore, saving an entity where a field has an expression set is a bit strange, as the entity has to be saved with the values it contains, not some expression.
I'm not sure I understand your point here, could you explain a bit further. I'm probably just being dense. The fact that UpdateEntitiesDirectly uses the ExpressionToApply seemed like it could open the door for a similar formulation for inserting rows.
WHen I save customer - orders recursively, and insert a new order entity, I've to set the particular OrderEntity's field's ExpressionToApply property to the expression. This is a bit unintuitive as you would set field values on an entity, not some field's expression.
Of course, I could add that, it's just a bit unintuitive towards how you would use an entity normally.
scornish wrote:
Otis wrote:
Ah so it always has to be called, despite the value passed in for the checksum column ? (so otherwise people could work around it and pass NULL ? ) (if not, I think I don't understand what you mean exactly)
Yes it always has to be called regardless of the checksum column value. The only time I care about the stored checksum value is during a select. The checksum value should always explicitly use the binary_checksum function to calculate the value on an insert or an update.
During an insert or update, we should calculate a checksum value based on the parameter values and/or existing values.
Another possibility is to implement this in the entity class itself, or by a trigger. (just ideas, not to mitigate your point)
During a select, we get the stored checksum value minus the calculated checksum value. We then enumerate the entities and check the 'checksum' value and if the value is not 0, (which means someone has changed a row value in the database) we throw an exception.
Hope this makes sense,
Ok. Well, as I explained above, it's a bit unintuitive, though for pure expressions it's not a tough job to build in. The main part of the time will be put in testing if a db (we support a couple
) supports SELECT's in the INSERT statement (for scalarqueryexpressions) and if so, how to formulate the select to work around the lack of a FROM clause (which I think won't be possible on a couple of db's without a dummy table, which is possible on db2 and oracle, but I don't know if it works on access for example)
I've added it to the todolist. For v2.1's featurelist, it's on a priority of 7 (10 is the highest), so it will be done when prio 10, 9 and 8's are done and there's time left.