4 |
|
|
5 |
die "SQL query as argument?" if (!defined($ARGV[0])); |
die "SQL query as argument?" if (!defined($ARGV[0])); |
6 |
|
|
7 |
my $mydbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr; |
my $connect = "DBI:Pg:dbname=informatika"; |
8 |
$mysth = $mydbh->prepare("$ARGV[0]") || die $mydbh->errstr(); |
#$connect = "DBI:dbftp:DSN=video;hostname=vradan"; |
9 |
$mysth->execute() || die $mysth->errstr(); |
#$connect = "DBI:dbftp:DSN=db1;hostname=hbreyer2"; |
10 |
|
#$connect = "DBI:dbftp:DSN=education;user=sa;hostname=mbabic.pliva.hr"; |
11 |
|
|
12 |
print "#",join("\t",@{ $mysth->{NAME} }),"\n"; |
my $dbh = DBI->connect("$connect","","") || die $DBI::errstr; |
13 |
while (@myarr = $mysth->fetchrow_array() ) { |
$sth = $dbh->prepare("$ARGV[0]") || die $dbh->errstr(); |
14 |
print join("\t",@myarr),"\n"; |
$sth->execute() || die $sth->errstr(); |
15 |
|
|
16 |
|
print "#",join("\t",@{ $sth->{NAME} }),"\n"; |
17 |
|
while (@arr = $sth->fetchrow_array() ) { |
18 |
|
print join("\t",@arr),"\n"; |
19 |
} |
} |