Thread: Building DBD::Pg

Building DBD::Pg

From
"Simon Crute"
Date:
Hi,
  I'm trying to install & build DBD::Pg. against Postgres7.1
I've downloaded the latest version (0.98)
Postgres was installed via the RPMs.  (base, lib, delel, perl, docs, test
and server)
it's a redhat 6.2 based system but with perl 5.6 installed.

perl Makefile.PL runs OK
make runs OK,
but when I run make test I get the following errors.

[simon@sunshine DBD-Pg-0.98]$ make test
PERL_DL_NONLAZY=1
/usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/local/lib/perl5/5.6.0/i686-linux
 -I/usr/local/lib/perl5/5.6.0 test.pl
OS: linux
Use of uninitialized value in join at test.pl line 53.
DBI->data_sources .......... not ok:
DBI->connect(dbname=template1) failed: No pg_hb at test.pl line 59
DBI->connect ............... not ok: No pg_hb at test.pl line 59.
make: *** [test_dynamic] Error 255


Can anyone give me a clue what's wrong ?

Thanks.






Re: Building DBD::Pg

From
teg@redhat.com (Trond Eivind Glomsrød)
Date:
"Simon Crute" <simon-news@nospam.geordie.demon.co.uk> writes:

>   I'm trying to install & build DBD::Pg. against Postgres7.1
> I've downloaded the latest version (0.98)
> Postgres was installed via the RPMs.  (base, lib, delel, perl, docs, test
> and server)
> it's a redhat 6.2 based system but with perl 5.6 installed.

You've installed DBI and postgresql-devel?


--
Trond Eivind Glomsrød
Red Hat, Inc.

Re: Building DBD::Pg

From
"Peter Haworth"
Date:
On Thu, 3 May 2001 23:03:57 +0100, Simon Crute wrote:
> [simon@sunshine DBD-Pg-0.98]$ make test
> PERL_DL_NONLAZY=1
> /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/local/lib/perl5/5.6.0/i686-linux
>  -I/usr/local/lib/perl5/5.6.0 test.pl
> OS: linux
> Use of uninitialized value in join at test.pl line 53.
> DBI->data_sources .......... not ok:
> DBI->connect(dbname=template1) failed: No pg_hb at test.pl line 59
> DBI->connect ............... not ok: No pg_hb at test.pl line 59.
> make: *** [test_dynamic] Error 255

One problem is that the error message is being truncated. This patch to DBD::Pg fixes that. The other problem is
indicatedby the truncated error message, which I guess is complaining about pg_hba.conf 

--- dbdimp.c.orig       Tue May  1 11:46:47 2001
+++ dbdimp.c    Tue May  1 11:55:26 2001
@@ -72,18 +72,21 @@
     char *error_msg;
 {
     D_imp_xxh(h);
-    char *err, *src, *dst;
+    char *err, *src, *dst, *end;
     int  len  = strlen(error_msg);

-    err = (char *)malloc(strlen(error_msg + 1));
+    err = (char *)malloc(len + 1);
     if (!err) {
       return;
     }
+    /* Remove trailing newlines, allowing for multi-line messages */
+    for(end = error_msg + len; end > error_msg && end[-1] == '\n'; --end);
+
     src = error_msg;
     dst = err;

     /* copy error message without trailing newlines */
-    while (*dst != '\0' && *dst != '\n') {
+    while (src < end){
         *dst++ = *src++;
     }
     *dst = '\0';


--
    Peter Haworth    pmh@edison.ioppublishing.com
"It's gotten to the point where the only place you can get work done is at
home, because no one bugs you, and the best place to entertain yourself is
at work, because the Internet connections are faster."      -- Scott Adams

Re: Building DBD::Pg

From
"Simon Crute"
Date:
Thanks for the reply
(please ignore my re-posting, I thought my message hadn't got through cos of
the list subsciptions)

""Peter Haworth"" <pmh@edison.ioppublishing.com> wrote in message
news:PGM.20010508101126.11356.390@edison.ioppublishing.com...
> One problem is that the error message is being truncated. This patch to
DBD::Pg fixes that. The other problem is indicated by the truncated error
message, which I guess is complaining about pg_hba.conf
>
> --- dbdimp.c.orig       Tue May  1 11:46:47 2001
[cut]


Great Thanks, the patch seems to have caused the proper error messages to be
logged in the apachee error log.
Still doesn't seem to be setting the $DBI::errst string though, unless
that's my perl going a bit wrong (wouldn't suprise me)

Now i've just got to understand the error message...... (expect another
posting soon .....)





Re: Building DBD::Pg

From
"Simon Crute"
Date:
Forget it,
It's definatly my perl that's wrong. :)