Orac-alpha

 view release on metacpan or  search on metacpan

db/orac_Sybase.pm  view on Meta::CPAN

my $ind_uniq;
my $t_n;
my $tot_i_cnt;
my $ind_bd_cnt;

my @o_ih;
my @sql_entry;
my @i_uc;
my @i_ac;
my @lrg_t;
my @ih;
my @dsc_n;
my @tot_ind_ar;

my $ary_ref;
my $w;
my $m_t;

my $own;
my $obj;

my $col_count;
my $sql_txt;

my $defSegFreeSpace;
my $reqdIndSpace;

sub new
{
   my $proto = shift;
   my $class = ref($proto) || $proto;

   my ($l_window, $l_text) = @_;

   my $self  = orac_Base->new("Sybase", $l_window, $l_text);

   bless($self, $class);
   return $self;
}

sub init1{
   my $self = shift;
}

sub init2 {
   my $self = shift;
   $self->{Database_conn} = $_[0];
   $self->Dump;
   @dbs = ();
   my $cm = $self->f_str('get_db','1');
   my $sth = $self->{Database_conn}->prepare($cm) || 
                 die $self->{Database_conn}->errstr;
   $sth->execute;

   while ($cur_db = $sth->fetchrow) {
       push @dbs, $cur_db;
   }  
   $sth->finish;
}

sub add_cascade_button {
    my $self = shift;

    local ($_);
    my($cmd_menu);

    for (@_) {
	/^tbl_rev$/ && do { $cmd_menu = '$main::current_db->syb_reverse_tbl("'; next;};
	/^diag_ind$/ && do { $cmd_menu = '$main::current_db->syb_bad_index("'; next;};
	/^frag_ind$/ && do { $cmd_menu = '$main::current_db->syb_tune("';next;};
	/.*?/ && do { return;} ;
    }

    my ($cmd);
    for (@dbs) {
      $cmd .= '$main::casc_item->radiobutton(-label=>"'.$_.'",-command=>sub{$main::current_db->f_clr($main::v_clr);'.$cmd_menu.$_.'");});'."\n";
    }
    return $cmd;
}

sub syb_bad_index {
    my $self = shift;

    my($db) = @_;

    $self->{Database_conn}->do("use $db");
    $self->show_sql('bad_index','1',$main::lg{diag_ind});
}

sub syb_reverse_db {
   my $self = shift;

   # Generates a script with which you can
   # completely regenerate the skeleton of your
   # database
   my $row;
   my $cm = 'exec sp__revdb';
   my $sth = $self->{Database_conn}->prepare( $cm ) || 
              die $self->{Database_conn}->errstr;
   $sth->execute;
   my $j = 0;
   while($row = $sth->fetchrow){
       $row = ($row =~ /^Create/ &&  $j++ > 0) ? "\n".$row."\n" : $row."\n";
       $self->{Text_var}->insert('end', $row);
   }  
   $sth->finish;
   $self->see_plsql($self->f_str('rev_db','1'));
}
sub syb_reverse_login {
    my $self = shift;
   # Generates a script with which you can
   # completely regenerate the skeleton of your
   # database

   my $cm = 'exec sp__revlogin';
   my $sth = $self->{Database_conn}->prepare( $cm ) ||
               die $self->{Database_conn}->errstr;
   $sth->execute;
   my $j = 0;
   my $row;
   while($row = $sth->fetchrow){



( run in 0.712 second using v1.01-cache-2.11-cpan-f56aa216473 )