Server IP : 103.119.228.120 / Your IP : 18.188.59.124 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/local/ssl/local/share/perl5/CPAN/SQLite/ |
Upload File : |
# $Id: DBI.pm 53 2015-07-14 23:14:34Z stro $ package CPAN::SQLite::DBI; use strict; use warnings; our $VERSION = '0.211'; use English qw/-no_match_vars/; require File::Spec; use DBI; use parent 'Exporter'; our ($dbh, $tables, @EXPORT_OK); @EXPORT_OK = qw($dbh $tables); $tables = { 'info' => { 'primary' => { 'status' => q!INTEGER NOT NULL PRIMARY KEY!, }, 'other' => {}, 'key' => [], 'name' => 'status', 'id' => 'status', }, mods => { primary => {mod_id => q{INTEGER NOT NULL PRIMARY KEY}}, other => { mod_name => q{VARCHAR(100) NOT NULL}, dist_id => q{INTEGER NOT NULL}, mod_abs => q{TEXT}, mod_vers => q{VARCHAR(10)}, dslip => q{VARCHAR(5)}, chapterid => q{INTEGER}, }, key => [qw/dist_id mod_name/], name => 'mod_name', id => 'mod_id', has_a => {dists => 'dist_id'}, }, dists => { primary => {dist_id => q{INTEGER NOT NULL PRIMARY KEY}}, other => { dist_name => q{VARCHAR(90) NOT NULL}, auth_id => q{INTEGER NOT NULL}, dist_file => q{VARCHAR(110) NOT NULL}, dist_vers => q{VARCHAR(20)}, dist_abs => q{TEXT}, dist_dslip => q{VARCHAR(5)}, }, key => [qw/auth_id dist_name/], name => 'dist_name', id => 'dist_id', has_a => {auths => 'auth_id'}, has_many => {mods => 'dist_id', chaps => 'dist_id', }, }, auths => { primary => {auth_id => q{INTEGER NOT NULL PRIMARY KEY}}, other => { cpanid => q{VARCHAR(20) NOT NULL}, fullname => q{VARCHAR(40) NOT NULL}, email => q{TEXT}, }, key => [qw/cpanid/], has_many => {dists => 'dist_id'}, name => 'cpanid', id => 'auth_id', }, chaps => { primary => {chap_id => q{INTEGER NOT NULL PRIMARY KEY}}, other => { dist_id => q{INTEGER NOT NULL}, chapterid => q{INTEGER}, subchapter => q{TEXT}, }, key => [qw/dist_id/], id => 'chap_id', name => 'chapterid', has_a => {dists => 'dist_id'}, }, }; sub new { my ($class, %args) = @_; my $db_dir = $args{db_dir} || $args{CPAN}; my $db = File::Spec->catfile($db_dir, $args{db_name}); $dbh ||= DBI->connect("DBI:SQLite:$db", '', '', { RaiseError => 1, AutoCommit => 0, sqlite_use_immediate_transaction => 0, }); die "Cannot connect to $db" unless $dbh; $dbh->{AutoCommit} = 0; my $objs; foreach my $table (keys %$tables) { my $cl = $class . '::' . $table; $objs->{$table} = $cl->make(table => $table); } for my $table (keys %$tables) { foreach my $type (qw(primary other)) { foreach my $column (keys %{$tables->{$table}->{$type}}) { push @{$tables->{$table}->{columns}}, $column; } } } return bless {objs => $objs}, $class; } sub make { my ($class, %args) = @_; my $table = $args{table}; die qq{No table exists corresponding to '$class'} unless $table; my $info = $tables->{$table}; die qq{No information available for table '$table'} unless $info; my $self = {table => $table, columns => $info->{columns}, id => $info->{id}, name => $info->{name}, }; foreach (qw(name has_a has_many)) { next unless defined $info->{$_}; $self->{$_} = $info->{$_}; } return bless $self, $class; } sub db_error { my ($obj, $sth) = @_; return unless $dbh; if ($sth) { $sth->finish; undef $sth; } return $obj->{error_msg} = q{Database error: } . $dbh->errstr; } 1; =head1 NAME CPAN::SQLite::DBI - DBI information for the CPAN::SQLite database =head1 VERSION version 0.211 =head1 DESCRIPTION This module is used by L<CPAN::SQLite::Index> and L<CPAN::SQLite::Search> to set up some basic database information. It exports two variables: =over 3 =item C<$tables> This is a hash reference whose keys are the table names, with corresponding values being hash references whose keys are the columns of the table and values being the associated data types. =item C<$dbh> This is a L<DBI> database handle used to connect to the database. =back The main method of this module is C<make>, which is used to make the tables of the database. =head1 SEE ALSO L<CPAN::SQLite::Index> and L<CPAN::SQLite::Search> =cut