Re: Search/Replace in entire database?

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

 



Hi Chris,

MySQL introduced full - text indexing and searching capabilities back in
version 3.23.23. The implementation is straightforward and easy to use —
define a FULLTEXT index and use MATCH / AGAINST in the query. Consider this
example:

CREATE TABLE SOCIAL_EVENT (
    EVENT_ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    USER_ID INTEGER UNSIGNED NOT NULL,
    HEADLINE TEXT NOT NULL,
    EVENT_TEXT TEXT NOT NULL,
    EVENT_DATE TIMESTAMP NOT NULL,

    PRIMARY KEY (EVENT_ID),

    FOREIGN KEY (USER_ID)

    REFERENCES SOCIAL_USER(USER_ID),

    FULLTEXT INDEX (HEADLINE, EVENT_TEXT)

)

ENGINE=MyISAM DEFAULT CHARACTER SET latin1
COLLATE latin1_general_cs AUTO_INCREMENT=0;

Thanks.
Caner

2009/6/15 Chris Payne <chris_payne@xxxxxxxxxxxxxxx>

> Hi everyone,
>
> I am in the middle of creating an editor where you can search and
> replace on an individual column in a single table then I came across
> something I need to be able to do but not sure how.
>
> Is it posible (And if so please how :-) to search an entire database
> and all tables within a database and do a find/replace on keywords
> without having to specify each table/column within that table?
>
> The people I am working for have made some big changes and one of them
> is changing the names of one of their products, but this product name
> appears EVERYWHERE in many tables and in lots of different column
> names, and it would save so much time if I could do a single query
> that would just search EVERYTHING within the database.
>
> Thanks for any advice you can give me.
>
> Regards
>
> Chris Payne
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux