Re: error handling. How to? - Mailing list pgsql-general

From
Subject Re: error handling. How to?
Date
Msg-id 1101.192.168.1.5.994792148.squirrel@mainbox.archonet.com
Whole thread Raw
In response to Re: error handling. How to?  (Janning Vygen <vygen@planwerk6.de>)
Responses Acceptable topics on -general WAS Re: error handling. How to?
List pgsql-general
> Am Montag,  9. Juli 2001 11:36 schrieb Richard Huxton:

> thinking a few days about your words  i decided to do the error
> checking in a  serverside programm. So i have three components.
> GUI(HTML),
> frontend(serverside), Database(backend)
>
> But if i have a table like
> create table (level int2 check level > 0 and level < 10);
>
> i do the error checking two times. Once in my frontend (not GUI) and
> once in  my backend (database). If have to do the check in my frontend
> too because i  want german readable error messages and not database
> produced error messages.  And i have to check it in my database because
> frontends like pgsql wont check  it.
>
> if i want to change the range to 12 i have to change it in two
> programms.  thats what i dont like.

Agreed - if you need to make the same change twice you're going to forget one of them sooner or later.

What I've taken to doing is trying to abstract my data definitions into a config file and running that through Perl or
amacro processor to generate both SQL and either PHP or Perl structures and accessor functions. One of these days I'll
getaround to making my tools general purpose and post them up for use. 

Makes you more disciplined since you need to build little upgrade scripts to update your database structure. Means you
(wellme anyway) think about what changes mean to your structure rather than just ALTER TABLE ADD COLUMN. 

Actually - run a few searches on Google/Freshmeat - there might be something that suits you there.

> Are there any examples to learn from. In SQL books you always get this
> easy  shit like "i build a cd database" huii. Nothing about how to
> design a whole  software with a SQL database. Error checking, How to
> Connect a OO Layer to a  database....
>
> Does anybody know some in-depth examples on the web?

Afraid not - I've always felt good real-world examples of development (including where you realised you've gone wrong
andneed to rework something) would be useful. 

> p.s: is this the correct mailing list for such questions?? or is it OT?

I'm interested in people's responses - how PG gets used in the real world is useful information.

- Richard Huxton


pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: NULL values
Next
From: Joseph Shraibman
Date:
Subject: Re: Re: Backups WAS: 2 gig file size limit