On Wed, 02 May 2001 11:05:10 -0400, Rick Cochran wrote:
> The following code:
>
> $insert_fundsource->execute("$aalias -
> tmp[1]",$tmp[1],$aalias,$tmp[4],$accttypes{$tmp[2]},$tmp[5])
> or carp "Unable to insert fundsource (".$dbh->errstr.")\n";
>
> produces the following error messages:
>
> DBD::Pg::st execute failed: ERRO at init_accounts line 163.
> Unable to insert fundsource (ERRO)
This is a bug in DBD::Pg 0.98. There is a different bug in 0.96/0.97 which dumps core
on (at least) Linux. The following patch fixes 0.98, and has been sent to Edmund
Mergl, so hopefully there'll be a new version soon.
--- 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 [EMAIL PROTECTED]
Diplomacy is the art of saying "Nice Doggy" until you can find a rock.