Re: Reducing duplicated business rules

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: Reducing duplicated business rules
Дата
Msg-id 714126A2-1082-11D8-B410-0005029FC1A7@myrealbox.com
обсуждение исходный текст
Ответ на Re: Reducing duplicated business rules  (Daniel Struck <struck.d@retrovirology.lu>)
Ответы Re: Reducing duplicated business rules  (Daniel Struck <struck.d@retrovirology.lu>)
Список pgsql-php
Hi Daniel,

On Friday, November 7, 2003, at 12:52 AM, Daniel Struck wrote:

>> Of course PostgreSQL will throw back an error if I tried to insert or
>> update data that will make the check constraint untrue
>
> I thought about using named constraints:
<snip/>
> CONSTRAINT "!!!#Please check XYZ in the formular#" CHECK ([whatever
> you like to test])
> );
>
> Next, I would check in php if an error occured in the sql-query, if
> the error includes "!!!" in the error message from postgresql I would
> display the formular again with the values already entered and I would
> display as a feedback to the user the string between the two "##":

Interesting idea. Then you can include more specific information rather
than just the PostgreSQL error. I wonder if there wouldn't be a way to
use COMMENT information on the constraint as well—grab the COMMENT for
whatever named constraint caused it to fail.

> One drawback is of course that it will only give feedback from one
> error at a time.

I don't know if this is the best way to do this, but it might be
workable in the short term. It would be nice to be able to ask the
database, in effect "Okay, yeah, that's not a good piece of data. But
let's assume that part were okay. Any other problems? Besides that?"
Then you could possibly get more feedback from the database.


В списке pgsql-php по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Reducing duplicated business rules
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Reducing duplicated business rules