Comment 9 for bug 1824277

Revision history for this message
Andrew Johnson (anj) wrote :

We could change the code for constant links so they return a value from their lset::getValue() method (currently that routine exists but just returns 0). The string-to-number conversion result could be cached so this doesn't have to be done every time, but this could break any existing databases that provide an initial value using a constant link and later do puts to update the related value field.

I guess we could avoid that by coding getValue() so it would only return a value the first time it's called after the link has been set, and then only if the loadScalar(), routine that gets called from recGblInitConstantLink() API hasn't already been called.

However a lot of older code that reads links doesn't actually call dbGetLink() when the link type is constant (e.g. devAiSoft.c). I removed a lot of those checks from Base already since they aren't needed, but many probably still remain, and that pattern or its equivalent is probably universal in the synApps record types. I just found it in aCalcout, sCalcout, sseq and transform in the calc module, although not in swait. The code in those records is going to need updating to not break if someone gives them a JSON_LINK, but they should continue to work with just the older link types.