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: "Kiriakos Georgiou (Contractor)" <kiriakos dot georgiou at nrl dot navy dot mil>
Subject: Re: ct_param problem
Date: Mar 19 2004 6:18PM

AHA! I tested your hypothesis and you are right.  When I force 
$session->{serialized} to be smaller in size (by selecting certain 
options in the application GUI) it works fine.  If I go back to the 
defaults ($session->{serialized} is larger) I get the error.

Here is why the old (-) code worked.  I must had modified Apache-Session 
years ago because the version number is the same (1.54) but the code is 
different:

$ diff -u 
/mnt/raid/torpedo/src/perl/Apache-Session-1.54/Session/Store/Sybase.pm 
Sybase.pm
--- 
/mnt/raid/torpedo/src/perl/Apache-Session-1.54/Session/Store/Sybase.pm 
     2001-11-07 16:41:26.000000000 -0500
+++ Sybase.pm   2000-07-23 23:35:30.000000000 -0400
@@ -101,11 +101,10 @@

      local $self->{dbh}->{RaiseError} = 1;

-    my $sth = $self->{dbh}->prepare(
-      sprintf q{INSERT INTO sessions (id, a_session) VALUES('%s', %s)},
-              $session->{data}->{_session_id}, $session->{serialized}
-    );
-    $sth->execute;
+       my $sth = $self->{dbh}->prepare( qq{
+                 INSERT INTO sessions (id, a_session) VALUES ( ?, 
$session->{serialized} ) } );
+
+    $sth->execute( $session->{data}->{_session_id} );
  }


@@ -117,11 +116,10 @@

      local $self->{dbh}->{RaiseError} = 1;

-    my $sth = $self->{dbh}->prepare(
-      sprintf q{UPDATE sessions SET a_session = %s WHERE id = '%s'},
-              $session->{serialized}, $session->{data}->{_session_id}
-    );
-    $sth->execute;
+       my $sth = $self->{dbh}->prepare( qq{
+                 UPDATE sessions SET a_session = $session->{serialized} 
WHERE id = ? } );
+
+    $sth->execute( $session->{data}->{_session_id} );
  }

  sub DESTROY {


Michael Peppler wrote:

> On Fri, 2004-03-19 at 09:19, Kiriakos Georgiou (Contractor) wrote:
> 
>>I recently upgraded from DBD-Sybase-0.91 and DBI-1.14 to
>>
>>DBD-Sybase-1.02 and DBI-1.40
>>
>>I tried to use 12.5.1 open client to connect to a 12.0 ASE server (we 
>>are in transition from 12.0 to 12.5.1) but that was giving me the error 
>>below.
>>
>>-----------------
>>[Fri Mar 19 11:05:42 2004] [notice] Accept mutex: fcntl (Default: fcntl)
>>ct_param() failed! at 
>>/usr/local/nrl/lib/perl5/site_perl/5.8.3/Apache/Session/Store/Sybase.pm 
>>line 122.
>>DBD::Sybase::st execute failed: OpenClient message: LAYER = (1) ORIGIN = 
>>(1) SEVERITY = (1) NUMBER = (46)
>>Server production, database
>>Message String: ct_param(): user api layer: external error: An illegal 
>>value of 0 was placed in the status field of the CS_DATAFMT structure.
>>-----------------
> 
> 
>>-----------------
>>my $sth = $self->{dbh}->prepare(qq{
>>UPDATE sessions SET a_session = $session->{serialized} WHERE id = ?
>>});
>>$sth->execute( $session->{data}->{_session_id} );
>>-----------------
> 
> 
> Oh - I think I know what the problem is.
> 
> The $session->{serialized} variable is a hex string, and I think it
> overwrites some internal values somewhere, probably when doing the
> statement prepare.
> 
> I would suggest as a work-around:
> 
> my $sth = $self->{dbh}->prepare(qq{
> UPDATE sessions SET a_session = $session->{serialized} 
>  WHERE id = $session->{data}->{_session_id}
> });
> $sth->execute( );
> 
> As Session::Store::Sybase can't use placeholders for the serialized
> data, making this change won't really change much.
> 
> I'll see if I can reproduce it.
> 
> Also - if your sessions are under 16k in size you may be able to use
> placeholders for the serialized data once you move your Sybase servers
> to 12.5, although it may require some fiddling with proxy tables (unless
> you want to use 16k page sizes for the server, of course).
> 
> Michael