Re: Remote view / cursor oddity by Jack
Jack
Tue Jan 24 23:44:04 CST 2006
Sorry, I don't see what buffering has to do with my problem. These
are remote views to an MS-SQL database. Nothing is being written back
to the database because I am not moving any record pointers and not
doing any TABLEUPDATE().
If nothing is open in the data session, and 'track' is a remote view
INSERT INTO track .....
will open the 'track' remote view and insert a record into it.
If instead the following is executed:
USE track IN 0 ALIAS track_curs
INSERT INTO track .....
now only 'track_curs' is open and the new record has been inserted
into it.
My question is why the INSERT inserts into the 'track_curs' cursor
instead of opening a 'track' cursor and inserting into that.
If instead I do this:
USE track in 0
USE track IN 0 ALIAS track_curs
INSERT INTO track .....
the new record is inserted into 'track' as expected.
On Tue, 24 Jan 2006 18:51:09 -0700, "Fred Taylor"
<ftaylor@mvps.org!REMOVE> wrote:
>If you're using a remote view, there is an implied buffering mode in effect.
>If you move the record pointer in the view, any changes in that record in
>the view will be applied to the "source" table. Tha's the way row buffering
>works. If you don't want any changes to be applied to the source table
>until you're ready to do a TABLEUPDATE(), you'll have to swith to table
>buffering.
Fred
Microsoft Visual FoxPro MVP
"Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
news:sc7dt19t93mfa8hjhai9369julgfvbtdf1@4ax.com...
>I just ran into something that I don't understand. VFP 8 SP1,
> although I doubt that matters.
>
> With nothing open in the data environment, open a remote view:
>
> USE track IN 0 ALIAS track_curs
> * At this point 'track_curs' is the only thing open.
>
> * The following statement apparently reads data from track_curs,
> * since when it completes there is no alias 'track' open.
> SELECT * FROM track WHERE ... INTO CURSOR xxx
> * At this point 'track_curs' and 'xxx' are open.
>
> * Likewise, the following statement inserts into track_curs:
> INSERT INTO track .....
>
> If the initial USE is removed, the SELECT will silently open the
> remote view 'track' and leave it open, and the INSERT will insert into
> that remote view, which is the expected behavior.
>
> Is inserting into the alias when the remote view name is used the
> expected behavior? It seems wrong to me.