Orac

 view release on metacpan or  search on metacpan

orac_Oracle.pm  view on Meta::CPAN


   while (@res = $sth->fetchrow) {
      $c_t[$ind_bd_cnt] = $res[0];
      $w = $t->Entry(-textvariable=>\$c_t[$ind_bd_cnt],-cursor=>undef);
      $t->windowCreate('end',-window=>$w);

      unless ($uf_type eq 'index'){

         $sql_entry[$ind_bd_cnt] = "";

         $w = $t->Entry(   -textvariable=>\$sql_entry[$ind_bd_cnt],
                           -cursor=>undef,
                           -foreground=>$main::fc,
                           -background=>$main::ec
                       );

         $t->windowCreate('end',-window=>$w);

      }
      $t_t[$ind_bd_cnt] = "$res[1] $res[2]";

      $w = $t->Entry( -textvariable=>\$t_t[$ind_bd_cnt],
                      -cursor=>undef);

      $t->windowCreate('end',-window=>$w);

      $i_ac[$ind_bd_cnt] = "$res[0]";

      $i_uc[$ind_bd_cnt] = 0;

      $w = $t->Checkbutton( -variable=>\$i_uc[$ind_bd_cnt],
                            -relief=>'flat');

      $t->windowCreate('end',-window=>$w);

      $t->insert('end', "\n");
      $ind_bd_cnt++;
   }
   $ind_bd_cnt--;
   $sth->finish;

   $t->configure( -state=>'disabled' );

   $t->pack( -expand =>1,
             -fill=>'both'
           );

   my $bb = $bd->Frame->pack( -side=>'bottom',
                              -before=> $t
                            );

   if ($uf_type eq 'index'){
      $uf_txt = 'Build Index';
   } else {
      $uf_txt = $main::lg{sel_info};
   }

   $bb->Button( -text=>$uf_txt,
                -command=>sub{ $bd->Busy;
                               $self->selector($bd,$uf_type);
                               $bd->Unbusy}
              )->pack (-side=>'right', 
                       -anchor=>'e');

   $bd->Show;
}

sub selector {

   my $self = shift;

   # User may wish to narrow search for info, down to 
   # a particular set of rows, and order these rows.
   # This function allows them to do that.

   my($sel_d,$uf_type) = @_;

   if ($uf_type eq 'index'){
      $self->build_ord($sel_d,$uf_type);
      return;
   }
   $l_sel_str = ' select ';

   my $i;

   for $i (0..$ind_bd_cnt){
      if ($i != $ind_bd_cnt){
         $l_sel_str = $l_sel_str . "$i_ac[$i], ";
      } else {
         $l_sel_str = $l_sel_str . "$i_ac[$i] ";
      }
   }

   $l_sel_str = $l_sel_str . "\nfrom ${own}.${obj} ";

   my $flag = 0;
   my $last_one = 0;

   for $i (0..$ind_bd_cnt){
      if ($i_uc[$i] == 1){
         $flag = 1;
         $last_one = $i;
      }
   }

   my $where_bit = "\nwhere ";
   for $i (0..$ind_bd_cnt){
      my $sql_bit = $sql_entry[$i];
      if (defined($sql_bit) && length($sql_bit)){
         $l_sel_str = $l_sel_str . $where_bit . "$i_ac[$i] $sql_bit ";
         $where_bit = "\nand ";
      }
   }
   $self->build_ord($sel_d,$uf_type);
   $self->and_finally($sel_d,$l_sel_str);
}
sub and_finally {
   my $self = shift;

   my($af_d,$cm) = @_;

orac_Oracle.pm  view on Meta::CPAN

   my @res;

   while (@res = $sth->fetchrow) {
      $detected++;
      if($detected == 1){

         $main::swc{errors_orac} = MainWindow->new();
         $main::swc{errors_orac}->title($main::lg{err_obj});

         my(@err_lay) = qw/-side top -padx 5 -expand no -fill both/;

         my $err_menu = $main::swc{errors_orac}->Frame->pack(@err_lay);
         my $orac_li = $main::swc{errors_orac}->Photo(-file=>'img/orac.gif');

         $err_menu->Label(-image=>$orac_li,
                          -borderwidth=>2,
                          -relief=>'flat'
                         )->pack(-side=>'left',-anchor=>'w');

         $err_menu->Button(
            -text=>$main::lg{exit},
            -command=> 
               sub{  
                  $main::swc{errors_orac}->withdraw();
                  $main::sub_win_but_hand{errors_orac}->configure(
                                                             -state=>'active'
                                                                 )
                  }

                          )->pack(-side=>'left');

         my $err_top = $main::swc{errors_orac}->Frame->pack(-side=>'top',
                                                         -padx=>5,
                                                         -expand=>'yes',
                                                         -fill=>'both');

         $main::swc{errors_orac}->{text} = 
             $err_top->ScrlListbox(-width=>50,
                                   -background=>$main::bc,
                                   -foreground=>$main::fc
                                  )->pack(-side=>'top',
                                          -expand=>'yes',
                                          -fill=>'both');

         $err_top->Label(  -text=>$main::lg{doub_click},
                           -anchor=>'s',
                           -relief=>'groove'

                        )->pack(-side=>'bottom',
                                -before=>$main::swc{errors_orac}->{text},
                                -expand=>'no');

         main::iconize($main::swc{errors_orac});
      }
      $main::swc{errors_orac}->{text}->insert('end', @res);
   }
   $sth->finish;
   if($detected == 0){
      $self->{Main_window}->Busy;
      main::mes($self->{Main_window},$main::lg{no_rows_found});
      $self->{Main_window}->Unbusy;
   } else {

      $main::sub_win_but_hand{errors_orac}->configure(-state=>'disabled');
      $main::swc{errors_orac}->{text}->pack();

      $main::swc{errors_orac}->{text}->bind(
         '<Double-1>', 
         sub{  $main::swc{errors_orac}->Busy;
               $self->selected_error(
               $main::swc{errors_orac}->{text}->get('active')
                                     );
               $main::swc{errors_orac}->Unbusy}
                                       );
   }
}
sub dbas_orac {
   my $self = shift;

   # Creates DBA Viewer window

   my $cm = $self->f_str('dbas_orac','1');
   my $sth = $self->{Database_conn}->prepare( $cm ) || 
                die $self->{Database_conn}->errstr; 
   $sth->execute;
   my $detected = 0;

   my @res;

   while (@res = $sth->fetchrow) {
      $detected++;

      if($detected == 1){

         $main::swc{dbas_orac} = MainWindow->new();
         $main::swc{dbas_orac}->title($main::lg{dba_views});

         my(@dba_lay) = qw/-side top -padx 5 -expand no -fill both/;

         my $dba_menu = $main::swc{dbas_orac}->Frame->pack(@dba_lay);
         my $orac_li = $main::swc{dbas_orac}->Photo(-file=>'img/orac.gif');

         $dba_menu->Label(-image=>$orac_li,
                          -borderwidth=>2,
                          -relief=>'flat')->pack(-side=>'left',-anchor=>'w');

         $dba_menu->Button(
            -text=>$main::lg{exit},
            -command=>

               sub{
                  $main::swc{dbas_orac}->withdraw();
                  $main::sub_win_but_hand{dbas_orac}->configure(
                                                             -state=>'active'
                                                               )
                  } 

                          )->pack(-side=>'left');
      
         (@dba_lay) = qw/-side top -padx 5 -expand yes -fill both/;
         my $dba_top = $main::swc{dbas_orac}->Frame->pack(@dba_lay);

         $main::swc{dbas_orac}->{text} = 
            $dba_top->ScrlListbox(-width=>50,
                                  -background=>$main::bc,
                                  -foreground=>$main::fc
                                 )->pack(-expand=>'yes',-fill=>'both');

         $dba_top->Label(-text=>$main::lg{doub_click},
                         -anchor=>'s',
                         -relief=>'groove'
                        )->pack(-expand=>'no',
                                -side=>'bottom',
                                -before=>$main::swc{dbas_orac}->{text}
                               );

         main::iconize($main::swc{dbas_orac});
      }
      $main::swc{dbas_orac}->{text}->insert('end', @res);
   }
   $sth->finish;
   if($detected == 0){
      $self->{Main_window}->Busy;
      main::mes($self->{Main_window},$main::lg{no_rows_found});
      $self->{Main_window}->Unbusy;
   } else {

      $main::sub_win_but_hand{dbas_orac}->configure(-state=>'disabled');
      $main::swc{dbas_orac}->{text}->pack();

      $main::swc{dbas_orac}->{text}->bind(
         '<Double-1>',
         sub{ 
              print STDERR "dbas_orac: 0\n" if ($main::debug > 0);
              $main::swc{dbas_orac}->Busy;
              print STDERR "dbas_orac: 1\n" if ($main::debug > 0);
              $self->{Main_window}->Busy;
              print STDERR "dbas_orac: 2\n" if ($main::debug > 0);
              $self->univ_form( $self->{Main_window},
                                'SYS',
                                $main::swc{dbas_orac}->{text}->get('active'),
                                'form'
                              );
              print STDERR "dbas_orac: 3\n" if ($main::debug > 0);
              $self->{Main_window}->Unbusy;
              print STDERR "dbas_orac: 4\n" if ($main::debug > 0);
              $main::swc{dbas_orac}->Unbusy;
              print STDERR "dbas_orac: 5\n" if ($main::debug > 0);
            } 

                                   );
   }
}
sub addr_orac {

   print STDERR "in addr_orac:\n" if ($main::debug > 0);

   my $self = shift;

   # Creates DBA Viewer window

   my $cm = $self->f_str('addr_orac','1');
   my $sth = $self->{Database_conn}->prepare( $cm ) || 
                die $self->{Database_conn}->errstr; 
   $sth->execute;
   my $detected = 0;

   my @res;

   while (@res = $sth->fetchrow) {
      $detected++;
      if($detected == 1){
         $main::swc{addr_orac} = MainWindow->new();
         $main::swc{addr_orac}->title($main::lg{spec_addrss});

         my(@adr_lay) = qw/-side top -padx 5 -expand no -fill both/;
         my $addr_menu = $main::swc{addr_orac}->Frame->pack(@adr_lay);
         my $orac_li = $main::swc{addr_orac}->Photo(-file=>'img/orac.gif');


         $addr_menu->Label( -image=>$orac_li,
                            -borderwidth=>2,
                            -relief=>'flat'
                          )->pack(-side=>'left',
                                  -anchor=>'w');

         $addr_menu->Button(
            -text=>$main::lg{exit},
            -command=> 

               sub{ 
                  $main::swc{addr_orac}->withdraw();
                  $main::sub_win_but_hand{addr_orac}->configure(
                                                          -state=>'active'
                                                               )
                  } 

                           )->pack(-side=>'left');


         (@adr_lay) = qw/-side top -padx 5 -expand yes -fill both/;
         my $adr_top = $main::swc{addr_orac}->Frame->pack(@adr_lay);

         $main::swc{addr_orac}->{text} = 
            $adr_top->ScrlListbox(-width=>20,
                                  -background=>$main::bc,
                                  -foreground=>$main::fc
                                 )->pack(-expand=>'yes',-fill=>'both');

         $adr_top->Label(-text=>$main::lg{doub_click},
                         -anchor=>'s',
                         -relief=>'groove'

                        )->pack(   -expand=>'no',
                                   -side=>'bottom',
                                   -before=>$main::swc{addr_orac}->{text}
                               );

         main::iconize($main::swc{addr_orac});
      }
      $main::swc{addr_orac}->{text}->insert('end', @res);
   }
   $sth->finish;

   if($detected == 0){

      $self->{Main_window}->Busy;
      main::mes($self->{Main_window},$main::lg{no_rows_found});
      $self->{Main_window}->Unbusy;

   } else {

      $main::sub_win_but_hand{addr_orac}->configure(-state=>'disabled');
      $main::swc{addr_orac}->{text}->pack();

      $main::swc{addr_orac}->{text}->bind(
         '<Double-1>', 
         sub{  
               print STDERR "addr_orac: a1\n" if ($main::debug > 0);

               my $loc_addr = $main::swc{addr_orac}->{text}->get('active');

               print STDERR "addr_orac: a2\n" if ($main::debug > 0);

               $self->f_clr( $main::v_clr );
               my $cm = $self->f_str( 'sel_addr' , '1' );
               $self->show_sql( $cm , 
                                $main::lg{sel_addr} . ': ' . $loc_addr,
                                $loc_addr );

               print STDERR "addr_orac: a3\n" if ($main::debug > 0);

            }  
                                     );

   }
}

sub sids_orac {

   my $self = shift;

   # Creates DBA Viewer window

   my $cm = $self->f_str('sids_orac','1');
   my $sth = $self->{Database_conn}->prepare( $cm ) || 
                die $self->{Database_conn}->errstr; 
   $sth->execute;
   my $detected = 0;

   my @res;

   while (@res = $sth->fetchrow) {
      $detected++;
      if($detected == 1){
         $main::swc{sids_orac} = MainWindow->new();
         $main::swc{sids_orac}->title($main::lg{spec_sids});

         my(@sid_lay) = qw/-side top -padx 5 -expand no -fill both/;
         my $sid_menu = $main::swc{sids_orac}->Frame->pack(@sid_lay);
         my $orac_li = $main::swc{sids_orac}->Photo(-file=>'img/orac.gif');

         $sid_menu->Label(
                           -image=>$orac_li,
                           -borderwidth=>2,
                           -relief=>'flat'

                         )->pack( -side=>'left',
                                  -anchor=>'w' );

         $sid_menu->Button(  
            -text=>$main::lg{exit},
            -command=> 

               sub{ 
                  $main::swc{sids_orac}->withdraw();
                  $main::sub_win_but_hand{sids_orac}->configure(
                                                            -state=>'active'
                                                               ) 
                  } 

                          )->pack(-side=>'left');

         (@sid_lay) = qw/-side top -padx 5 -expand yes -fill both/;
         my $sid_top = $main::swc{sids_orac}->Frame->pack(@sid_lay);

         $main::swc{sids_orac}->{text} = 
            $sid_top->ScrlListbox(-width=>20,
                                  -background=>$main::bc,
                                  -foreground=>$main::fc
                                 )->pack(-expand=>'yes',-fill=>'both');

         $sid_top->Label(-text=>$main::lg{doub_click},
                         -anchor=>'s',
                         -relief=>'groove'

                        )->pack(  -expand=>'no',
                                  -side=>'bottom',
                                  -before=>$main::swc{sids_orac}->{text}
                               );

         main::iconize($main::swc{sids_orac});
      }
      $main::swc{sids_orac}->{text}->insert('end', @res);
   }
   $sth->finish;
   if($detected == 0){
      $self->{Main_window}->Busy;
      main::mes($self->{Main_window},$main::lg{no_rows_found});
      $self->{Main_window}->Unbusy;
   } else {

      $main::sub_win_but_hand{sids_orac}->configure(-state=>'disabled');
      $main::swc{sids_orac}->{text}->pack();

      $main::swc{sids_orac}->{text}->bind(
         '<Double-1>', 
         sub { $main::swc{sids_orac}->Busy;

               $self->f_clr( $main::v_clr );
               my $cm = $self->f_str( 'sel_sid' , '1' );
               my $sid_param = $main::swc{sids_orac}->{text}->get('active');
               $self->show_sql( $cm , 
                                $main::lg{sel_sid} . ': ' . $sid_param,
                                $sid_param );

               $main::swc{sids_orac}->Unbusy}
                                     );
   }
}
sub gh_roll_name {
   my $self = shift;

   my $cm = $self->f_str('time','2');
   my $sth = $self->{Database_conn}->prepare($cm) || 
                die $self->{Database_conn}->errstr; 
   $sth->execute;
   my($sample_time) = $sth->fetchrow;

   $sth->finish;

   $self->{Text_var}->insert('end', "$sample_time\n");

   $self->show_sql( $self->f_str('roll_orac','2'),
                    $main::lg{roll_seg_stats}
                  );

   $self->about_orac('txt/Oracle/rollback.1.txt');

}
sub gh_roll_stats {
   my $self = shift;

   my $cm = $self->f_str('time','2');
   my $sth = $self->{Database_conn}->prepare($cm) || 
                die $self->{Database_conn}->errstr; 
   $sth->execute;
   my($sample_time) = $sth->fetchrow;
   $sth->finish;

   $self->{Text_var}->insert('end', "$sample_time\n");
   $self->show_sql( $self->f_str('roll_orac','1'),
                    $main::lg{roll_seg_stats}
                  );
   $self->about_orac('txt/Oracle/rollback.2.txt');
}

sub gh_pool_frag {

   my $self = shift;

   $self->about_orac('txt/Oracle/pool_frag.1.txt');
   $self->show_sql( $self->f_str('pool_frag','1'),
                    $main::lg{pool_frag}
                  );
   $self->about_orac('txt/Oracle/pool_frag.2.txt');

}

sub explain_plan {

   my $self = shift;

   # First of all, check if we have the correct PLAN_TABLE
   # on board?

   my $explain_ok = 0;

   if ($self->check_exp_plan() == 0){

      main::mes($self->{Main_window},$main::lg{use_utlxplan});

   } else {

      $explain_ok = 1;

   }

   $main::swc{explain_plan} = MainWindow->new();
   $main::swc{explain_plan}->title($main::lg{explain_plan});

   my(@exp_lay) = qw/-side top -padx 5 -expand no -fill both/;
   my $dmb = $main::swc{explain_plan}->Frame->pack(@exp_lay);

   my $orac_li = $main::swc{explain_plan}->Photo(-file=>'img/orac.gif');

   $dmb->Label( -image=>$orac_li,
                -borderwidth=>2,
                -relief=>'flat'
             )->pack( -side=>'left',
                      -anchor=>'w' );

   # Add buttons.  Add a holder for the actual explain plan
   # button so we can enable/disable it later

   if($explain_ok){
      $expl_butt = $dmb->Button(-text=>$main::lg{explain},
                                -command=>sub{ $self->explain_it() }
                               )->pack(side=>'left');

      $dmb->Button(  -text=>$main::lg{clear},
                     -command=>sub{
                         $main::swc{explain_plan}->Busy;
                         $w_explain[2]->delete('1.0','end');
                         $w_holders[0] = $main::v_sys;
                         $w_holders[1] = $main::lg{explain_help};
                         $expl_butt->configure(-state=>'normal');
                         $main::swc{explain_plan}->Unbusy;
                                                  }
                  )->pack(side=>'left');
   }

   $dmb->Button(
      -text=>$main::lg{exit},

      -command=> sub{

         $main::swc{explain_plan}->withdraw();
         $main::sub_win_but_hand{explain_plan}->configure(-state=>'active');
         undef $sql_browse_arr

                    } 

               )->pack(-side=>'left');

   # Set counter up

   my $i;

   # Produce input/update screen.  First, get the SQL select
   # array filled, so we can work out the field titles

   my $cm = $self->f_str('explain_plan','2');
   my $sth;
   $sql_browse_arr = $self->do_query_fetch_all( $cm, \$sth );
   @w_titles = @{$sth->{NAME}};

   # Work out the length of the Titles fields

   my $num_cols = @w_titles;

   my $l_label_width = 5;
   my $l_entry_width = 55;
   my $l_entry_height = 13;

   for($i=0;$i<$num_cols;$i++){
      if( (length($w_titles[$i])) > $l_label_width){
         $l_label_width = length($w_titles[$i]);
      }
   }

   # Now work out screen sizings

   (@exp_lay) = qw/-side top -padx 5 -expand yes -fill both/;
   my $top_slice = $main::swc{explain_plan}->Frame->pack(@exp_lay);

   $main::swc{explain_plan}->{text} = 
      $top_slice->Scrolled(  'Text',
                             -wrap=>'none',
                             -cursor=>undef,
                             -height=>($l_entry_height + $num_cols + 3),
                             -width=>($l_entry_width + $l_label_width + 5),
                             -foreground=>$main::fc,
                             -background=>$main::bc
                          );

  
   for($i=0;$i<$num_cols;$i++){

orac_Oracle.pm  view on Meta::CPAN

                      "$l_pid_title:$l_pid";

      print STDERR "who_hold: (wait) scrllist_str>$scrllist_str<\n" 
         if ($main::debug > 0);

      $scroll_box->insert('end', $scrllist_str);

      # Hold User

      $l_username = $res[6];
      $l_osuser = $res[7];
      $l_serial = $res[8];
      $l_sid = $res[9];
      $l_pid = $res[10];

      print STDERR "who_hold: l_pid       >$l_pid<\n" 
         if ($main::debug > 0);

      print STDERR "who_hold: l_pid_title >$l_pid_title<\n" 
         if ($main::debug > 0);

      $scrllist_str = "$l_hold_title:$l_username," .
                      "$l_os_title:$l_osuser," .
                      "$l_ser_title:$l_serial," .
                      "$l_sid_title:$l_sid," .
                      "$l_pid_title:$l_pid";

      print STDERR "who_hold: scrllist_str>$scrllist_str<\n" 
         if ($main::debug > 0);

      $scroll_box->insert('end', $scrllist_str);
   }
   $sth->finish;

   if ($l_counter == 1){
      $scroll_box->bind(
   
            '<Double-1>', 
            sub{  $self->{Main_window}->Busy;
                  my @first_string = split(',', $scroll_box->get('active') );
   
                  print STDERR "who_hold: first_string>@first_string<\n" 
                     if ($main::debug > 0);
   
                  my @v_osuser = split('\:', $first_string[1]);
                  my @v_username = split('\:', $first_string[0]);
                  my @v_sid = split('\:', $first_string[2]);
   
                  print STDERR "who_hold: v_osuser  >$v_osuser[1]<\n" 
                     if ($main::debug > 0);
                  print STDERR "who_hold: v_username>$v_username[1]<\n" 
                     if ($main::debug > 0);
                  print STDERR "who_hold: v_sid     >$v_sid[1]<\n" 
                     if ($main::debug > 0);
   
                  $self->who_what( 1,
                                   $v_osuser[1],
                                   $v_username[1],
                                   $v_sid[1]
                                 );
                  $self->{Main_window}->Unbusy
               }
                       );
      $self->{Text_var}->insert('end', "\n");
   }

   # And finally, thank goodness, the actual report.

   $self->show_sql( $cm , $main::lg{who_hold} );
}

sub mts_mem
{
   my $self = shift;

   # Report for finding MTS statistics,
   # and providing secondary button to reveal further stats

   my $cm = $self->f_str( 'sess_curr_max_mem' , '1' );

   my $l_counter = 0;

   my $who_what_str;

   my $l_stat;
   my $l_stat_title;

   my $scroll_label;
   my $scroll_box;

   my @res;
   my @title_values;

   my $sth = $self->{Database_conn}->prepare( $cm ) || 
                die $self->{Database_conn}->errstr; 
   $sth->execute;

   while ( @res = $sth->fetchrow ) {

      if ($l_counter == 0){
         my $i;
         for ($i = 0;$i < $sth->{NUM_OF_FIELDS};$i++){
            $title_values[$i] = $sth->{NAME}->[$i];
         }
         $l_stat_title = $title_values[0];

         $l_counter = 1;

         $scroll_label = 
            $self->{Text_var}->Label( 
               -text=>"$main::lg{doub_click}",
               -relief=>'raised'
                                    );

         $scroll_box =
            $self->{Text_var}->ScrlListbox(-width=>40,
                                           -height=>3,
                                           -background=>$main::ec,
                                           -foreground=>$main::fc
                                          );

         print STDERR "mts_mem: scroll_box>$scroll_box<\n" 
            if ($main::debug > 0);

         $self->{Text_var}->windowCreate('end',-window=>$scroll_label);
         $self->{Text_var}->insert('end', "\n");

         $self->{Text_var}->windowCreate('end',-window=>$scroll_box);
         $self->{Text_var}->insert('end', "\n");
      } 

      $l_stat = $res[0];

      $who_what_str = "${l_stat_title}:$l_stat";
      $scroll_box->insert('end', $who_what_str);
   }
   $sth->finish;

   if ($l_counter == 1){
      $scroll_box->bind(
   
            '<Double-1>', 
            sub{  $self->{Main_window}->Busy;
                  my @stat_str = split('\:', $scroll_box->get('active') );
   
                  print STDERR "mts_mem: stat_str>@stat_str<\n" 
                     if ($main::debug > 0);
   
                  $self->who_what( 2,
                                   $stat_str[1]
                                 );
                  $self->{Main_window}->Unbusy
               }
                       );
   
      $self->{Text_var}->insert('end', "\n");
   }
   $self->show_sql( $cm , $main::lg{mts_mem} );
   
}

sub do_a_generic {

   my $self = shift;

   # On the final level of an HList, does the actual work
   # required.

   my ($l_mw, $l_gen_sep, $l_hlst, $input) = @_;

   print STDERR "do_a_generic: l_mw      >$l_mw<\n" if ($main::debug > 0);
   print STDERR "do_a_generic: l_gen_sep >$l_gen_sep<\n" if ($main::debug > 0);
   print STDERR "do_a_generic: l_hlst    >$l_hlst<\n" if ($main::debug > 0);
   print STDERR "do_a_generic: input     >$input<\n" if ($main::debug > 0);

   $l_mw->Busy;
   my $owner;
   my $generic;
   my $dum;

   ($owner, $generic, $dum) = split("\\$l_gen_sep", $input);
   
   my $cm = $self->f_str( $l_hlst , '99' );

   $self->{Database_conn}->func(1000000, 'dbms_output_enable');
   my $second_sth = $self->{Database_conn}->prepare( $cm ) || die $self->{Database_conn}->errstr; 
   
   $second_sth->bind_param(1,$owner);
   $second_sth->bind_param(2,$generic);
   $second_sth->execute;

   my $d = $l_mw->DialogBox();

   $d->add("Label",
           -text=>"$l_hlst $main::lg{sql_for} $owner.$generic"
          )->pack(side=>'top');

   my $l_txt = $d->Scrolled('Text',
                         -height=>16,
                         -wrap=>'none',
                         -cursor=>undef,
                         -foreground=>$main::fc,
                         -background=>$main::bc
                        )->pack(-expand=>1,-fil=>'both');

   tie (*L_TEXT, 'Tk::Text', $l_txt);

   my $j = 0;
   my $full_list;

   while($j < 10000){
      $full_list = scalar $self->{Database_conn}->func('dbms_output_get');

orac_Oracle.pm  view on Meta::CPAN

   }
   print L_TEXT "\n\n  ";

   my @b;
   $b[0] = $l_txt->Button( -text=>$main::ssq,
                           -command=>sub{$self->see_sql($d,$cm)}
                         );

   $l_txt->window('create', 'end',-window=>$b[0]);

   if ( ($l_hlst eq 'Tables') || ($l_hlst eq 'Indexes') ){
      print L_TEXT "\n\n  ";

      my $i = 1;
      my @tablist;

      if ($l_hlst eq 'Tables') {

         @tablist = ('Tab_FreeSpace', 
                     'Tab_Indexes',
                     'Table_Constraints',
                     'Triggers',
                     'Comments');
      }
      elsif ($l_hlst eq 'Indexes') {

         @tablist = ('Index_FreeSpace');
      }

      foreach ( @tablist ) {

         my $this_txt = $_;

         $b[$i] = 
            $l_txt->Button(
               -text=>"$this_txt",
               -command=>sub { $self->do_a_generic($d, '.', $this_txt, $input);
                             },
                          );

         $l_txt->window('create', 'end',-window=>$b[$i]);
         print L_TEXT " ";
         $i++;
      }
      print L_TEXT "\n\n  ";

      if ($l_hlst eq 'Tables') {
         $b[$i] = 
            $l_txt->Button(-text=>$main::lg{form},
                           -command=>
                              sub{$d->Busy;
   
      print STDERR "\ndo_a_gen form: d    >$d<\n" if ($main::debug > 0);
      print STDERR "do_a_gen form: owner  >$owner<\n" if ($main::debug > 0);
      print STDERR "do_a_gen form: generic>$generic<\n\n" if ($main::debug > 0);
  
                                  $self->univ_form($d,
                                                   $owner,
                                                   $generic,
                                                   'form');
                                  $d->Unbusy }
                          );

         $l_txt->window('create', 'end',-window=>$b[$i]);
         $i++;
         print L_TEXT " ";

         $b[$i] = 
            $l_txt->Button(
               -text=>$main::lg{build_index},
               -command=> sub{$d->Busy;
   
      print STDERR "\ndo_a_gen inx: d       >$d<\n" if ($main::debug > 0);
      print STDERR "do_a_gen inx: owner   >$owner<\n" if ($main::debug > 0);
      print STDERR "do_a_gen inx: generic >$generic<\n\n" if ($main::debug > 0);
   
                              $self->univ_form($d,$owner,$generic,'index');
                              $d->Unbusy }
                          );
   
         $l_txt->window('create','end',-window=>$b[$i]);
      }
   } elsif ($l_hlst eq $main::lg{views}){
      print L_TEXT "\n\n  ";

      $b[1] = 
         $l_txt->Button(
            -text=>$main::lg{form},
            -command=>sub{  $d->Busy;

   print STDERR "do_a_gen vform: d       >$d<\n" if ($main::debug > 0);
   print STDERR "do_a_gen vform: owner   >$owner<\n" if ($main::debug > 0);
   print STDERR "do_a_gen vform: generic >$generic<\n" if ($main::debug > 0);

                            $self->univ_form(  $d,
                                               $owner,
                                               $generic,
                                               'form'
                                            );
                            $d->Unbusy }
                       );

      $l_txt->window('create', 'end',-window=>$b[1]);
   }
   print L_TEXT "\n\n";
   $d->Show;
   $l_mw->Unbusy;
}
1;



( run in 1.345 second using v1.01-cache-2.11-cpan-6aa56a78535 )