[ic] Setting a catalog variable on a page

Joachim Leidinger interchange-users@lists.akopia.com
Fri May 11 07:49:00 2001


bill@worldwideimpact.com wrote:
> 
> I have built a table, queries, for storing my SQL queries with names for
> them. At interchange startup the queries table is read and a Variable is
> set to hold the value of the SQL statement like this:
>         Variable                sql_select_items        SELECT * FROM
> items
> Now we can say things like this:
>         [query
>                 list=1
>                 table=items
>                 sql=|__sql_select_items__|
>         ]
>                 [list]some stuff<br>[/list]
>         [/query]
> 
> We did this because many of the SQL queries were getting long and
> complicated and we wanted an easier way to handle them.
> 
> Now a developer would like to change the query using a IC page. We are
> able to make updates to the query table of course but how do we change the
> value of the Variable and have it be available catalog wide?
> 
> I just tried using &Vend::Control::add_catalog("Catalog catalog") and it
> will reconfig the catalog and therefore set my catalog variables with
> their new values. Is this my best bet?
> 
> Bill Carr
> Worldwide Impact
> bill@worldwideimpact.com
> 413.253.6700
[DEL]

Why not creating a file like

--------snip etc/sqlquery.txt--------
SELECT * FROM
--------snip etc/sqlquery.txt--------

and using the codes like

[seti sqlstring][file etc/sqlquery.txt][/seti]

in your index or another first page to set the scratch variable first
and you are able to overide it with

[seti sqlstring]SELECT ANYFIELD FROM ANYTABLE etc.[/seti]

?

ciao

Joachim

-- 
-------------<BPA FreeBsd>----------------------------------------------
Hans-Joachim Leidinger          black point arts Internet Solutions GmbH
email: jojo@blackpoint.de       FAX  : +49 0209-398265
http://www.bpaserver.net