CGI-Session-ODBC
view release on metacpan or search on metacpan
return undef;
}
return 1;
}
# Clean up prior to destroying the driver
sub teardown
{
my ($self, $sid, $options) = @_;
my $dbh = $self->ODBC_dbh($options);
# Call commit() if we're not set to auto-commit
$dbh->commit() unless $dbh->{AutoCommit};
# Disconnect
$dbh->disconnect() if $self->{ODBC_disconnect};
return 1;
}
# Create the driver
sub ODBC_dbh
{
my ($self, $options) = @_;
my $args = $options->[1] || {};
return $self->{ODBC_dbh} if defined $self->{ODBC_dbh};
$TABLE_NAME = $args->{TableName} if defined $args->{TableName};
require DBI;
$self->{ODBC_dbh} = $args->{Handle} || DBI->connect(
$args->{DataSource},
$args->{User} || undef,
$args->{Password} || undef,
{ RaiseError=>1, PrintError=>1, AutoCommit=>1, LongReadLen=>32767 }
);
# If we're the one established the connection,
# we should be the one who closes it
$args->{Handle} or $self->{ODBC_disconnect} = 1;
return $self->{ODBC_dbh};
}
=head1 SEE ALSO
=over 4
=item *
L<CGI::Session|CGI::Session> - CGI::Session manual
=item *
L<CGI::Session::Tutorial|CGI::Session::Tutorial> - extended CGI::Session manual
=item *
L<CGI::Session::CookBook|CGI::Session::CookBook> - practical solutions for real life problems
=item *
C<RFC 2965> - "HTTP State Management Mechanism" found at ftp://ftp.isi.edu/in-notes/rfc2965.txt
=item *
L<CGI|CGI> - standard CGI library
=item *
L<Apache::Session|Apache::Session> - another fine alternative to CGI::Session
=back
=head1 COPYRIGHT
Copyright (C) 2003-2004 by Jason A. Crome. All rights reserved.
This library is free software and can be modified and distributed under the
same terms as Perl itself.
=head1 AUTHOR
Jason A. Crome C<< <cromedome@cpan.org> >>.
=head1 CREDITS
This module is directly based on CGI::Session::PostgreSQL by Cosimo Streppone,
and indirectly based on CGI::Session::MySQL module by Sherzod Ruzmetov.
Many thanks to Rhesa Rozendaal for the placeholder patch.
=cut
1; # End of CGI::Session::ODBC
( run in 0.502 second using v1.01-cache-2.11-cpan-6aa56a78535 )