Is there any difference between these two?
I'm looking at some older code and I have remarks about the SELECT
SQL using INTO TABLE to avoid some VFP errors that says something
like, "Command cannot be issued on a cursor" or something to that effect.
Would changing my code to CURSOR READWRITE work equally well as the
INTO TABLE ?
Thanks for any insight-
Steve
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/20100730004938.393D824CB88@marge.leafe.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Steve Ellenoff wrote:
> Is there any difference between these two?
>
> I'm looking at some older code and I have remarks about the SELECT
> SQL using INTO TABLE to avoid some VFP errors that says something
> like, "Command cannot be issued on a cursor" or something to that effect.
>
> Would changing my code to CURSOR READWRITE work equally well as the
> INTO TABLE ?
If you used tables to avoid "operation can not be performed on a
cursor," I would think you could do CURSOR READWRITE, followed by USE
DBF("MyCursor") ALIAS Bob, and do whatever on Bob. Just off the top of
my head.
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/4C52314F.1070900@taconic.net
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
READWRITE alone is enough.
USE (DBF(<cursorname>))
...was a workaround that preceded READWRITE & NOFILTER.
-----Original Message-----
From: Vincent Teachout <teachv@taconic.net>
Sender: profoxtech-bounces@leafe.com
Date: Thu, 29 Jul 2010 21:56:31
To: <profoxtech@leafe.com>
Reply-To: profox@leafe.com
Subject: Re: INTO TABLE vs INTO CURSOR READWRITE
Steve Ellenoff wrote:
> Is there any difference between these two?
>
> I'm looking at some older code and I have remarks about the SELECT
> SQL using INTO TABLE to avoid some VFP errors that says something
> like, "Command cannot be issued on a cursor" or something to that effect.
>
> Would changing my code to CURSOR READWRITE work equally well as the
> INTO TABLE ?
If you used tables to avoid "operation can not be performed on a
cursor," I would think you could do CURSOR READWRITE, followed by USE
DBF("MyCursor") ALIAS Bob, and do whatever on Bob. Just off the top of
my head.
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/4C52314F.1070900@taconic.net
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Report [OT] Abuse: http://leafe.com/reportAbuse/4C52314F.1070900@taconic.net
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Thanks Vince & Lew!
I just found this line in the VFP helpfile:
"NOFILTER creates a cursor that can be used in subsequent queries."
So it would seem READWRITE NOFILTER is the proper equivalent to INTO TABLE..
-Steve
At 09:56 PM 07/29/2010, you wrote:
>Steve Ellenoff wrote:
> > Is there any difference between these two?
> >
> > I'm looking at some older code and I have remarks about the SELECT
> > SQL using INTO TABLE to avoid some VFP errors that says something
> > like, "Command cannot be issued on a cursor" or something to that effect.
> >
> > Would changing my code to CURSOR READWRITE work equally well as the
> > INTO TABLE ?
>
>If you used tables to avoid "operation can not be performed on a
>cursor," I would think you could do CURSOR READWRITE, followed by USE
>DBF("MyCursor") ALIAS Bob, and do whatever on Bob. Just off the top of
>my head.
>
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/20100730041539.EC6FE24CB9E@marge.leafe.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
HMM... More testing reveals the following oddities:
You can ZAP a cursor created with READWRITE NOFILTER, but you CANNOT
issue a PACK.
That would be a significant difference from INTO TABLE if you need to
delete a bunch of records and then wish to pack the table.
@ Vince - I tried doing the USE (DBF("cursorname")) trick, but it
wouldn't work, since if I closed the cursor, the file was erased, and
if I left it open, it said it was already being used?
At 12:15 AM 07/30/2010, you wrote:
>Thanks Vince & Lew!
>
>I just found this line in the VFP helpfile:
>"NOFILTER creates a cursor that can be used in subsequent queries."
>
>So it would seem READWRITE NOFILTER is the proper equivalent to INTO TABLE..
>
>-Steve
>
>
>At 09:56 PM 07/29/2010, you wrote:
> >Steve Ellenoff wrote:
> > > Is there any difference between these two?
> > >
> > > I'm looking at some older code and I have remarks about the SELECT
> > > SQL using INTO TABLE to avoid some VFP errors that says something
> > > like, "Command cannot be issued on a cursor" or something to that effect.
> > >
> > > Would changing my code to CURSOR READWRITE work equally well as the
> > > INTO TABLE ?
> >
> >If you used tables to avoid "operation can not be performed on a
> >cursor," I would think you could do CURSOR READWRITE, followed by USE
> >DBF("MyCursor") ALIAS Bob, and do whatever on Bob. Just off the top of
> >my head.
> >
> >
> >
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/20100730061446.52FB324CB78@marge.leafe.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Steve,
The Readwrite does in fact override the Nofilter option so nofilter isn't
actually needed. The act of making a cursor readwrite means that a physical
copy is made on disk/memory so the caching problem that nofilter was meant
to overcome isn't in fact present as a true copy of the selected data is
made.
Dave C
-----Original Message-----
From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf
Of Steve Ellenoff
Sent: 30 July 2010 07:15
To: profox@leafe.com
Subject: Re: INTO TABLE vs INTO CURSOR READWRITE
HMM... More testing reveals the following oddities:
You can ZAP a cursor created with READWRITE NOFILTER, but you CANNOT
issue a PACK.
That would be a significant difference from INTO TABLE if you need to
delete a bunch of records and then wish to pack the table.
@ Vince - I tried doing the USE (DBF("cursorname")) trick, but it
wouldn't work, since if I closed the cursor, the file was erased, and
if I left it open, it said it was already being used?
At 12:15 AM 07/30/2010, you wrote:
>Thanks Vince & Lew!
>
>I just found this line in the VFP helpfile:
>"NOFILTER creates a cursor that can be used in subsequent queries."
>
>So it would seem READWRITE NOFILTER is the proper equivalent to INTO
TABLE..
>
>-Steve
>
>
>At 09:56 PM 07/29/2010, you wrote:
> >Steve Ellenoff wrote:
> > > Is there any difference between these two?
> > >
> > > I'm looking at some older code and I have remarks about the SELECT
> > > SQL using INTO TABLE to avoid some VFP errors that says something
> > > like, "Command cannot be issued on a cursor" or something to that
effect.
> > >
> > > Would changing my code to CURSOR READWRITE work equally well as the
> > > INTO TABLE ?
> >
> >If you used tables to avoid "operation can not be performed on a
> >cursor," I would think you could do CURSOR READWRITE, followed by USE
> >DBF("MyCursor") ALIAS Bob, and do whatever on Bob. Just off the top of
> >my head.
> >
> >
> >
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/000501cb2fb0$35c69f30$a153dd90$@co.uk
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
A cursor is created in memory. The only time it will have a physical
presence (if one can call magnetic states on a hard drive a physical
presence) is when it is created in virtual memory on the hard drive. Either
way it is erased when closed unlike a table. It is only intended for
temporary storage so there is no benefit from PACKing it. If you want to
retain the data, perhaps for debugging, then you must use a table - but
remember to delete it when you have finished with it or you will get errors.
John Weller
01380 723235
07976 393631
>
> HMM... More testing reveals the following oddities:
>
> You can ZAP a cursor created with READWRITE NOFILTER, but you CANNOT
> issue a PACK.
>
> That would be a significant difference from INTO TABLE if you need to
> delete a bunch of records and then wish to pack the table.
>
> @ Vince - I tried doing the USE (DBF("cursorname")) trick, but it
> wouldn't work, since if I closed the cursor, the file was erased, and
> if I left it open, it said it was already being used?
>
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/001901cb2fbf$36d8ada0$a48a08e0$@co.uk
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
If you need to remove deleted records, ie issue a pack, on the readwrite
cursor this will do the trick.
SELECT * FROM CursorName WHERE NOT DELETED() INTO CURSOR CursorName
READWRITE.
Voila! Cursor has no deleted records.
Caveat! If the cursor is tied to a grid, you may find that all of your
grid settings go away. Look up "SAFE SELECT" article on UT to have a way
get around this issue.
HTH,
Mike
> Thanks Vince & Lew!
>
> I just found this line in the VFP helpfile:
> "NOFILTER creates a cursor that can be used in subsequent queries."
>
> So it would seem READWRITE NOFILTER is the proper equivalent to INTO
> TABLE..
>
> -Steve
>
>
> At 09:56 PM 07/29/2010, you wrote:
>>Steve Ellenoff wrote:
>> > Is there any difference between these two?
>> >
>> > I'm looking at some older code and I have remarks about the SELECT
>> > SQL using INTO TABLE to avoid some VFP errors that says something
>> > like, "Command cannot be issued on a cursor" or something to that
>> effect.
>> >
>> > Would changing my code to CURSOR READWRITE work equally well as the
>> > INTO TABLE ?
>>
>>If you used tables to avoid "operation can not be performed on a
>>cursor," I would think you could do CURSOR READWRITE, followed by USE
>>DBF("MyCursor") ALIAS Bob, and do whatever on Bob. Just off the top of
>>my head.
>>
>>
>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/4ca3ff03bcdef23fcf61606fed7c5509.squirrel@www.webmail.execulink.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
I found that the best way to delete records from a readwrite cursor
bound to a grid is as follows:
select (fieldlist) from (disktable) into cursor curGridCursor readwrite
nofilter
(the above populares grid1, then you can delete records from it, do
other operations, etc.)
At the time of showing the grid back, without the deleted records, call
a delete method in your form with the following code:
** delete method
thisform.grid1.recordsource = ''
use in select('curTemp')
select * from curGridCursor into cursor curTemp where not deleted()
select curGridCursor
zap
append from dbf('curTemp')
use in select('curTemp')
with thisform.grid1
.recordsource = 'curGridCursor'
.column1.controlsource = 'curGridCursor.field1'
.column2.controlsource = 'curGridCursor.field2'
etc
endwith
In this manner, the grid never looses its settings, you do not see the
deleted record mark in the grid and you can go back to your regular
operations "unscathed" (:->).
Rafael Copquin
El 30/07/2010 6:58, msavage@golden.net escribió:
> If you need to remove deleted records, ie issue a pack, on the readwrite
> cursor this will do the trick.
>
> SELECT * FROM CursorName WHERE NOT DELETED() INTO CURSOR CursorName
> READWRITE.
>
> Voila! Cursor has no deleted records.
>
> Caveat! If the cursor is tied to a grid, you may find that all of your
> grid settings go away. Look up "SAFE SELECT" article on UT to have a way
> get around this issue.
>
> HTH,
> Mike
>
>
>> Thanks Vince& Lew!
>>
>> I just found this line in the VFP helpfile:
>> "NOFILTER creates a cursor that can be used in subsequent queries."
>>
>> So it would seem READWRITE NOFILTER is the proper equivalent to INTO
>> TABLE..
>>
>> -Steve
>>
>>
>> At 09:56 PM 07/29/2010, you wrote:
>>
>>> Steve Ellenoff wrote:
>>>
>>>> Is there any difference between these two?
>>>>
>>>> I'm looking at some older code and I have remarks about the SELECT
>>>> SQL using INTO TABLE to avoid some VFP errors that says something
>>>> like, "Command cannot be issued on a cursor" or something to that
>>>>
>>> effect.
>>>
>>>> Would changing my code to CURSOR READWRITE work equally well as the
>>>> INTO TABLE ?
>>>>
>>> If you used tables to avoid "operation can not be performed on a
>>> cursor," I would think you could do CURSOR READWRITE, followed by USE
>>> DBF("MyCursor") ALIAS Bob, and do whatever on Bob. Just off the top of
>>> my head.
>>>
>>>
>>>
>>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/4C52C8C7.1030909@ciudad.com.ar
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.