OT: Apache::Session::DBI vs postgresql? --help - Mailing list pgsql-general

From will trillich
Subject OT: Apache::Session::DBI vs postgresql? --help
Date
Msg-id 20010615090623.A11719@serensoft.com
Whole thread Raw
Responses Re: OT: Apache::Session::DBI vs postgresql? --help  (Alex Pilosov <alex@pilosoft.com>)
List pgsql-general
LONG VERSION:

having burned the manpages into my eyelids, and coming up short,
i though i'd bug the community at large with this--surely
someone listening here is using apache with postgres to do some
handy user-tracking...?

    man Apache::Session::DBI

refers me to

    man Apache::Session::DBIStore

which says

    To use this module, you will need these columns in a table
    called 'sessions':

        id char(16)
        length int(11)
        a_session text

which might be ducky for mysql, but on postgresql (7.0.3 anyhow)
"length" is illegal as a field name.

i then manage to run across

    man Apache::Session::Store::Postgres

which says

    To use this module, you will need at least these columns
    in a table called 'sessions':

        id char(32)     # or however long your session IDs are.
        a_session text  # This has an ~8 KB limit :(

and then

    man Apache::Session::Postgres

tells me to try

    use Apache::Session::Postgres;

    #if you want Apache::Session to open new DB handles:

    tie %hash, 'Apache::Session::Postgres', $id, {
        DataSource => 'dbi:Pg:dbname=sessions',
        UserName   => $db_user,
        Password   => $db_pass,
        Commit     => 1
    };

which yields only a

    Can't locate object method "TIEHASH" via package
    "Apache::Session::Postgres" at doomedtofail.pl line 10.

even though Apache::Session::Postgres "@ISA" Apache::Session,
which means it should inherit the TIEHASH method there.

--

(((
if, as an ordinary user, i use "Apache::Session::DBI" i get

    Permission denied at /usr/local/lib/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 63.

before anything gets 'tied'; if i try it as root, i get past the
permission problem, but then stumble into

    DBD::Pg::st execute failed: ERROR:  Unterminated quoted string

the investigation of which shows it's preparing a select
statement that's looking for the unfriendly "length" field --
but i digress.
)))

SHORT VERSION: (the question)

    ==========================================================
    i've not figured out how to get Apache::Session::Postgres
    or Apache::Session::Store::Postgres to do their thing --
    how does a MOD_PERL script get its hooks into POSTGRES via
    Apache::Session::DBI ?
    ==========================================================

i don't really want to revert to the manual approach:

    use Apache::Session::Store::Postgres;
    my $store = new Apache::Session::Store::Postgres;
    $store->insert($ref);
    $store->update($ref);
    $store->materialize($ref);
    $store->remove($ref);

i'm sure the "tie %hash,'Apache::Session::DBI',undef" form
really does work as documented -- so what'd i miss?

--
I figure: if a man's gonna gamble, may as well do it
without plowing.   -- Bama Dillert, "Some Came Running"

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re: Insert and limit
Next
From: "Tim Barnard"
Date:
Subject: Re: Indexing varchar[]'s