[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: searching ALL tables



Here it is in perl/DBI using hashes of arrays:

  my $database =
DBI->connect("DBI:mysql:database=$DATABASENAME;host=$HOSTNAME
ST",$MYSQLUSER,$MYSQLPASS,{RaiseError=>0,PrintError=>0});



  my $tablea = $database->prepare("SHOW TABLES FROM DATABASENAME");
  $tablea->execute();
  my @active_tables;
  while(my @temp = $tablea->fetchrow_array){
    foreach my $tmptable (@temp){
      push @alltables, $tmptable;
    }
  }
  $tablea->finish();

  foreach my $table (@alltables){
    my $comand = "SELECT BLAH FROM $table";
    my $sth = $database->prepare("$comand");
    $sth->execute();
    while(my $ref = $sth->fetchrow_hashref()) {
      push @LoH, $ref;        # add hits to list
    }
  }

  for $i (0..$#LoH) {
#    See camel book for printing of lists. There's lots you can do here.
    for $key %{$LoH[$i]}){
      print $key=$LoH[$i]{$key}\n ";
    }

  }

On Fri, 9 Mar 2001, Adam Crawford wrote:

> Hi all,
> I just want to know how to search all tables
> I can work out how to search one table, or a few of them at a time
> but since we have 1000+ tables, I figure there must be an easyer way
> I have tried using % & * instead of the table name, but with no luck
> 
> Hope someone can help
> Thank you in advance.
> 
> Regards,
> Adam Crawford
> 
> ps, please be sure to cc me a copy of any replys, as i am not subscribed to
> the list.
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread67756@xxxxxxxxxxxxxxx>
> To unsubscribe, e-mail <mysql-unsubscribe-joe.christian=rcn.com@xxxxxxxxxxxxxxx>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread67974@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.