[ic] Error with Tag->data in actionmap after upgrade to Centos 7.4 mysql 5.7.21

Peter peter at pajamian.dhs.org
Mon Mar 12 03:24:15 UTC 2018


On 12/03/18 16:12, Andrew Baerg wrote:
> In case it helps anyone else, it doesn't seem to matter which
> tablename you put into the perl ITL, so if you stick the following in
> your catalog.cfg you can use $Tag->data for any table in all
> ActionMap subs and [calc] blocks.
> 
> AutoLoad [perl products][/perl]

I actually hadn't realized this, but it explains a lot.  Internally
Interchange will share the same dbh handle for any tables that have the
same DSN, the handle will be created when it is first needed.  This
means that it's likely that the dbh handle can't be created in the Safe
container, so by accessing a table outside of the safe container first
the dbh handle is created and is then usable inside any Safe containers
after that.

So your statement above is mostly, but not entirely true.  It would
likely not work to open the products table ahead of time and then try to
access a table on a completely different database (with a different DSN).

To be safe (no pun intended) I would pre-open the table(s) that you
actually want to access.

> On a side note, it seems strange to me that catalog UserTag subs can
> use the $Tag->data without any issue. The code must run in a slightly
> different Safe container I suppose.

This would be because those usertags are accessed on page code in a
place where the table (or at least a table on the same dbh) has already
been opened previously.  Actionmaps, on the other hand, are run before
any other page code and so no tables have been opened yet.

So it's not about running it on a different Safe container, it's about
*when* the db access occurs in relation to other db accesses for the
same dbh handle.


Peter



More information about the interchange-users mailing list