[ic] Searching Multiple DBs

Paul Jordan paul at gishnetwork.com
Thu Jan 15 12:09:34 EST 2004


interchange-users-bounces at icdevgroup.org wrote:
> Hello,
> 
> Can not find a way to search multiple MySQL databases.  cgi value
> mv_searchtype can be set to "db" to turn on mysql searching, but
> there seems to be no corresponding cgi value to determine what
> database/table to search. mv_searchfile only considers the files in
> products/ which is not what I am looking for. 
> 
> Does anyone know an easy way to do this without writing it all in
> perl code? 
> 
> Andrew


Did you mean "multiple databases" at once, or seperately? At any rate, I take it you have set up one mysql db, so set the other one up the same. IOW define another SQLDSN SQLPASS SQLUSER (but use say SQLDSN_2 SQLPASS_2 SQLUSER_2) etc in variale (or any other place you want to define this). Then define the table using THOSE vars, like in dbconf/mysql/foo.mysql.

to search it, just call the table.  

[query
        ml=10
        more=1
        type=list
        sp="@@MV_PAGE@@"
--->    table=my_table_in_other_db      <----------------
        sql=|
            SELECT  sku, description
            FROM    products
            WHERE   somecol BETWEEN '[cgi from]' AND '[cgi to]'
            AND     someothercol = '[cgi whatever]'
            ORDER BY sku
        |]
        [list]

HTH

Paul




More information about the interchange-users mailing list