X-Sharp/XSharpPublic

[VFP] Problem with CURSOR

Opened this issue · 5 comments

Not sure if this is supposed to work at the moment, but I'm adding it anyway:

XSharp.Error
Argument error

Callstack : 
[Method XSharp.RT.Functions.__FieldSet(fieldName:System.String, uValue:XSharp.__Usual):XSharp.__Usual]
FUNCTION Start() AS VOID
	LOCAL cDbf AS STRING
	cDbf := "test"
	FErase(cdbf + ".cdx")
	DbCreate(cDbf , {{"FLD1", "C", 10, 0},{"FLD2", "N", 10, 2}})
	
	SELECT 0
	USE (cDbf) ALIAS myalias
	
	APPEND BLANK
	FieldPut(1,"abc")     
	FieldPut(2,123)
	
	REPLACE FLD1 WITH "test" // OK
	? FieldGet(1)
	
	
	SELECT + FROM myalias INTO CURSOR CursorName READWRITE
	CREATE CURSOR
	RLock()
	REPLACE FLD1 WITH "cursor" // XSharp.Error: Argument error
	? FieldGet(1)
	UNLOCK
	USE

Chris,
I assume you meant to write SELECT * FROM myalias ?
This is a so-called SQL SELECT and this is not supported yet.

CREATE CURSOR is supported, but it needs column names as in

CREATE CURSOR employee ;
 (EmpID N(5), Name Character(20), Address C(30), City C(30), ;
  PostalCode C(10), OfficeNo C(8) NULL, Specialty Memo)

I am not sure what CREATE CURSOR without a column list is supposed to do. I cannot find documentation for that in the VFP help.
In the VFP docs the open parenthesis and close parenthesisare NOT optional 👍🏼

CREATE CURSOR alias_name 
...[CODEPAGE=nCodePage]
   (fname1 cFieldType [(nFieldWidth [, nPrecision])] [NULL | NOT NULL] 
   [CHECK lExpression [ERROR cMessageText]] 
   [AUTOINC [NEXTVALUE NextValue [STEP StepValue]]]
   [DEFAULT eExpression] [UNIQUE [COLLATE cCollateSequence]]
   [NOCPTRANS] [, fname2 ...]) 
   | FROM ARRAY ArrayName

So it is either CREATE CURSOR alias_name ... FROM ARRAY
or CREATE CURSOR alias_name ( fieldslist )

This is exactly as I found it in Peter's test suite. The + could be a typo, but I am not sure. I will ask him to comment on all the above.

Dear Robert, dear Chris,

the problem is the "SELECT *" statement.
Even we take the new Foxprocmd.xh file we get an error like the pictures I attach.

Create Coursor ist allways with fields in our programs, please be aware that we are using memo Fields.

Peter

Select_SQL_FEHLER
SQL_CODE

Peter, your code is using "SELECT +" (plus sign), not "SELECT *", so I assume this was just a typo?