David Fetter wrote:
On Tue, Mar 13, 2007 at 09:31:45AM +0000, Richard Huxton wrote:
* Another good example is the "questionnaire".

With all due respect, this is a solved problem *without EAV or
run-time DDL*.  The URL below has one excellent approach to this.

<http://www.varlena.com/GeneralBits/110.php>

Which broadly speaking was the solution I used for my questionnaire, except I had a restricted set of types so basically just coerced them to text and side-stepped the inheritance issue. To the extent that it's dynamic, it's still just EAV though.

It doesn't remove the need for run-time DDL if you allow users to add their own questions. If I add a "National Insurance No." (Social security No) then either it's:
1. Plain text, and can take clearly invalid codes
2. A user-space construct with regexp matches etc (basically recreating DDL)
3. DDL.

And as the example says, you need to create the table types in advance. If you want to add e.g. "Work History" (employer, from_date, to_date) to a questionnaire then you'll need dynamic DDL (of form #2 or #3 above).

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to