Created
February 27, 2017 13:25
-
-
Save hectorgool/009b036906a448ec78c66e81dcb18465 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl -w | |
| #aptitude install libdbd-pg-perl libdbi-perl -y | |
| use DBI; | |
| system("clear"); | |
| my $dbh = DBI->connect("DBI:Pg:dbname=hem;host=localhost", "hem", "asdfasdf", {'RaiseError' => 1}); | |
| $sth = $dbh->prepare("SELECT * FROM products ORDER BY name"); | |
| $sth->execute(); | |
| while ( $row = $sth->fetchrow_hashref ) { | |
| print "$row->{name}\t$row->{description}\n"; | |
| } | |
| $dbh->disconnect( ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment