Hi, folks!
I have a problem creating an temporary index on a view based cursor if the related DBC is read only (see the sample code below).
Does anybody know something about this behaviour?
BTW: The same code in VFP6 works without any problems!
****************************************************************
CLEAR ALL
CLOSE ALL
RELEASE ALL
SET Exact ON
lcDir = SYS(2023) + "\VFP7_BUG" + SYS( 2015 )
* create test environment
LOCAL lcCurrentDir
lcCurrentDir = SYS( 5 ) + CURDIR()
MD ( m.lcDir )
CD ( m.lcDir )
*create test data
SET Exclusive ON
CREATE DATABASE MyData
CREATE TABLE MyTable ( Name C(10) )
CREATE SQL VIEW MyView AS SELECT * FROM MyTable
* set read only flag of the DBC
CLOSE DATABASES ALL
RUN ATTRIB &lcDir.\MyData*.* +r
* open the data
SET Exclusive OFF
OPEN DATABASE MyData
USE MyView
* the following line fails due to Error "Cannot update the cursor (Error 111)"
* btw: the reason is so read only DBC
INDEX ON Name TAG xName
INDEX ON Name TO xName
* remove the read only flag...
CLOSE DATABASES ALL
RUN ATTRIB &lcDir.\MyData*.* -r
* reopen the data again
OPEN DATABASE MyData
USE MyView
* ... and all works fine
INDEX ON Name TAG xName
INDEX ON Name TO xName
* show the indexes
CLEAR
DISPLAY STATUS
* tidy up (a little bit only <vbg>)
CD ( m.lcCurrentDir )
****************************************************************
SeBaFlu