X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 23076D1B55F for ; Thu, 20 Nov 2003 19:51:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 96527-09 for ; Thu, 20 Nov 2003 15:50:35 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 5D9A6D1C977 for ; Thu, 20 Nov 2003 15:50:34 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hAKJoINu011944 for ; Thu, 20 Nov 2003 19:50:18 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hAKJbB0D009119 for pgsql-php@postgresql.org; Thu, 20 Nov 2003 19:37:11 GMT From: "Tom Hebbron" X-Newsgroups: comp.databases.postgresql.interfaces.php Subject: Re: Reducing duplicated business rules Date: Thu, 20 Nov 2003 20:36:00 +0100 Organization: Hub.Org Networking Services Lines: 81 Message-ID: References: <20031106165210.6b46bbb7.struck.d@retrovirology.lu><714126A2-1082-11D8-B410-0005029FC1A7@myrealbox.com> <20031109163716.08fed5de.struck.d@retrovirology.lu> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 To: pgsql-php@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/47 X-Sequence-Number: 2440 Hi group, I'm interested to see that other people have hit this problem. In the last few months I've been writing and re-writing PHP classes to access a postgreSQL database for a CMS. Here is a rough overview of the way I've dealt with the validation problem. tuple class array of attribute class objects initialisation fetches metadata about the table/view the tuple (row) belongs to (attribute types, domains & built in CHECK constraints, foriegn keys, not null) this data comes from a set of attribute metadata views (built from system catalogs and optimised - further optimisation is envisaged for PG 7.4) the tuple / attribute metadata allows us to do the following things foreign key attributes can auto-build a list of options for a