SELECT Command
Posted: Sat Oct 19, 2019 3:31 pm
Hi Robert,
I´m struggling with the SELECT command.
Something like:
SELECT a becomes dbSelectArea ( "a" )
SELECT 9 becomes dbSelectArea ( "9" )
SELECT 10 becomes dbSelectArea ( "10" ) <-- throws an Exception
VO behaves the same, but Foxpro doesn´t show this problem and selects to workareas > 9. in the DB.prg i see what DbSelectArea() does:
My idea is to enhance the _SelectString(). See the KHR comment below
Now, if _SelectString() processes e.g. "10", the workarea becomes selected. Calling the func with something like "10A" would still fail.
What do you think ?
regards
Karl-Heinz
I´m struggling with the SELECT command.
Code: Select all
#command SELECT <whatever> => dbSelectArea( <(whatever)> )
SELECT a becomes dbSelectArea ( "a" )
SELECT 9 becomes dbSelectArea ( "9" )
SELECT 10 becomes dbSelectArea ( "10" ) <-- throws an Exception
VO behaves the same, but Foxpro doesn´t show this problem and selects to workareas > 9. in the DB.prg i see what DbSelectArea() does:
Code: Select all
FUNCTION DbSelectArea(uArea) AS LOGIC CLIPPER ->
FUNCTION _Select(uWorkArea) AS USUAL CLIPPER ->
FUNCTION _SelectString(uWorkArea AS STRING) AS DWORD
Code: Select all
FUNCTION _SelectString(uWorkArea AS STRING) AS DWORD
LOCAL nSelect := 0 AS DWORD
uWorkArea := AllTrim(uWorkArea)
IF SLen(uWorkArea) = 1
nSelect := Val(uWorkArea)
VAR nAsc := Asc( Upper(uWorkArea) )
IF nAsc > 64 .AND. nAsc < 75
nSelect := nAsc - 64
ENDIF
ELSE
// ------ added KHR
IF NTrim ( Val( uWorkArea ) ) == uWOrkArea
nSelect := Val ( uWOrkArea)
ENDIF
// -------------------
ENDIF
IF nSelect > 0 .OR. "0" == uWorkArea
nSelect := VoDb.SetSelect((INT) nSelect)
ELSE
nSelect := (DWORD) VoDb.SymSelect(uWorkArea)
ENDIF
RETURN nSelect
What do you think ?
regards
Karl-Heinz