Your provided code looks accurate. Given that you get no errors
trying to place the session ID in the first place, it implies that the
$sessionID you are passing in your fetchSession routine is either not being
passed, being passed incorrectly or the object does not, in fact, live in
the database.
You should check what you are passing into the routine and then see
if the key for the session is in your table.
--jayson
"Rafiq Ismail
(ADMIN)" To: mod_perl list
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED] cc:
hought.com> Subject: Apache::Session HELP!
Sent by: Rafiq
Ismail (ADMIN)
<rafiq@Dreamthought.
com>
08/09/02 06:01:23 AM
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
--------------------------------------------------------------
Jefferies archives and reviews outgoing and incoming e-mail. Such may be
produced at the request of regulators. Sender accepts no liability for
any errors or omissions arising as a result of transmission. Use by other than
intended recipients is prohibited. This is neither an offer nor a
solicitation of an offer to buy or sell securities. Opinions or estimates
constitute our best judgment at this time and are subject to change without
notice. Information upon which this material is based was obtained from
sources believed to be reliable but has not been verified. Additional
information is available upon request. Jefferies its affiliates and
respective directors officers and employees may buy or sell
securities mentioned as agent or principal. This is for use by
professional or institutional investors only. No investments or
services mentioned or described are available to "private
customers" as defined by the SFA or to anyone in Canada not a "Designated
Institution".