data/TWiki/CGISessionDriverMysqlDotPm.txt,v
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
colas@0
     1
head	1.1;
colas@0
     2
access;
colas@0
     3
symbols;
colas@0
     4
locks; strict;
colas@0
     5
comment	@# @;
colas@0
     6
colas@0
     7
colas@0
     8
1.1
colas@0
     9
date	2008.01.22.03.21.35;	author TWikiContributor;	state Exp;
colas@0
    10
branches;
colas@0
    11
next	;
colas@0
    12
colas@0
    13
colas@0
    14
desc
colas@0
    15
@buildrelease
colas@0
    16
@
colas@0
    17
colas@0
    18
colas@0
    19
1.1
colas@0
    20
log
colas@0
    21
@buildrelease
colas@0
    22
@
colas@0
    23
text
colas@0
    24
@---+ Package ==
colas@0
    25
*extends* <tt>CGI::Session::Driver::DBI </tt>
colas@0
    26
colas@0
    27
colas@0
    28
%TOC%
colas@0
    29
=head1 NAME
colas@0
    30
colas@0
    31
CGI::Session::Driver::mysql - CGI::Session driver for MySQL database
colas@0
    32
colas@0
    33
=head1 SYNOPSIS
colas@0
    34
colas@0
    35
    $s = new CGI::Session( "driver:mysql", $sid);
colas@0
    36
    $s = new CGI::Session( "driver:mysql", $sid, { DataSource  => 'dbi:mysql:test',
colas@0
    37
                                                   User        => 'sherzodr',
colas@0
    38
                                                   Password    => 'hello' });
colas@0
    39
    $s = new CGI::Session( "driver:mysql", $sid, { Handle => $dbh } );
colas@0
    40
colas@0
    41
=head1 DESCRIPTION
colas@0
    42
colas@0
    43
B<mysql> stores session records in a MySQL table. For details see L<CGI::Session::Driver::DBI|CGI::Session::Driver::DBI>, its parent class.
colas@0
    44
colas@0
    45
It's especially important for the MySQL driver that the session ID column be
colas@0
    46
defined as a primary key, or at least "unique", like this:
colas@0
    47
colas@0
    48
 CREATE TABLE sessions (
colas@0
    49
     id CHAR(32) NOT NULL PRIMARY KEY,
colas@0
    50
     a_session TEXT NOT NULL
colas@0
    51
  );
colas@0
    52
colas@0
    53
=head2 DRIVER ARGUMENTS
colas@0
    54
colas@0
    55
B<mysql> driver supports all the arguments documented in L<CGI::Session::Driver::DBI|CGI::Session::Driver::DBI>. In addition, I<DataSource> argument can optionally leave leading "dbi:mysql:" string out:
colas@0
    56
colas@0
    57
    $s = new CGI::Session( "driver:mysql", $sid, {DataSource=>'shopping_cart'});
colas@0
    58
    # is the same as:
colas@0
    59
    $s = new CGI::Session( "driver:mysql", $sid, {DataSource=>'dbi:mysql:shopping_cart'});
colas@0
    60
colas@0
    61
=head2 BACKWARDS COMPATIBILITY
colas@0
    62
colas@0
    63
For backwards compatibility, you can also set the table like this before calling C<new()>. However, it is not recommended because it can cause conflicts in a persistent environment. 
colas@0
    64
colas@0
    65
    $CGI::Session::MySQL::TABLE_NAME = 'my_sessions';
colas@0
    66
colas@0
    67
=head1 LICENSING
colas@0
    68
colas@0
    69
For support and licensing see L<CGI::Session|CGI::Session>.
colas@0
    70
colas@0
    71
@