design - When to truncate strings longer than the storage location allows? -
let's have function inserts records database table string fields of limited length. in general, @ point should truncating strings long storage location, in insert function itself, or @ every point in code it's called?
(i'm assuming here truncation of strings long more desirable having exception thrown.)
i think depends on function , how accessible is.
if it's private function makes own sql library can away truncating in function.
if it's in library that, say, team @ work use perhaps need @ least parse string before attempting insert it.
if it's public api, shouldn't silently truncating - throw meaningful exception instead.
Comments
Post a Comment