Revert
[openafs-wiki.git] / TWiki / CGISessionDriverMysqlDotPm.mdwn
1 # <a name="Package &lt;code&gt;="></a> Package =
2
3 **extends** `CGI::Session::Driver::DBI `
4
5 <div>
6   <ul>
7     <li><a href="#Package =="> Package ==</a></li>
8   </ul>
9 </div>
10
11 =head1 NAME
12
13 CGI::Session::Driver::mysql - CGI::Session driver for [[MySQL]] database
14
15 =head1 SYNOPSIS
16
17 $s = new CGI::Session( "driver:mysql", $sid); $s = new CGI::Session( "driver:mysql", $sid, \{ [[DataSource]] =&gt; 'dbi:mysql:test', User =&gt; 'sherzodr', Password =&gt; 'hello' \}); $s = new CGI::Session( "driver:mysql", $sid, \{ Handle =&gt; $dbh \} );
18
19 =head1 DESCRIPTION
20
21 B stores session records in a [[MySQL]] table. For details see L&lt;CGI::Session::Driver::DBI|CGI::Session::Driver::DBI&gt;, its parent class.
22
23 It's especially important for the [[MySQL]] driver that the session ID column be defined as a primary key, or at least "unique", like this:
24
25 CREATE TABLE sessions ( id CHAR(32) NOT NULL PRIMARY KEY, a\_session TEXT NOT NULL );
26
27 =head2 DRIVER ARGUMENTS
28
29 B driver supports all the arguments documented in L&lt;CGI::Session::Driver::DBI|CGI::Session::Driver::DBI&gt;. In addition, I argument can optionally leave leading "dbi:mysql:" string out:
30
31 $s = new CGI::Session( "driver:mysql", $sid, \{DataSource=&gt;'shopping\_cart'\}); # is the same as: $s = new CGI::Session( "driver:mysql", $sid, \{DataSource=&gt;'dbi:mysql:shopping\_cart'\});
32
33 =head2 BACKWARDS COMPATIBILITY
34
35 For backwards compatibility, you can also set the table like this before calling C&lt;new()&gt;. However, it is not recommended because it can cause conflicts in a persistent environment.
36
37 $CGI::Session::MySQL::TABLE\_NAME = 'my\_sessions';
38
39 =head1 LICENSING
40
41 For support and licensing see L&lt;CGI::Session|CGI::Session&gt;.