NAME
CGI::Session::Driver::oracle
- A CGI::Session driver for Oracle
Synopsis
$s = CGI::Session -> new('driver:Oracle', $sid);
$s = CGI::Session -> new('driver:Oracle', $sid,
{
DataSource => 'dbi:Oracle:test',
User => 'sherzodr',
Password => 'hello',
});
$s = CGI::Session -> new('driver:Oracle', $sid, {Handle => $dbh});
or
$s = new CGI::Session('driver:Oracle', undef,
{
TableName=>'session',
IdColName=>'my_id',
DataColName=>'my_data',
Handle=>$dbh,
});
Description
CGI::Session::Driver::oracle
stores session records in an Oracle table. For details see CGI::Session::Driver::DBI, its parent class.
Driver Arguments
The CGI::Session::Driver::oracle
driver supports all the arguments documented in CGI::Session::Driver::DBI. In addition, the DataSource argument can optionally leave the leading "dbi:Oracle:" string out:
$s = CGI::Session -> new('driver:Oracle', $sid, {DataSource => 'shopping_cart'});
# is the same as:
$s = CGI::Session -> new('driver:Oracle', $sid, {DataSource => 'dbi:Oracle:shopping_cart'});
Backwards Compatibility
For backwards compatibility, you can also set the table like this before calling new()
. However, it is not recommended because it can cause conflicts in a persistent environment.
$CGI::Session::Oracle::TABLE_NAME = 'my_sessions';
The sessions
table
The CGI::Session::DBI
docs recommend using this SQL create statement:
create table sessions
(
id char(32) not null unique,
a_session text not null
);
Under Oracle, change the column type of the a_session
column from text
to long
, and if you use Class::DBI::Loader
, which wants a primary key in every table, change the definition of your id
column too. Thus you want:
create table sessions
(
id char(32) not null primary key, # I.e.: 'unique' => 'primary key'.
a_session long not null # I.e.: 'text' => 'long'.
);
Distributions
This module is available both as a Unix-style distro (*.tgz) and an ActiveState-style distro (*.ppd). The latter is shipped in a *.zip file.
See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing each type of distro.
Credits
This code is partially copied from the corresponding MySql driver by Sherzod Ruzmetov and the Postgres driver by Cosimo Streppone.
Author
CGI::Session::Driver::oracle
was written by Ron Savage <ron@savage.net.au> in 2005.
Home page: http://savage.net.au/index.html
Copyright
Australian copyright (c) 2005, Ron Savage. All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Artistic License, a copy of which is available at: http://www.opensource.org/licenses/index.html