Re: error handling. How to?

From: <dev(at)archonet(dot)com>
To: vygen(at)planwerk6(dot)de
Cc: dev(at)archonet(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: error handling. How to?
Date: 2001-07-10 19:09:08
Message-ID: 1101.192.168.1.5.994792148.squirrel@mainbox.archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 a macro processor to generate both SQL and either PHP or Perl structures and accessor functions. One of these days I'll get around 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 (well me 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 and need 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Allan Engelhardt 2001-07-10 19:09:40 Re: Encrypting database?
Previous Message Bruno Wolff III 2001-07-10 19:08:58 Re: NULL values