For Perl users - hope it helps somebody - Mailing list pgsql-novice

From Leo
Subject For Perl users - hope it helps somebody
Date
Msg-id 000601c8e294$7f6790b0$232401c8@leo
Whole thread Raw
Responses SetQueryTimeout in Postgres 8.1.4
List pgsql-novice
Hello
If you use Perl (like me) I have made a very nice set of small programs to access any database, any table and add, change or delete data.
I like it better than using Webmin or PgAdmin because I can easily customize the screens.
 
To get all database names and encoding:
my $dbh = DBI->connect("dbi:Pg:dbname=template1", "postgres", "postgres");
my $select = $dbh->selectall_arrayref("select datname,encoding from pg_database ORDER BY datname ") or die $DBI::errstr;
To get all tables in a base:
my $dbh = DBI->connect("dbi:Pg:dbname=$base", "postgres", "postgres");
my @tnames = $dbh->tables(''); 
 
To get the field names in a table (nice for updates):
my @header = @{$sth->{'NAME'}};
my @types  = @{$sth->{'TYPE'}};
 
Hope somebody can use them
 
 
 
 

pgsql-novice by date:

Previous
From: "Phillip Sitbon"
Date:
Subject: Re: Concurrent COPY commands
Next
From: Brian Hurt
Date:
Subject: SQL "pseudo-variables" for a view