Subject | RE: [firebird-support] Why IN AUTONOMOUS TRANSACTION doesnt work here? |
---|---|
Author | Leyne, Sean |
Post date | 2013-09-20T17:31:02Z |
Walter,
They expect that the developer/languages provide appropriate layers to ensure that database datatype sizing constraints are met/enforced before the data reaches the database.
Further, it would not take much effort to develop logic which performs the evaluation/validation before the data is sent, to save an extra back-and-forth with the server over the network.
Sean
> Because triggers could fix the data to be valid?Unfortunately, the SQL standard and committee has not taken that view.
> And that can be confusing, because to modern programmers accustomed to
> nearly unlimited string types, varchar(x) is more about
> CHECK(char_length(field) <= x) [logical-layer] than about APIs and C
> compatibility [physical-layer].
They expect that the developer/languages provide appropriate layers to ensure that database datatype sizing constraints are met/enforced before the data reaches the database.
> It seems logical to me for someone to want toI would suggest that this is the worse place and approach to be enforcing the field lengths. The client/user is the correct location/actor to make the decision about how a string should be shortened.
> create a BEFORE trigger that would trim varchar fields down to size, and
Further, it would not take much effort to develop logic which performs the evaluation/validation before the data is sent, to save an extra back-and-forth with the server over the network.
> failing that, would let FB double-check the length after all the BEFORE triggersTo perform the length check twice would add needless CPU cycles for most operations.
> have had their way with the data.
Sean