Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > For Perl users ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 3165 of 3215
Post > Topic >>

For Perl users - hope it helps somebody

by fleovey@[EMAIL PROTECTED] ("Leo") Jul 10, 2008 at 10:54 AM

This is a multi-part message in MIME format.

------=_NextPart_000_0003_01C8E27B.52D53B60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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 =3D DBI->connect("dbi:Pg:dbname=3Dtemplate1", "postgres", =
"postgres");
my $select =3D $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 =3D DBI->connect("dbi:Pg:dbname=3D$base", "postgres", =
"postgres");
my @[EMAIL PROTECTED]
 =3D $dbh->tables('');=20

To get the field names in a table (nice for updates):
my @[EMAIL PROTECTED]
 =3D @[EMAIL PROTECTED]
>{'NAME'}};=20
my @[EMAIL PROTECTED]
  =3D @[EMAIL PROTECTED]
>{'TYPE'}};=20

Hope somebody can use them




------=_NextPart_000_0003_01C8E27B.52D53B60
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>If you use Perl (like me) I have made a =
very nice=20
set of&nbsp;small programs to access any database, any table and add, =
change or=20
delete&nbsp;data.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I like it better than using Webmin or =
PgAdmin=20
because I can easily customize the screens.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>To get&nbsp;all database names and=20
encoding:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>my $dbh =3D=20
DBI-&gt;connect("dbi:Pg:dbname=3Dtemplate1", "postgres", =
"postgres");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>my $select =3D =
$dbh-&gt;selectall_arrayref("select=20
datname,encoding from pg_database ORDER BY datname ") or die=20
$DBI::errstr;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>To get all tables in&nbsp;a =
base:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>my $dbh =3D =
DBI-&gt;connect("dbi:Pg:dbname=3D$base",=20
"postgres", "postgres");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>my @[EMAIL PROTECTED]
 =3D=20
$dbh-&gt;tables('');</FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>To get the field names in a table (nice =
for=20
updates):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>my @[EMAIL PROTECTED]
 =3D @[EMAIL PROTECTED]
'NAME'}}; =
<BR>my=20
@[EMAIL PROTECTED]
 =3D @[EMAIL PROTECTED]
'TYPE'}}; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Hope somebody can use them</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0003_01C8E27B.52D53B60--
 




 3 Posts in Topic:
For Perl users - hope it helps somebody
fleovey@[EMAIL PROTECTED]  2008-07-10 10:54:27 
SetQueryTimeout in Postgres 8.1.4
Selvakaruppiahs@[EMAIL PR  2008-08-05 08:24:00 
Problem with Postgres 8.1.4
Selvakaruppiahs@[EMAIL PR  2008-08-11 10:55:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Sep 6 15:26:49 CDT 2008.