AFAIK there is no such function. The fastest way I know is to issue a SQLSETPROP on a ReadOnly property and capture the error message. The following code executes quite fast:
LOCAL lcOldError, laHandles[1], lnHandles, lnI
PRIVATE plValid
plValid = .f.
lcOldError = ON('error')
ON ERROR GetError()
lnHandles = 0
FOR lnI = 1 to 255
SQLSETPROP(lnI,"ConnectBusy",.t.)
IF plValid
lnHandles = lnHandles + 1
DIMENSION laHandles[lnHandles]
laHandles[lnHandles] = lnI
ENDIF
ENDFOR
ON ERROR &lcOldError
SUSPEND
RETURN
PROCEDURE GetError
LOCAL lnError, laError[1]
AERROR(laError)
lnError = laError(1)
plValid = .f.
IF lnError = 1533
plValid = .t.
ENDIF
>Hey all,
>
>For some reason I thought there was a function that would return an array of active SQL connection handles along with information about each connection. But I can't find anything in the docs in VFP 7.0 or 8.0...
>
>We have a function that checks for an existing connection, but it is slow in the event that no such connection exists (because it has to use SQLGETPROP() on all 255 possible handles to see if one exists). If there is a better way (such as the array I thought was available) it would be great to find something faster...
>
>Tell me what I'm missing, please! Thanks!
>
>JoeK
Mark McCasland
Midlothian, TX USA