get_array_info() can modifiy DBADDR::pfield

Allow the record support function get_array_info()
to modify its first argument to provide a different
pointer from which values should be read.

Remember the original and restore it afterwards.
This commit is contained in:
Michael Davidsaver
2013-01-23 10:38:30 -05:00
parent af2693241f
commit 4f6040d35b
2 changed files with 16 additions and 2 deletions
+4 -1
View File
@@ -104,7 +104,9 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) {
if (chan->addr.special == SPC_DBADDR &&
nSource > 1 &&
(prset = dbGetRset(&chan->addr)) &&
prset->get_array_info) {
prset->get_array_info)
{
void *pfieldsave = chan->addr.pfield;
prec = dbChannelRecord(chan);
dbScanLock(prec);
prset->get_array_info(&chan->addr, &nSource, &offset);
@@ -126,6 +128,7 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) {
pfl->u.r.field = pdst;
}
dbScanUnlock(prec);
chan->addr.pfield = pfieldsave;
}
/* Extract from buffer */