1CGI::Session::Driver::pUossetrgrCeosnqtlr(i3b)uted PerlCDGoIc:u:mSeenstsaitoino:n:Driver::postgresql(3)
2
3
4

NAME

6       CGI::Session::Driver::postgresql - PostgreSQL driver for CGI::Session
7

SYNOPSIS

9           use CGI::Session;
10           $session = CGI::Session->new("driver:PostgreSQL", undef, {Handle=>$dbh});
11

DESCRIPTION

13       CGI::Session::PostgreSQL is a CGI::Session driver to store session data
14       in a PostgreSQL table.
15

STORAGE

17       Before you can use any DBI-based session drivers you need to make sure
18       compatible database table is created for CGI::Session to work with.
19       Following command will produce minimal requirements in most SQL
20       databases:
21
22           CREATE TABLE sessions (
23               id CHAR(32) NOT NULL PRIMARY KEY,
24               a_session BYTEA NOT NULL
25           );
26
27       and within your code use:
28
29           use CGI::Session;
30           $session = CGI::Session->new("driver:PostgreSQL", undef, {Handle=>$dbh, ColumnType=>"binary"});
31
32       Please note the ColumnType argument. PostgreSQL's text type has
33       problems when trying to hold a null character. (Known as "\0" in Perl,
34       not to be confused with SQL NULL). If you know there is no chance of
35       ever having a null character in the serialized data, you can leave off
36       the ColumnType attribute. Using a BYTEA column type and "ColumnType =>
37       'binary'" is recommended when using Storable as the serializer or if
38       there's any possibility that a null value will appear in any of the
39       serialized data.
40
41       To use different column names, change the 'create table' statement, and
42       then simply do this:
43
44           $s = CGI::Session->new('driver:pg', undef,
45           {
46               TableName=>'session',
47               IdColName=>'my_id',
48               DataColName=>'my_data',
49               DataSource=>'dbi:pg:dbname=project',
50           });
51
52       or
53
54           $s = CGI::Session->new('driver:pg', undef,
55           {
56               TableName=>'session',
57               IdColName=>'my_id',
58               DataColName=>'my_data',
59               Handle=>$dbh,
60           });
61
62       For more details see CGI::Session::Driver::DBI, parent class.
63
64       Also see sqlite driver, which exercises different method for dealing
65       with binary data.
66
68       Copyright (C) 2002 Cosimo Streppone. All rights reserved. This library
69       is free software and can be modified and distributed under the same
70       terms as Perl itself.
71

AUTHORS

73       Cosimo Streppone <cosimo@cpan.org>, heavily based on the
74       CGI::Session::MySQL driver by Sherzod Ruzmetov, original author of
75       CGI::Session.
76
77       Matt LeBlanc contributed significant updates for the 4.0 release.
78

LICENSING

80       For additional support and licensing see CGI::Session
81
82
83
84perl v5.32.0                      2020-07-28CGI::Session::Driver::postgresql(3)
Impressum