[ic] Accessing another catalog's products table

Mike Heins interchange-users@icdevgroup.org
Thu Aug 22 17:02:00 2002


Quoting Bill Carr (bill@worldwideimpact.com):
> On Thu, 2002-08-22 at 10:41, Mike Heins wrote:
> > Quoting Bill Carr (bill@worldwideimpact.com):
> > > On Thu, 2002-08-22 at 07:30, allmanj@houseofireland.com wrote:
> > > > I am using interchange with mysql and everything is looking rosy so far. i have
> > > > sites up and running using interchange but now i've run into a bit of a problem.
> > > > 
> > > > i want to have a catalog with its products table in its own database but to use
> > > > the products table from another catalog (and another database) as well. i'm
> > > > trying to think of a way to avoid the name conflict, any ideas?
> > > > 
> > > > to make it clearer lets say catalog1 and catalog2 both running on the same
> > > > machine with two databases, one for each catalog.
> > > > 
> > > > i want catalog1 to have, from its point of view, another table (aside from the
> > > > ones automatically given to it) that is in fact the products table from catalog2.
> > > > 
> > > > it would be nice if catalog1 could access the products table from catalog2 as
> > > > cat2products or something...
> > > > 
> > > > i know it is possible to use a table from another catalog, but i believe this
> > > > case is difficult because i want the name it is accessed by to be different to
> > > > the name in the actual database. is this even possible?
> > > catalog1.cfg:
> > > Database        db2.products      REAL_NAME       products
> > > NoImport        db2.products
> > > 
> > 
> > I *strongly* recommend against using a '.' in a table name. It will
> > break things on multiple levels, even in SQL.
> Help me see the light. I have been doing the following frequently and
> for a long period of time:
> 
> Database        mydb.items      mydb.items.txt 
> dbi:mysql:mydb:hurricane;mysql_read_default_file=/usr/local/interchange/.my.cnf
> Database        mydb.items      REAL_NAME       items
> Database        mydb.items      AUTO_SEQUENCE   1
> Database        mydb.items      RaiseError      0
> Database        mydb.items      PrintError      1
> NoImport        mydb.items
> 
> In Mysql I can say 'SELECT * FROM <database>.<table>' with out a
> problem. What am I missing? Why does my stuff work?
> 

It works in your specific situation with your specific database.
It simply will not work for many Interchange progamming situations
and with many other SQL systems.

Interchange has certain character and naming specifications, and
I have followed them when implenting the database interface. A period
is not allowed in a table name.

If you don't want to believe me that it is bad policy, that is your
right. But I want to make sure I correct things that can lead users
down a wrong path.

An underscore is a much better idea.

-- 

Perusion -- Expert Interchange Consulting    http://perusion.com
phone +1.513.523.7621 <mike@perusion.com>

Fast, reliable, cheap.  Pick two and we'll talk.  -- unknown