The new option FETCHR_DYNFLDNUMX is used with the SQLOP_FETCH_ROW operation. It is similar to the existing FETCHR_DYNFLDNUM but is somewhat smarter about handling multi-level DYNSTRUCTs. To clarify the difference, consider the following:
defstruct ST_SUB
map2 a,s,10
map2 b,b,2
endstruct
defstruct ST_REC
map2 f1,s,20
map2 dummy
map3 f2,b,4
map3 f3,s,4
map2 sub,ST_SUB
map2 f4,f,6
endstruct
map1 rec, ST_REC
Assuming eight or more fields in the result set (result1 - result8), the two variations FETCHR_DYNFLDNUM and FETCHR_DYNFLDNUMX would assign the results to the DYNSTRUCT rec as follows:
Structure |
FETCHR_ |
FETCHR_ |
|---|---|---|
rec.f1 |
result1 |
result1 |
rec.dummy |
result2 |
<dummy header skipped> |
rec.f2 |
result3 |
result2 |
rec.f3 |
result4 |
result3 |
rec.sub |
result5 |
resurt4 |
rec.sub.a |
result6 |
<sub-field skipped> |
rec.sub.b |
result7 |
<sub-field skipped> |
rec.f4 |
result8 |
result5 |
In other words, the original FETCHR_DYNFLDNUM ignored the levels of the fields in the target structure, which probably doesn't make any sense, given that some of the fields overlay others. FETCHR_DYNFLDNUMX attempts to be smarter by ignoring header fields (e.g. rec.dummy) that have no explicit defined type, and conversely to ignore sub-fields within structures that do have an explicit type (e.g. rec.sub). The theory here is that the database would not have a dummy header field and would treat the struct ST_SUB as a single raw field.
If neither of these schemes works conveniently in your situation, the other option is match up the results to the DYNSTRUCT fields by name using FETCHR_DYNFLDNAME (or one of the non-DYNSTRUCT variations).
The DYNSTRUCT-related FETCHR_xxx symbols are defined in SQL.DEF as follows:
Symbol |
Value |
Meaning |
|---|---|---|
FETCHR_DYNFLDNUM |
&h0080 |
fetch row into dynstruct by number |
FETCHR_DYNFLDNUMX |
&h0400 |
smarter variation of _DYNFLDNUM |
FETCHR_DYNFLDNAME |
&h0800 |
fetch row into dynstruct by name |
Note that this change does not affect or require updating the ASQL connectors (libashodbc and libashmysql).