Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with writeable cursors
Message
From
18/01/2000 02:52:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/01/2000 14:39:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00319138
Message ID:
00319324
Views:
10
>Dear All,
>
>I found the following syntax to make a cursor writeable:
>
>USE DBF("cMyCursor") IN 0 AGAIN ALIAS cAnotherCursor
>
>But if I use the following :
>
>select anyfield from MyTable into cursor cMyCursor
>
>then DBF() gives back the path of the original table, but I don't want to write into the original table.
>After some reasonong, I have tried using the following:
>
>select anyfield from MyTable into cursor cMyCursor nofilter
>
>then DBF() gives a really temporary filepath.
>
>According to the VFP documentation, neither of the previous syntax creates phisical files. But practically, the second syntax still produces one.
>
>Is it sure, that the second syntax always produces a temporary file, and thus, is safe to write into the cursor after making it writeable?
>
>P.S.: I know, that
>
>select anyfield, .t. from MyTable into cursor cMyCursor
>
>does the job, but I would like to understand the theoretical background.
>
>TIA
>
>bb


Hi Bela,
My .2 cents :)
You could directly select into table and use it.
Because whatever method you choose and how small is size doesn't matter (even with just one record with only one logical field). Cursors are "always" written to disk. It's not true that VFP could only keep it in RAM when it see fits (at least not up to VFP6, SP3). Even fully optimized,filtered RO ones are written to disk. Only thing with cursors are that they're cleaned up for you if you don't play with them. If you do play and say create an index then automatic clearing is not performed and thus no difference from a table (except cryptic filename that you should keep track of). I think you'd play with them :) So select into tables.
You might not see the files on explorer nor file() returns .t. for them but they're there. To demonstate their existence, just try to fcreate() any one dbf("cursor") that you got. You'll see that you cannot get a handle and the cause is "access denied"! If it's totally a different thing denying the access then I stand corrected :)

BTW nofilter (in VFP) or including a nonexistent field or adding a dummy .t. to where clause all create "true cursors" as you said. They're safe to write (as long as what you want is automatic cleanup:)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform