data/TWiki/CGISessionDriverMysqlDotPm.txt,v
changeset 0 414e01d06fd5
equal deleted inserted replaced
-1:000000000000 0:414e01d06fd5
       
     1 head	1.1;
       
     2 access;
       
     3 symbols;
       
     4 locks; strict;
       
     5 comment	@# @;
       
     6 
       
     7 
       
     8 1.1
       
     9 date	2008.01.22.03.21.35;	author TWikiContributor;	state Exp;
       
    10 branches;
       
    11 next	;
       
    12 
       
    13 
       
    14 desc
       
    15 @buildrelease
       
    16 @
       
    17 
       
    18 
       
    19 1.1
       
    20 log
       
    21 @buildrelease
       
    22 @
       
    23 text
       
    24 @---+ Package ==
       
    25 *extends* <tt>CGI::Session::Driver::DBI </tt>
       
    26 
       
    27 
       
    28 %TOC%
       
    29 =head1 NAME
       
    30 
       
    31 CGI::Session::Driver::mysql - CGI::Session driver for MySQL database
       
    32 
       
    33 =head1 SYNOPSIS
       
    34 
       
    35     $s = new CGI::Session( "driver:mysql", $sid);
       
    36     $s = new CGI::Session( "driver:mysql", $sid, { DataSource  => 'dbi:mysql:test',
       
    37                                                    User        => 'sherzodr',
       
    38                                                    Password    => 'hello' });
       
    39     $s = new CGI::Session( "driver:mysql", $sid, { Handle => $dbh } );
       
    40 
       
    41 =head1 DESCRIPTION
       
    42 
       
    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.
       
    44 
       
    45 It's especially important for the MySQL driver that the session ID column be
       
    46 defined as a primary key, or at least "unique", like this:
       
    47 
       
    48  CREATE TABLE sessions (
       
    49      id CHAR(32) NOT NULL PRIMARY KEY,
       
    50      a_session TEXT NOT NULL
       
    51   );
       
    52 
       
    53 =head2 DRIVER ARGUMENTS
       
    54 
       
    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:
       
    56 
       
    57     $s = new CGI::Session( "driver:mysql", $sid, {DataSource=>'shopping_cart'});
       
    58     # is the same as:
       
    59     $s = new CGI::Session( "driver:mysql", $sid, {DataSource=>'dbi:mysql:shopping_cart'});
       
    60 
       
    61 =head2 BACKWARDS COMPATIBILITY
       
    62 
       
    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. 
       
    64 
       
    65     $CGI::Session::MySQL::TABLE_NAME = 'my_sessions';
       
    66 
       
    67 =head1 LICENSING
       
    68 
       
    69 For support and licensing see L<CGI::Session|CGI::Session>.
       
    70 
       
    71 @