[ic] Query problem with shared database

Jon Jensen interchange-users@icdevgroup.org
Tue Jun 3 12:13:01 2003


On Tue, 3 Jun 2003, Jamie Neil wrote:

> While testing my (hopefully soon to go live) site, I've just noticed a
> serious problem relating to my use of the query tag with a shared database.
[snip]
> But when my promo component does:
> 
> 	[query arrayref=main
>       	sql="
>             	SELECT sku,timed_promotion,start_date,finish_date
>             	FROM merchandising
>             	WHERE featured = '[control promo_type featured]'
> 	"]
> 
> it returns data from the merchandising table of the main site!

You have to tell Interchange which table's DSN you want to use in the 
query tag, otherwise it will use the DSN for your first ProductFiles 
table. It doesn't parse your query, so it otherwise has no way to know 
what you want. Try:

[query
	arrayref=main
	table=merchandising
	sql="..."
]

Jon