Error reporting

Поиск
Список
Период
Сортировка
Искать

Error reporting

От:
Soma Interesting <dfunct@telus.net>
Дата:

I'm working with PHP and Postgres.

I want to start making more use of the database's ability to maintain the 
integrity of data. For example, when adding a value to a table where I 
don't want duplicates. Instead of pre searching with PHP for the submitted 
value in the table, then if the value isn't already existing in the table, 
submit the new value - I was just going to add the new value, then check 
the contents of pg_errormessage() to determine the success or failure of 
the command.

Pg_errormessage returns a nice long string about there not being allowed 
duplicate values. This isn't the easiest return for handling error 
checking, ideally I can configure Postgres to return only numeric error 
codes so that pg_errormessage would return those numerical values that I 
can easily test on.

Is this possible? Is this how everyone does it? Am I missing something - 
Like a page from the manual?  :)

Thanks once again.

FAQ