Re: wierd problems with DBI/DBD::pg?

From: pmh(at)edison(dot)ioppublishing(dot)com
To: mpm(at)norwottuck(dot)com, PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: wierd problems with DBI/DBD::pg?
Date: 2001-05-01 11:18:02
Message-ID: PGM.20010501111802.23899.359@edison.ioppublishing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 30 Apr 2001 14:50:15 -0400, Michelle Murrain wrote:
> I recently upgraded from 6.5 to 7.1, and it mostly went smoothly (fixed the
> PHP problem, thanks to a list member). But now some of my perl stuff is
> being a bit strange, and I'm wondering whether other folks have noticed
> strangeness when they upgraded their Postgres as well as upgraded to the
> new DBD::Pg.

Here's a patch to DBD::Pg 0.98, which should fix the problems.

--- 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(at)edison(dot)ioppublishing(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Clay & Judi Kinney 2001-05-01 12:34:46 Newbie Question
Previous Message pmh 2001-05-01 10:27:04 Re: wierd problems with DBI/DBD::pg?