Up Prev Next
From: pmarquess at bfsec dot bt dot co dot uk (Paul Marquess)
Subject: Re: Problems with writing text
Date: Jan 25 1996 10:58AM
From: mpeppler@itf.CH (Michael Peppler)
> From: firstname.lastname@example.org (Michael Peppler)
> > I just ran some tests here, and I got some pretty weird results...
> I found the problem - it is the same with both Sybperl 1.x (that you
> have Rob) and 2.x (for use with Perl 5) - and the problem is indeed
> with &dbwritetext().
> What happens is this:
> When sybperl calls dbwritetext() internally, it asks the Perl
> interpreter for the size of the data buffer that it must write. This
> 'size' variable returns the internally allocated size, not necessarilly
> the actual length of the buffer, so when a variable holding a text
> buffer shrinks the &dbwritetext() call doesn't see it.
Err, are you sure that is the problem?
Here is the dbwritetext xsub.
dbwritetext(dbp, colname, dbp2, colnum, text)
SV * dbp
char * colname
SV * dbp2
SV * text
DBPROCESS *dbproc = getDBPROC(dbp);
DBPROCESS *dbproc2 = getDBPROC(dbp2);
ptr = SvPV(text, len);
RETVAL = dbwritetext(dbproc, colname, dbtxptr(dbproc2, colnum),
DBTXPLEN, dbtxtimestamp(dbproc2, colnum), 0,
len, (BYTE *)ptr);
SvPV returns a pointer to the text buffer and the len parameter gets
filled in with the current length of the text in the buffer, not the
allocated size of the buffer.