PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

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: mpeppler@itf.ch (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.

  int
  dbwritetext(dbp, colname, dbp2, colnum, text)
        SV *    dbp
        char *  colname
        SV *    dbp2
        int     colnum
        SV *    text
    CODE:
  {
    DBPROCESS *dbproc = getDBPROC(dbp);
    DBPROCESS *dbproc2 = getDBPROC(dbp2);
    char *ptr;
    STRLEN len;
 
    ptr = SvPV(text, len);
 
    RETVAL = dbwritetext(dbproc, colname, dbtxptr(dbproc2, colnum),
                         DBTXPLEN, dbtxtimestamp(dbproc2, colnum), 0,
                         len, (BYTE *)ptr);
  }
   OUTPUT:
  RETVAL

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.


Paul