simple.pm

来自「SinFP是一种新的识别对方计算机操作系统类型的工具」· PM 代码 · 共 118 行

PM
118
字号
## $Id: Simple.pm,v 1.12 2006/06/11 09:34:12 gomor Exp $#package DBIx::SQLite::Simple;use strict;use warnings;use Carp;our $VERSION = '0.33';require DBI;require Class::Gomor::Array;our @ISA = qw(Class::Gomor::Array);our @AS = qw(   db   _dbh);__PACKAGE__->cgBuildIndices;__PACKAGE__->cgBuildAccessorsScalar(\@AS);our $Dbo;=head1 NAMEDBIx::SQLite::Simple - easy access to SQLite databases using objects=head1 ATTRIBUTES=over 4=item B<db>Used to store the filename containing the SQLite database.=back=head1 METHODS=over 4=item B<new>(db => 'filename.db')Object creator. Takes one argument, and sets the global variable $Dbo to the newly created database handler.=cutsub new {   my $self = shift->SUPER::new(@_);   confess('Usage: new(db => $db)') unless $self->db;   my $dbh = DBI->connect(      'dbi:SQLite:dbname='. $self->db,      '', '',      {         RaiseError => 0,         PrintError => 0,         PrintWarn  => 0,         AutoCommit => 0,      },   ) or croak("new: ". $DBI::errstr);   $self->_dbh($dbh);   $Dbo = $self;}=item B<commit>Changes made on created database are not automatically commited. You must call this method if you want to commit pending changes.=cutsub commit {   my $self = shift;   $self->_dbh->commit if $self->_dbh;}=item B<close>When you're done using the database, you can disconnect from it. This method will not commit changes, so do it before closing.=cutsub close {   my $self = shift;   $self->_dbh->disconnect if $self->_dbh;   $self->_dbh(undef);}sub DESTROY {   my $self = shift;   if ($self->_dbh) {      $self->commit;      $self->close;   }}=back=head1 AUTHORPatrice E<lt>GomoRE<gt> Auffret=head1 COPYRIGHT AND LICENSECopyright (c) 2005-2006, Patrice E<lt>GomoRE<gt> AuffretYou may distribute this module under the terms of the Artistic license.See LICENSE.Artistic file in the source distribution archive.=cut1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?