[ic] Accessing another catalog's products table

Bill Carr interchange-users@icdevgroup.org
Thu Aug 22 14:56:01 2002


On Thu, 2002-08-22 at 14:28, Kevin Walsh wrote:
> > > > 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.
Yes it is.
> 
> 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.
That's not so bad because I use variables for the database names every
where.
> 
> 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.
Thank you. Yes 'mydb' is the name of my database. I have catalogs that
refer to two databases each with a table called items.

Thanks. I see the light. I just wanted the thingy IC uses to call a
table to look like the thingy MySQL calls a table.

I will changing my '.'s to '_'s.


-- 
Bill Carr
Worldwide Impact
bill@worldwideimpact.com
413-253-6700