On Tuesday 09 September 2003 16:49, Michael Vodep wrote:
> Hi!
> I am using postgresql with PHP and C. Is it possible to add header
> information to every table? For example:
> id | name | age
> should be
> User ID | Username | Age of user
> This should be displayed, when i query the header information. Is this
> possible? Maybe i can add a comment to every column header? Or is there a
> simple way for storeing this additional information in a other table and
> solve this problem by writting some special SQL statements?
Well, one solution which I tend to use is to keep this information in my
application layer (PHP/C in your case).
Since PHP will need to know something about the structure of the database
anyway, I keep all this together. Something like:
$Tables['user_age'] = array(
'id' => array('type' => 'int', 'desc'=>'User ID'),
'name' => array( 'type'=>'text', 'desc'=>'User name' ),
'age' => array('type'=>'int', 'desc'=>'Age of user' )
);
In fact, where possible I like to generate the above table and my SQL from the
same definitions-file.
--
Richard Huxton
Archonet Ltd