| 1 | ############################################################################# | ||
| 2 | # | ||
| 3 | # Apache::Session::Oracle | ||
| 4 | # Apache persistent user sessions in a Oracle database | ||
| 5 | # Copyright(c) 2000 Jeffrey William Baker (jwbaker@acm.org) | ||
| 6 | # Distribute under the Perl License | ||
| 7 | # | ||
| 8 | ############################################################################ | ||
| 9 | |||
| 10 | package Apache::Session::Oracle; | ||
| 11 | |||
| 12 | use strict; | ||
| 13 | use vars qw(@ISA $VERSION); | ||
| 14 | |||
| 15 | $VERSION = '1.01'; | ||
| 16 | @ISA = qw(Apache::Session); | ||
| 17 | |||
| 18 | use Apache::Session; | ||
| 19 | use Apache::Session::Lock::Null; | ||
| 20 | use Apache::Session::Store::Oracle; | ||
| 21 | use Apache::Session::Generate::MD5; | ||
| 22 | use Apache::Session::Serialize::Base64; | ||
| 23 | |||
| 24 | sub populate { | ||
| 25 | my $self = shift; | ||
| 26 | |||
| 27 | $self->{object_store} = new Apache::Session::Store::Oracle $self; | ||
| 28 | $self->{lock_manager} = new Apache::Session::Lock::Null $self; | ||
| 29 | $self->{generate} = \&Apache::Session::Generate::MD5::generate; | ||
| 30 | $self->{validate} = \&Apache::Session::Generate::MD5::validate; | ||
| 31 | $self->{serialize} = \&Apache::Session::Serialize::Base64::serialize; | ||
| 32 | $self->{unserialize} = \&Apache::Session::Serialize::Base64::unserialize; | ||
| 33 | |||
| 34 | return $self; | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =head1 NAME | ||
| 42 | |||
| 43 | Apache::Session::Oracle - An implementation of Apache::Session | ||
| 44 | |||
| 45 | =head1 SYNOPSIS | ||
| 46 | |||
| 47 | use Apache::Session::Oracle; | ||
| 48 | |||
| 49 | #if you want Apache::Session to open new DB handles: | ||
| 50 | |||
| 51 | tie %hash, 'Apache::Session::Oracle', $id, { | ||
| 52 | DataSource => 'dbi:Oracle:sessions', | ||
| 53 | UserName => $db_user, | ||
| 54 | Password => $db_pass, | ||
| 55 | Commit => 1 | ||
| 56 | }; | ||
| 57 | |||
| 58 | #or, if your handles are already opened: | ||
| 59 | |||
| 60 | tie %hash, 'Apache::Session::Oracle', $id, { | ||
| 61 | Handle => $dbh, | ||
| 62 | Commit => 1 | ||
| 63 | }; | ||
| 64 | |||
| 65 | =head1 DESCRIPTION | ||
| 66 | |||
| 67 | This module is an implementation of Apache::Session. It uses the Oracle | ||
| 68 | backing store and no locking. See the example, and the documentation for | ||
| 69 | Apache::Session::Store::Oracle for more details. | ||
| 70 | |||
| 71 | =head1 USAGE | ||
| 72 | |||
| 73 | The special Apache::Session argument for this module is Commit. You MUST | ||
| 74 | provide the Commit argument, which instructs this module to either commit | ||
| 75 | the transaction when it is finished, or to simply do nothing. This feature | ||
| 76 | is provided so that this module will not have adverse interactions with your | ||
| 77 | local transaction policy, nor your local database handle caching policy. The | ||
| 78 | argument is mandatory in order to make you think about this problem. | ||
| 79 | |||
| 80 | This module also respects the LongReadLen argument, which specifies the maximum | ||
| 81 | size of the session object. If not specified, the default maximum is 8 KB. | ||
| 82 | |||
| 83 | =head1 AUTHOR | ||
| 84 | |||
| 85 | This module was written by Jeffrey William Baker <jwbaker@acm.org>. | ||
| 86 | |||
| 87 | =head1 SEE ALSO | ||
| 88 | |||
| 89 | L<Apache::Session::File>, L<Apache::Session::Flex>, | ||
| 90 | L<Apache::Session::DB_File>, L<Apache::Session::Postgres>, L<Apache::Session> |