Re: [Modeling-users] three little questions
Status: Abandoned
Brought to you by:
sbigaret
From: Mario R. <ma...@ru...> - 2003-12-06 07:58:13
|
Hello, >> - how to best incorporate a constraint that a (non-primary, string) >> attribute value should be unique ? > > Well, there's no way to tell the framework to enforce that, my > suggestion would be to alter the db-schema to tell the database about > this, e.g.:: > > ALTER TABLE BOOK ADD CONSTRAINT unique_book_title UNIQUE(TITLE); This seems simple enough, and would be very acceptable -- except, that sqlite does not support alter table directly unfortunately, so it becomes more messy in that case. See:=20 <http://www.sqlite.org/omitted.html> > Note that we can maybe consider adding a 'unique' property to > attributes, but then, this won't be enforced by the framework itself > (because validation would require fetching all values such a field and > comparing) but by the database. But at least the generated db schema > could take this into account, and errors would be appropriately raised > at commit time by the database. If you really feel like you need this, > please fill in a RFE. Maybe framework navigation of unique need not be that expensive. How about doing a raw count for 'entity where unikatt=3D"val"'? such requests are superquick. However if you would need to do this 100's of times per validation, then it will add up of course. Do you have an idea whether this might be feasible? Even if not checked by the framework, I would be in favour of adding a unique property to attributes. The priority here is to protect the=20 integrity of the data. If the error message received by the client is not=20 cryptic, then so much the better.... So, I think I will fill out an RFE. >> - how to best handle enumeration attributes ? > > I'd say, add your own validation logic for the attribute and/or = check > for valid values in setters. Hmmn. I do not like that so much (and that's not only because I'm lazy=20= ;). This seems to be a little requested feature, so priority shuold be kept low -- but, what do you think of an 'isEnumeration=3D[ ... ]' attribute=20= field? The values inside the list must respect the type of the attribute=20 itself? Another RFE ;-? >> - how to best handle the single quote character when writing out >> string values ? (unescaped gives error for sqlite) > > Hmm, strange, I need to check that. This is a bug, I do not know=20 > whether > this affects other adaptors as well --in any case you can fill in a = bug > report for this one, thanks for reporting. OK, thanks. Cheers, mario > -- S=E9bastien. |