Skip to content

Implements (partial) functions CURSORSETPROP() AND CURSORGETPROP()#1954

Merged
RobertvanderHulst merged 2 commits into
devfrom
feature/cursorsetprop-cursorgetprop
May 26, 2026
Merged

Implements (partial) functions CURSORSETPROP() AND CURSORGETPROP()#1954
RobertvanderHulst merged 2 commits into
devfrom
feature/cursorsetprop-cursorgetprop

Conversation

@Irwin1985
Copy link
Copy Markdown
Contributor

The current behavior on the RDD side is not wired yet. That will come later with TABLEUPDATE/TABLEREVERT.

Cursor properties are stored per-workarea using the existing _WorkareaCargo container (same slot as GETFLDSTATE/SETFLDSTATE).

  • CURSORSETPROP("Buffering", 1-5, [area])
  • CURSORSETPROP("AutoIncError", lValue, [area])
  • CURSORSETPROP("Refresh", nValue, [area])
  • Unknown properties atores for forward compatibility
  • nWorkArea = 0 sets session-level defaults
  • CURSORGETPROP("SourceType") returns 3 (table)
  • CURSORGETPROP("SourceName") returns DBF full path
  • CURSORGETPROP("Database"), "SQL", "ConnectHandle", etc. returns sensible defaults

I used the CursorProperty enum from XSharp.Core.RDD for property lookup instead of String.Compare.

@RobertvanderHulst
Copy link
Copy Markdown
Member

RobertvanderHulst commented May 26, 2026

Irwin, Please look at src\Runtime\XSharp.Core\RDD\CursorProperties.prg
This file already has an enum for the cursorproperties and a function to translate the string to the number.
And instead of hardcoding the dictionary, I am using the Enum.GetValues() and Enum.GetName() methods
I would also use the Enum for the default values and not the string
Finally, instead of the long list of IF ... statements I would cast the long to the enum and then use a SWITCH statement. That is easier to read and slightly faster.
On the other locations I would also cast nProp to the CursorProperty enum once, so you do not need to use an (LONG) cast in all comparisons.

@Irwin1985
Copy link
Copy Markdown
Contributor Author

Hi Robert,

Done. Switched to the CursorProperty enum.

Thanks.

@RobertvanderHulst
Copy link
Copy Markdown
Member

Great
I am just building the next RC1 installer. This will not be included yet.

@RobertvanderHulst RobertvanderHulst merged commit a8a6e85 into dev May 26, 2026
1 check passed
@RobertvanderHulst RobertvanderHulst deleted the feature/cursorsetprop-cursorgetprop branch May 26, 2026 18:35
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