Hi, I'm in major poop.

Got a presentation soon and my just implemented, implementation of
Apache::Session is not working as per the man page.

I've set commit to 1 and tied a session to a postgres database.  I then
set a field and check the table it's not there.

When I later do a fetch on it, I get a scarey error:

 [error] Object does not exist in the data store at
/usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Postgres.pm line 81


Create and fetch methods, with table schema, below:


1)Create:
--------------------------------------------

sub tieSession
{
  my $self = shift;
  my %session;
  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;

  print STDERR "\n CREATING SESSION using dsn: $dsn \n";

  tie %session, 'Apache::Session::Postgres', undef,
                {
                 DataSource => $dsn,
                 UserName => $DBI_USER,
                 Password => $DBI_PWD,
                 Commit => 1
                };

  ## store creation time
  $session{CREATION_TIME}=time;

  return \%session;
}

--------------------------------------------



2) fetching the session:

--------------------------------------------

sub fetchSession
{
  my $self = shift;
  my $sessionId = shift;
  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;
  my %session;

  print STDERR "\n getting session for $sessionId\n";

  tie %session, 'Apache::Session::Postgres', $sessionId,
    { DataSource => $dsn,
      UserName => $DBI_USER,
      Password => $DBI_PWD,
      Commit => 1
    };

  ## store last access
  $session{LAST_ACCESS} = time;

  $ENV{GUEST_ID} = $session{GUEST_ID} || undef;
  return \%session;
}

--------------------------------------------

3) Table Schemata

--------------------------------------------

        CREATE TABLE sessions (
           id char(32) not null primary key,
           a_session text
        );

--------------------------------------------


help?

Cheers,

fiq


Reply via email to