RE: RE: RE: tourble migrating from linux/Apache/postgres ql/perl to win2000/IIS/postgresql/perl

From: Rishi Sharma <rsharma(at)Bigstep(dot)net>
To: "'s0lao(at)netscape(dot)net '" <s0lao(at)netscape(dot)net>, Rishi Sharma <rsharma(at)Bigstep(dot)net>
Cc: "'Jason(dot)Tishler(at)dothill(dot)com '" <Jason(dot)Tishler(at)dothill(dot)com>, "'pgsql-cygwin(at)postgresql(dot)org '" <pgsql-cygwin(at)postgresql(dot)org>
Subject: RE: RE: RE: tourble migrating from linux/Apache/postgres ql/perl to win2000/IIS/postgresql/perl
Date: 2001-06-14 04:16:38
Message-ID: F902091518C1D411985D0008C7E6566C02639E7B@ned.bigstep.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Dear Slao,

Thanks for the explanation.

I figured out what was casuing my make to fail.
Solution: move the cygwin/bin before winnt;winnt/system32 in the PATH
variable. I recommend adding a note at the bottom of
http://people.freebsd.org/~kevlo/postgres/portNT.html.

progress:
I was able to build the postgres7.1.2-1 source and also build the Pg.pm
module (thanks Slao). Evertyhing works in a windows shell...I can run my
simple test script and query the database properly:

test script:
#use Pg;
#
#$conn = Pg::connectdb("dbname=intake");
#
#$status=$conn->status;
#if ($status != PGRES_CONNECTION_OK) {
# print STDERR "fatal error ($status), terminated\n";
# exit (1);
#}
#
# Pg::doQuery($conn, " select * from tbl_checklist", \(at)arreglo);
# foreach my $i (0 .. $#arreglo) {
# foreach my $j (0 .. $#{$arreglo[$i]}) {
# print "$arreglo[$i][$j]\t";
# }
# print "\n";
# }
#exit (0);

result from test in shell:
200005100000 121
200005100000 122
200005100000 123
200005100000 124
200005100000 128
200005100000 129
200005100000 130
200005100000 131
200005100000 132
200005100000 133
200005100000 134

GREAT!!!

Now I need to figure out how to do this in a CGI ... my cgi seems to be
hanging again where I say "use Pg;". The browser just waits there until the
cgi times out. I don't think Pg is being loaded properly.

here is the CGI:
#!/usr/bin/perl
use Pg;
use CGI qw(:standard);

print header;
print start_html('A PostgresSQL Example'),
h1('A PostgresSQL Examplee2'),
start_form,
"SQL: select * from tbl_checklist",
p,
submit,
end_form,
hr;

#$conn = Pg::connectdb("dbname=intake");
$conn = Pg::new('','','','','intake');

$status=$conn->status;
if ($status != PGRES_CONNECTION_OK) {
print STDERR "Error fatal en la conexion ($status), terminamos\n";
exit (1);
}

$sql = "select * from tbl_checklist";
$result = $conn->exec($sql);

$t = '1';
$html3 = $t;
$align = $t;
$header = $t;
$tableOpt = 'Border';

$result->print(stdout, $header, $align, $standard, $html3, $expanded,
$pager, $fieldSep, $tableOpt, $caption);

print end_html;

exit;

-----Original Message-----
From: s0lao(at)netscape(dot)net
To: rsharma(at)bigstep(dot)net
Cc: s0lao(at)netscape(dot)net; Jason(dot)Tishler(at)dothill(dot)com;
pgsql-cygwin(at)postgresql(dot)org
Sent: 6/11/01 10:29 PM
Subject: Re: RE: [CYGWIN] RE: tourble migrating from
linux/Apache/postgresql/perl to win2000/IIS/postgresql/perl

Rishi Sharma <rsharma(at)Bigstep(dot)net> wrote:
>
> SLao,
>
> Let me try to clarify...the perl scripts try to load the Pg.pm module
by
> stating "use Pg". You say this should be a binary file? I found a
few
> copies of Pg.pm under .../perl/src or something like that, but it was
ascii
> text, I didn't dig too deep in to what it was doing.
>

Ok, then it's clear your scripts are using the Pg driver bundled with
PostgreSQL.

>
> I've found this http://www.edmund-mergl.de/export/DBD-Pg.zip from
> symbolstone
(http://dbi.symbolstone.org/cgi/moduledump?module=DBD::Pg)...
> hopefully it's all I need.
>

From the point the above affirmation was made, any reference to DBI/DBD
drivers becomes redundant. If your scripts use the Pg driver, migrating
to DBI/DBD::Pg driver could be difficult, as they should be (quite some
more than) batch changed.

>
> If I install postgresql-7.1.2 from Jason and drop in the libpq.dll and
> Pg.dll in my winnt/system32 should I be able to access my database
from cgi
> scripts with simply stating "use Pg"??
>
> There seems to be something missing here...
>

Maybe yet another comment :) You must not forget to place Pg.pm
somewhere so that Perl is able to find it. I think the layout with
libpq.dll and pg.dll in winnt/system32 is viable. But, anyway, for any
eventual problems, here's what "make install" in "src/interfaces/perl"
produces:

$ ls -lR /usr/local/lib/perl5/site_perl/5.6.0/cygwin/
total 9
-r--r--r-- 1 lao 544 18124 Sep 27 1998 Pg.pm
drwxr-xr-x 3 lao 544 0 Jun 11 08:57 auto

/usr/local/lib/perl5/site_perl/5.6.0/cygwin/auto:
total 0
drwxr-xr-x 2 lao 544 0 Jun 11 08:57 Pg

/usr/local/lib/perl5/site_perl/5.6.0/cygwin/auto/Pg:
total 83
-r--r--r-- 1 lao 544 0 Jun 11 08:57 Pg.bs
-r-xr-xr-x 1 lao 544 73728 Jun 11 08:57 Pg.dll
-r--r--r-- 1 lao 544 81 Jun 11 08:57 autosplit.ix
-r--r--r-- 1 lao 544 93106 Jun 11 08:57 libPg.a

I think that a link to winnt/system32/Pg.dll in
/usr/local/lib/perl5/site_perl/5.6.0/cygwin/auto/Pg could solve any
(eventual) Perl instalation issues.

Good luck!

SLao
__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at
http://webmail.netscape.com/

Browse pgsql-cygwin by date

  From Date Subject
Next Message Rishi Sharma 2001-06-14 04:45:07 RE: RE: RE: tourble migrating from linux/Apache/postgres ql/perl to win2000/IIS/postgresql/perl
Previous Message Jason Tishler 2001-06-13 14:58:56 Re: Help