|
|
sybperl-l Archive
Up Prev Next
From: "Todd E dot Scheresky" <tscheresky at micron dot com>
Subject: Re: Explicitly binding columns... How do I??
Date: Jun 3 1998 9:27PM
Thanks Michael, your fix did the trick!!
Michael Peppler wrote:
> Todd E. Scheresky writes:
> > Folks,
> >
> > I have problem which pertains to Open Client on Alpha VMS, and Sybperl.
> > There must be a Sybperl solution to this problem, though I am not sure
> > what it is. The problem is described as follows.
> >
> > When I execute a stored procedure, or SQL statement, that returns a
> > numeric(9,0) from CTlib ( using the CTlib/Perl code found below ) Perl
> > dies a horrible death. The VMS error output follows the CTlib/Perl
> > code. Note: I am not doing any explicit binding in my Sybperl code, and
> > the same stored procedure executes fine in Sybperl on Windows NT 4.0 and
> > Unix. It has been determined that Open Client on Alpha VMS defaults to
> > binding a numeric to a IEEE floating point data type, instead of the
> > native VMS data type, which causes and overflow on Alpha architecture.
> >
> > My question is how do tell Sybase Server, from Sybperl, to returns all
> > my result set as strings? What would be the most elegant Sybperl
> > solution to this problem?
> >
> > Any help, or sane suggestion, is appreciated!!
>
> There's no "clean" solution at this point. Sybase::DBlib has the
> dbKeepNum attribute which you can set to 0 to return everything as
> strings, but Sybase::CTlib doesn't have this.
>
> However, all is not lost.
>
> In CTlib.xs, go to line 1146 (at least that's what I have) - where you
> will find the following code:
>
> case CS_NUMERIC_TYPE:
> case CS_DECIMAL_TYPE:
> /* FIXME:
> Should this be DoChar: when not using native numeric
> formats (overflow problems...)? */
> if(!use_numeric)
> goto DoFloat;
> info->datafmt[i].maxlength = sizeof(CS_NUMERIC);
> info->datafmt[i].datatype = CS_NUMERIC_TYPE;
> info->datafmt[i].format = CS_FMT_UNUSED;
> info->coldata[i].type = CS_NUMERIC_TYPE;
> retcode = ct_bind(info->cmd, (i + 1), &info->datafmt[i],
> &info->coldata[i].value.num,
> &info->coldata[i].valuelen,
> &info->coldata[i].indicator);
> break;
>
>
> Change the goto to be DoChar instead of DoFloat and you should get
> strings instead of floats returned to you from numberic/decimal data.
>
> Michael
> --
> Michael Peppler -||- Data Migrations Inc.
> mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
> Int. Sybase User Group -||- http://www.isug.com
|