From: | Reid Thompson <reid(dot)thompson(at)ateb(dot)com> |
---|---|
To: | Alex Hunsaker <badalex(at)gmail(dot)com> |
Cc: | Joao Ferreira gmail <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: list of databases in C ? libpq ? |
Date: | 2010-05-12 02:38:32 |
Message-ID: | 4BEA14A8.6010901@ateb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 5/7/2010 1:48 PM, Alex Hunsaker wrote:
> On Fri, May 7, 2010 at 11:18, Joao Ferreira gmail
> <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com> wrote:
>> Hello all,
>>
>> I need to write an application in C to read the list of databases
>> currently in the server. very much like a "psql -l"...
>
The first example in the online docs does exactly that...
http://www.postgresql.org/docs/8.1/static/libpq-example.html
$ cc -I /usr/include/postgresql-8.4/ -lpq libpq.c -o libpqex
$ ./libpqex dbname=test
datname datdba encoding datcollate datctype datistemplate datallowconn
datconnlimit datlastsysoid datfrozenxid dattablespace datconfig datacl
template1 10 6 en_US.UTF-8 en_US.UTF-8 t t -1
11563 648 1663 {=c/postgres,postgres=CTc/postgres}
template0 10 6 en_US.UTF-8 en_US.UTF-8 t f -1
11563 648 1663 {=c/postgres,postgres=CTc/postgres}
postgres 10 6 en_US.UTF-8 en_US.UTF-8 f t -1
11563 648 1663
test 16384 6 en_US.UTF-8 en_US.UTF-8 f t -1
11563 648 1663
sigcap 16438 0 en_US.UTF-8 en_US.UTF-8 f t -1
11563 648 1663
From | Date | Subject | |
---|---|---|---|
Next Message | Sergey Konoplev | 2010-05-12 04:54:36 | Re: can function arguments have the type tablename.columnname%TYPE? |
Previous Message | Josh Kupershmidt | 2010-05-12 02:36:42 | Re: Pulling data from a constraint def |