Apach::Session with Sybase?

2000-02-09 Thread David Huang




Dear Mr. Baker:

I am trying to use Apache::Session module with a Sybase 11 
server, but can't get it to work. I think the problem is with the a_session 
field type. I tried with text, varchar, varbinary, and binary types but without 
much luck. Can someone give me some help on this, or point me to the right 
direction? Thank you very much!

Here is the error message from the error log.

[Tue Feb 8 11:33:16 2000] [error] Magic number checking 
on perl storable failed at blib/lib/Storable.pm (autosplit into 
blib/lib/auto/Storable/thaw.al) line 214, at 
/usr/lib/perl5/site_perl/5.005/Apache/Session/DBIStore.pm line 198
-David 
HuangMacquarium404-554-4214
-David 
HuangMacquarium404-554-4214




Re: Apach::Session with Sybase?

2000-02-09 Thread Aaron Ross

hi David!

 i remember that i couldn't get Sybase to work with Apache::Session b/c the
prepare statements use placeholders. you cannot use placeholders with a text
field in sybase. from the DBD::Sybase docs:

 Note that IMAGE or TEXT datatypes can not be passed as
 parameters when using ?-style placeholders, and ?-style
 placeholders can't refer to TEXT or IMAGE columns.

 if you got past this problem, please tell me how! i'd love to see this work!

Aaron

 Dear Mr. Baker:
 
 I am trying to use Apache::Session module with a Sybase 11 server, but can't get it 
to work. I think the problem is with the a_session field type. I tried with text, 
varchar, varbinary, and binary types but without much luck. Can someone give me some 
help on this, or point me to the right direction? Thank you very much!
 
 Here is the error message from the error log.
  
 [Tue Feb  8 11:33:16 2000] [error] Magic number checking on perl storable failed at 
blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al) line 214, at 
/usr/lib/perl5/site_perl/5.005/Apache/Session/DBIStore.pm line 198
 
 -
 David Huang
 Macquarium
 404-554-4214
 
 -
 David Huang
 Macquarium
 404-554-4214
 
 



Re: Apach::Session with Sybase?

2000-02-09 Thread Vladimir Ivaschenko

 0 Aaron Ross wrote about "Re: Apach::Session with Sybase?":

 hi David!
 
  i remember that i couldn't get Sybase to work with Apache::Session b/c the
 prepare statements use placeholders. you cannot use placeholders with a text
 field in sybase. from the DBD::Sybase docs:
 
Note that IMAGE or TEXT datatypes can not be passed as
parameters when using ?-style placeholders, and ?-style
placeholders can't refer to TEXT or IMAGE columns.
 
  if you got past this problem, please tell me how! i'd love to see this work!

It works fine, you just need a little bit modified version of
Apache::Session.  Look in the archives for details, or mail me privately. 

 
 Aaron
 
  Dear Mr. Baker:
  
  I am trying to use Apache::Session module with a Sybase 11 server, but can't get 
it to work. I think the problem is with the a_session field type. I tried with text, 
varchar, varbinary, and binary types but without much luck. Can someone give me some 


help on this, or point me to the right direction? Thank you very much!
  
  Here is the error message from the error log.
   
  [Tue Feb  8 11:33:16 2000] [error] Magic number checking on perl storable failed 
at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al) line 214, at 
/usr/lib/perl5/site_perl/5.005/Apache/Session/DBIStore.pm line 198
  
  -
  David Huang
  Macquarium
  404-554-4214
  
  -
  David Huang
  Macquarium
  404-554-4214
  
  



Re: Apach::Session with Sybase?

2000-02-09 Thread Matt Sergeant

On Wed, 09 Feb 2000, Aaron Ross wrote:
 hi David!
 
  i remember that i couldn't get Sybase to work with Apache::Session b/c the
 prepare statements use placeholders. you cannot use placeholders with a text
 field in sybase. from the DBD::Sybase docs:
 
Note that IMAGE or TEXT datatypes can not be passed as
parameters when using ?-style placeholders, and ?-style
placeholders can't refer to TEXT or IMAGE columns.
 
  if you got past this problem, please tell me how! i'd love to see this work!

Either use TEXT and modify Apache::Session to use sprintf/DBI::quote or use
IMAGE and modify Apache::Session to use pack/unpack("h*",...).

-- 
Matt/

Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites: http://come.to/fastnet http://sergeant.org
Available for Consultancy, Contracts and Training.



Re: Apach::Session with Sybase?

2000-02-09 Thread Mark D. Landry

For the source code to Apache::Session::DBI::Sybase, see
http://www.xray.mpe.mpg.de/mailing-lists/dbi/1999-12/msg00289.html



Re: Apach::Session with Sybase?

2000-02-09 Thread Vladimir Ivaschenko

Wed, Feb 09, 2000 at 04:34:08PM -0500 David Huang ÎÁÐÉÓÁÌ ÐÏ ÐÏ×ÏÄÕ Re: Apach::Session 
with Sybase?

 I installed Vladimir's package, and run the main.pl script but got the
 following error:
 
 Can't locate object method "TIEHASH" via package
 "Apache::Session::DBI::Sybase" at main.pl line 8.
 
 Can you give a clue on what went wrong? Thank you!

A small example follows. Note that it's _not_ necessary to have Embperl in
order to run it. 

--

# sample calling program

package main;

use strict;

use Apache::Session::Embperl;
use Apache::Session::DBIStore::Sybase;

my %session;

unless ($ARGV[0]) {

#make a fresh session for a first-time visitor
tie %session, 'Apache::Session::Embperl', undef,
 {DataSource = 'dbi:Sybase:server=server;database=db',
  UserName   = 'user',
  Password   = 'password',
  object_store = 'Apache::Session::DBIStore::Sybase',
  lock_manager = 'SysVSemaphoreLocker'
 };

#stick some stuff in it
$session{visa_number} = "1234 5678 9876 5432";

#get the session id for later use
print $session{_session_id};

} else {

#get the session data back out again
# e.g., perl main.pl 209ea10a949e6aa1

my %session;
my $id = $ARGV[0];

tie %session, 'Apache::Session::DBI', $id,
{DataSource = 'dbi:Sybase:server=server;database=db',
 UserName   = 'user',
 Password   = 'password'
};

print $session{visa_number};

}

-- 
Best Regards
Vladimir Ivaschenko
http://www.hazard.maks.net/~hazard