[ic] Accessing another catalog's products table

Kevin Walsh interchange-users@icdevgroup.org
Thu Aug 22 14:29:11 2002


> > > 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?
> 
That will probably work (for now), as 'mydb' is most likely the
name of your database.

If you used the following:

    Database    some.table    some.table.txt

Then it would fail, unless 'some' was your database name.  In that
case, the 'some.table' should be changed to 'some_table'.

Using a '.' in a table name will cause problems if you decided to
rename your database, or create a copy with a new name.  If you
don't plan to do that then that's fine.  If you ever do then it'll
bite you unexpectedly, and when you least need to be bitten.

If, in the future, a facility is added to the Interchange core that
requires the database name to be prepended to the table name in
internal lookups, your Database directives would be invalid and cause
unexpected failures on your site.  It is *strongly* recommended that
you don't use '.'; use '_' instead.

The DSN points to the database name - you don't need to 'confirm' it
in the Database directive's table name specification.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/