On Tue, 23 May 2000, Michael Schout wrote:
> On Sun, Jun 29, 2036 at 12:21:26AM +0000, Edgardo Szulsztein wrote:
> > Hi again
> >
> > It worked great. Thanks for the help!
> >
> > Now, I would like to make it work with the postgresql database server. How
> > could I do it (I don't like the list, but I couldn't find this information in
> > the documentation).
>
> One of the problems I ran into when doing this was that Apache::Session uses
> Storable to freeze the session data before storing it in the database, put
> PostgreSQL does not like binary data in TEXT fields. So out of the box, it
> doesnt seem that you can use Apache::Session::DBI with postgresql.
>
> However, its very simple to get around this. I just created my own
> Apache::Session::UUDBI and Apache::Session::UUDBIStore modules (by copying the
> source for Apache::Session::DBI and Apache::Session::DBIStore). I then
> modified it so that every time it wrote the session data it called pack("u*",
> $data) to uuencode the session data. And everywhere it retrieved the session
> data it calls unpack("u*" $data) so that it reverses the operation. This
> results in storing the session data in the db in uuencoded format (text-only)
> and makes postgresql happy.
>
> Anyway, thats how I got around it. I'm sure there are several others.
>
> If you would be interested in my Apache::Session::UUDBI modules, send me an
> email and I will send you (or anyone else who might be interested) a copy of
> it.
That's precisely the right solution. The forthcoming Apache::Session 1.50
is slightly redisigned so that you can plug in the serialization scheme of
your choice, just as you can currently swap out the backing stores. The
codebase currently consists of the regular Storable, Storable wrapped with
MIME::Base64, and Storable wrapped with pack/unpack.
Are there other serialization schemes that need to be considered? I need
to test this stuff with a running Postgres, but other than that the code
is ready to be shipped.
-jwb