Apache...Oracle(3pm)

πŸ‘‘ Apache::Session::Store::Oracle β€” the vibe

ok so bestie, real talk: this is a page from the User Contributed Perl Documentation manual, and it's about Apache::Session::Store::Oracle(3pm). Yes that name has three dots in it, no I will not be explaining why, we move. πŸ’…


✨ NAME ✨

Apache::Session::Store::Oracle β€” the module that keeps your persistent data safe and sound in a Oracle database. she's a storage girlie and she's slaying it πŸ“


🌸 SYNOPSIS 🌸

here's the whole thing, exactly as it lives:

use Apache::Session::Store::Oracle;

my $store = new Apache::Session::Store::Oracle;

$store->insert($ref);
$store->update($ref);
$store->materialize($ref);
$store->remove($ref);

four little methods, four little jobs, no notes. ✨


πŸ’– DESCRIPTION πŸ’–

So. Apache::Session::Store::Oracle fulfills the storage interface of Apache::Session. That's the whole thing. It's the plug that makes Apache::Session go, and the place it stores all your session data is β€” you guessed it β€” a Oracle database. iconic behavior honestly πŸ‘‘


πŸŽ€ SCHEMA πŸŽ€

okay so before any of this works you need a table. and bestie, that table has to be called sessions, and it needs at least these columns:

id varchar2(32)     # or however long your session IDs are.
a_session long

and yeah β€” that # or however long your session IDs are. is literally in there, it's giving "we trust you to know your own session IDs" and honestly? valid 🫢

if you wanna build this schema with the sqlplus program, run exactly this:

CREATE TABLE sessions (
   id varchar2(32) not null primary key,
   a_session long
);
🚨 but listen β€” if you use some other command instead, you gotta ensure that there is a unique index on the table's id column. no unique index, no slay. periodt.

πŸ¦‹ CONFIGURATION πŸ¦‹

The module must know what datasource, username, and password to use when connecting to the database. These values can be set using the options hash (go read the Apache::Session documentation, she explains it). The options are DataSource, UserName, and Password.

Example, verbatim, look at her:

tie %hash, 'Apache::Session::Oracle', $id, {
    DataSource => 'dbi:Oracle:database',
    UserName   => 'database_user',
    Password   => 'K00l'
};

the password is K00l and that is canon, don't touch it 😭


Instead of all that, you may pass in an already-opened DBI handle to your database. Like so:

tie %hash, 'Apache::Session::Oracle', $id, {
    Handle => $dbh
};

easy. convenient. no cap. ✨


The last option is LongReadLen, which specifies the maximum size of the session object. If you don't supply it, the default maximum size is 8 KB. small but mighty I guess πŸ’€


🌈 AUTHOR 🌈

This modules was written by Jeffrey William Baker <jwbaker@acm.org> β€” yes, "modules", we're keeping the typo, it's part of the lore πŸ’œ

A fix for the commit policy was contributed by Michael Schout <mschout@gkg.net> β€” ty king 🫢


⭐ SEE ALSO ⭐

  • Apache::Session
  • Apache::Session::Store::DBI

go read them, they're the supporting cast and they ate πŸ”₯


okay that's the whole page bestie, every flag, every column, every option, all of it. you're so ready for this. go store some sessions πŸ’…βœ¨

and for the sign-off: this was perl v5.36.0, dated 2022-11-19, from the User Contributed Perl Documentation section. mwah. πŸŽ€

πŸ“¦ where this page comes from