Re: database structure / generic client apps

Поиск
Список
Период
Сортировка
От Dave Page
Тема Re: database structure / generic client apps
Дата
Msg-id D85C66DA59BA044EB96AB9683819CF610150D4@dogbert.vale-housing.co.uk
обсуждение исходный текст
Ответ на database structure / generic client apps  ("Bob Lapique" <lapique@ifrance.com>)
Список pgsql-interfaces

> -----Original Message-----
> From: Bob Lapique [mailto:lapique@ifrance.com]
> Sent: 07 June 2002 17:52
> To: pgsql-interfaces@postgresql.org
> Subject: [INTERFACES] database structure / generic client apps
>
>
>
> I am to write an interface to a database with 38 tables and
> will have to write others in the future.
>
> Instead of creating a form manually for each table, I would
> like to create them dynamically (Trolltech's Qt). Same with
> queries. But to do so, I need to know the structure of the
> database at RUN TIME.
>
> The number of fields and their type is given by libpq++. (
> Where is the definition of the Oid number returned ? ) >> OK  :)
>
>
> BUT I could not find out how to know if a table has a FOREIGN
> KEY constraint on some other table. And what is its PRIMARY KEY. Yet,
> PgAdmin manages to do that. Why not me ?   ;)

I spent 5 years working with PostgreSQL to figure out things like that!
Take a look at the code in
http://cvs.pgadmin.org/cgi-bin/viewcvs.cgi/pgschema/ - in particular,
pgForeignKey.cls, ForeignKeys.cls, pgIndex.cls & Indexes.cls to see how
it's done. The basic SQL queries that are used are in basGlobal.bas.

Foreign Keys & Triggers are the hardest to figure out. The primary key
is figured out by finding out which columns are included in the index
with pg_index.indisprimary on the table in question.

Regards, Dave.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Schemas: status report, call for developers
Следующее
От: Sandro Dentella
Дата:
Сообщение: libpgtcl and encoding