Apache::Session::DBIBase64Store - Session persistence via DBI with ASCII


Apache-iNcom documentation  | view source Contained in the Apache-iNcom distribution.

Index


NAME

Top

Apache::Session::DBIBase64Store - Session persistence via DBI with ASCII encoding of session data.

SYNOPSIS

Top

    package MySession;

    use Apache::Session;
    use Apache::Session::DBIBase64Store;
    use Apache::Session::NullLocker;

    @ISA = ( Apache::Session );

    sub get_object_store {
	my $self = shift;

	return new Apache::Session::DBIBase64Store $self;
    }

    sub get_lock_manager {
	my $self = shift;

	return new Apache::Session::NullLocker $self;
    }

DESCRIPTION

Top

Apache::Session::DBIBase64Store is a session data persistent store for Apache::Session. This module should be used instead of DBIStore in database that don't support binary data in table fields (like PostgreSQL for instance).

This store also store the creation time of the session and the timestamp of the last update.

SCHEMA

Top

This modules expect a table created with the following schema :

    CREATE TABLE sessions (
	id	    CHAR(32) PRIMARY KEY,
	length	    INT,
	a_session   TEXT,
	created	    TIMESTAMP DEFAULT 'now()',
	last_update TIMESTAMP DEFAULT 'now()'
	locked_by   INT
    );




The previous SQL statement is valid for PostgreSQL. Adapt for your specific DBMS.

NOTE: The id length can be fine tuned for specific application. By default, Apache::Session uses 16 char length ID, but I usually use 128 bits ID (32 chars).

CONFIGURATION

Top

This package can either use an already open DBH handle or it can be told the DataSource, UserName and Password to open its own database connection.

In the first case use something like this (using the SYNOPSIS example):

    my $dbh = DBI->connect( $DSN, $USER, $PASSWORD, { AutoCommit => 0,
						      RaiseError => 1,} );
    tie %sesssion, 'MySession', undef, { dbh => $dbh };

In the second case use something like this :

    tie %session, 'MySession', undef, { DataSource => $DSN,
					UserName   => $USERNAME,
					Password   => $PASSWORD,
    				        };

In the case where you give this module a DBH handle to use, rather than to manage its own. The module will commit the transaction after each insert, update or delete. Be warned if you are not using AutoCommit mode.

CREDITS

Top

This module is largely based on Apache::Session::DBIStore (Apache::Session::DBIStore) by Jeffrey William Baker (jeffrey@kathyandjeffrey.net).

AUTHOR

Top

Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc. All rights reserved.

Parts Copyright (c) 1998,1999 Jeffrey William Baker (jeffrey@kathyandjeffrey.net)

This program is free software; you can redistribute it and/or modify it under the terms as perl itself.

SEE ALSO

Top

Apache::Session(3) Apache::Session::DBIStore(3) DBI(3)


Apache-iNcom documentation  | view source Contained in the Apache-iNcom distribution.