Skip to content

Implementation of GETFLDSTATE and SETFLDSTATE#1952

Open
Irwin1985 wants to merge 2 commits into
devfrom
feature/getfldstate-setfldstate
Open

Implementation of GETFLDSTATE and SETFLDSTATE#1952
Irwin1985 wants to merge 2 commits into
devfrom
feature/getfldstate-setfldstate

Conversation

@Irwin1985
Copy link
Copy Markdown
Contributor

Implements GETFLDSTATE() and SETFLDSTATE(). State is tracked per workarea using an internal dictionary. Both functions also use _AreaFromParam().

They were marked as Partial since automatic state updates on REPLACE/APPEND require cursor buffering (CURSORSETPROP), which is not yet supported.

Closes Peter Stephan feedback item: GETFLDSTATE / SETFLDSTATE.

@RobertvanderHulst
Copy link
Copy Markdown
Member

Irwin,
The workareas (datasession) class has a mechanism to add data to a workarea/cursor.
There is a cargo dictionary for this. The key is the area number and the value is an object..
This was added for the XPP dialect that has functions for that.
The workareas class has a method SetCargo(dwNum, oObject) an GetCargo(dwNum) to set and get the object
When a workarea is closed, then the cargo slot for that area is cleared.
You could also use the same slot for the field information that you are storing.
Finally the IRdd interface has a FieldIndex method that you can use to lookup the field number for a fieldname. That is MUCH faster than looping through all the fields what you are doing now in _FieldNumFromName(). The implementation in the Workarea class uses a case insensitive dictionary for this. And for tables in a DBC both the short and long name are stored in this dictionary.

@RobertvanderHulst
Copy link
Copy Markdown
Member

One more thing: if you want we can also add a bitarray field to the RDD where we store which field numbers were updated. That would be fairly easy to do.

@Irwin1985
Copy link
Copy Markdown
Contributor Author

Robert,

Thanks for the tips, I've applied both suggestions. Regarding the BitArray in the RDD, that sound like a good plan for the next step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants