List:General Discussion« Previous MessageNext Message »
From:Pat 006 Adams Date:March 23 2005 4:44pm
Subject:RE: search through one/several tables
View as plain text  
The best I've been able to come up with involves some shell scripting.
If you're running Linux, using unpacked MyISAM tables, and have some
scripting ability from whatever language you're writing your application
in, you can run this in your MySQL directory:

	strings -f *.MYD | grep <search string> | cut -f1 -d'.' | sort
-u

It will give you back the table names that have that string somewhere
inside them. Then in your scripting language you can check the columns
on just the tables that the shell script returned. Note that it is NOT
fast at all. My 1.7GB of database takes about 10 minutes to crunch
through the data.

If you're going to do something like this make sure you understand the
security ramifications of running shell scripts with user input and how
to secure it in your language of choice.

--
Pat Adams
Applications Programmer
SYSCO Food Services of Dallas, L.P.
(469) 384-6009 

> -----Original Message-----
> From: mel list_php [mailto:list_php@stripped] 
> Sent: Wednesday, March 23, 2005 10:09 AM
> To: SGreen@stripped
> Cc: mysql@stripped
> Subject: Re: search through one/several tables
> 
> I can find the data, I was just wondering if mysql provides a 
> kind of generic scan of a whole table.
> 
> I could provide an advanced search, and ask the user what 
> kind of info he wants to retrieve but I first would like a 
> quickSearch that may retrieve too much info but is more intuitive.
> 
> As I said, my first idea was to create a script to go through 
> all my tables and scan the relevant columns (I don't want to 
> scan the id keys for example), but I was just wondering if 
> given a table it is possible to use mysql to scan all its columns:

Thread
search through one/several tablesmel list_php23 Mar
  • Re: search through one/several tablesAlec.Cawley23 Mar
    • Re: search through one/several tablesmel list_php23 Mar
      • Re: search through one/several tablesAlec.Cawley23 Mar
      • Re: search through one/several tablesSGreen23 Mar
        • Re: search through one/several tablesmel list_php23 Mar
          • Re: search through one/several tablesSGreen23 Mar
            • Re: search through one/several tablesPeter Brawley23 Mar
              • Re: search through one/several tablesmel list_php23 Mar
                • Re: search through one/several tablesSGreen23 Mar
                • Re: search through one/several tablesPeter Brawley23 Mar
RE: search through one/several tablesPat 006 Adams23 Mar