SELECT on buffered tables 
Author Message
 SELECT on buffered tables

If we use buffering on the table, then SELECT doesn't pick up modified and
uncommitted changes.

Example:
 create table Table1 free (Flag1 L)
 insert into table1 values (.F.)
 select Flag1 from Table1    &&I'll get .F.

 =cursorsetprop("Buffering",3,"Table1")
 replace Table1.Flag1 with .T.
 select Flag1 from Table1    &&I'll still get .F. (I'd like to get .T.)

Is there are the way to SELECT uncommitted changes?



Tue, 26 Feb 2002 03:00:00 GMT  
 SELECT on buffered tables
Hi,

You could try:

Begin Transaction
Tableupdate(...
Select ....
RollBack

Des


Quote:
> If we use buffering on the table, then SELECT doesn't pick up modified and
> uncommitted changes.

> Example:
>  create table Table1 free (Flag1 L)
>  insert into table1 values (.F.)
>  select Flag1 from Table1    &&I'll get .F.

>  =cursorsetprop("Buffering",3,"Table1")
>  replace Table1.Flag1 with .T.
>  select Flag1 from Table1    &&I'll still get .F. (I'd like to get .T.)

> Is there are the way to SELECT uncommitted changes?



Thu, 28 Feb 2002 03:00:00 GMT  
 SELECT on buffered tables
Although it this method is not SELECT based, you can loop through all the
open tables in the datasession that are buffered, then use GETNEXTMODIFIED()
to position yourself on the modified record, then you can do whatever you
want with it at that time. That could include: 1) building a temporary table
of changes (simulating your output cursor of a SELECT); 2) enacting business
rules; 3) etc.

DECLARE  laUsed[1]
lnTblCount  = AUSED(laUsed, lnDataSession)           && Get the number of
tables currently open

FOR lnXX = 1 TO lnTblCount
    IF    CURSORGETPROP("Buffering", laUsed[lnXX, 1]) > 1
           SELECT (laUsed[lnXX,1])
           lnNextModified = GETNEXTMODIFIED(0, laUsed[lnXX, 1])
          DO WHILE lnNextModified # 0
               GO lnNextModified                                      && Go
to the actual modified row, then do something with it...
               */ Try to get the next modified record so it can be processed
within this DO/ENDDO loop
               lnNextModified = GETNEXTMODIFIED(lnNextModified, laUsed[lnXX,
1])
          ENDDO
    ENDIF
ENDFOR

HTH,

Jeff




Thu, 28 Feb 2002 03:00:00 GMT  
 SELECT on buffered tables
Thank you, Des.
It's a simple and great solution. The only limitation is that transactions
work on tables in databases only. Any ideas for free tables?
Ruslan.


Quote:
> Hi,

> You could try:

> Begin Transaction
> Tableupdate(...
> Select ....
> RollBack

> Des



> > If we use buffering on the table, then SELECT doesn't pick up modified
and
> > uncommitted changes.

> > Example:
> >  create table Table1 free (Flag1 L)
> >  insert into table1 values (.F.)
> >  select Flag1 from Table1    &&I'll get .F.

> >  =cursorsetprop("Buffering",3,"Table1")
> >  replace Table1.Flag1 with .T.
> >  select Flag1 from Table1    &&I'll still get .F. (I'd like to get .T.)

> > Is there are the way to SELECT uncommitted changes?



Thu, 28 Feb 2002 03:00:00 GMT  
 SELECT on buffered tables
Thank you, Jeff.
This will work, but for my task it's too hard way. I have to find something
less time consuming.
Ruslan.


Quote:
> Although it this method is not SELECT based, you can loop through all the
> open tables in the datasession that are buffered, then use
GETNEXTMODIFIED()
> to position yourself on the modified record, then you can do whatever you
> want with it at that time. That could include: 1) building a temporary
table
> of changes (simulating your output cursor of a SELECT); 2) enacting
business
> rules; 3) etc.

> DECLARE  laUsed[1]
> lnTblCount  = AUSED(laUsed, lnDataSession)           && Get the number of
> tables currently open

> FOR lnXX = 1 TO lnTblCount
>     IF    CURSORGETPROP("Buffering", laUsed[lnXX, 1]) > 1
>            SELECT (laUsed[lnXX,1])
>            lnNextModified = GETNEXTMODIFIED(0, laUsed[lnXX, 1])
>           DO WHILE lnNextModified # 0
>                GO lnNextModified                                      &&
Go
> to the actual modified row, then do something with it...
>                */ Try to get the next modified record so it can be
processed
> within this DO/ENDDO loop
>                lnNextModified = GETNEXTMODIFIED(lnNextModified,
laUsed[lnXX,
> 1])
>           ENDDO
>     ENDIF
> ENDFOR

> HTH,

> Jeff






Thu, 28 Feb 2002 03:00:00 GMT  
 SELECT on buffered tables
I don't think there is really because SELECT reads from the disk, not from
the buffer. The xbase commands like COPY TO ARRAY .. FOR.., COPY TO file,
SCAN FOR GetFldState(..), SCATTER read the buffer.
-Anders


| If we use buffering on the table, then SELECT doesn't pick up modified and
| uncommitted changes.
|
| Example:
|  create table Table1 free (Flag1 L)
|  insert into table1 values (.F.)
|  select Flag1 from Table1    &&I'll get .F.
|
|  =cursorsetprop("Buffering",3,"Table1")
|  replace Table1.Flag1 with .T.
|  select Flag1 from Table1    &&I'll still get .F. (I'd like to get .T.)
|
| Is there are the way to SELECT uncommitted changes?
|
|



Sun, 10 Mar 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. SQL-Select on buffered tables

2. SQL Select from Buffered Table

3. - How to SELECT from table buffered view without issuing TABLEUPDATE

4. SELECT from a view with table buffering question

5. SQL Select & Table Buffering

6. Problem with Select SQL and table buffering

7. Problem with Select SQL and table buffering

8. SQL-Select from table-buffered cursor

9. How can you SQL select buffered tables

10. How can you SQL Select buffered tables

11. SELECT from a table w/ buffered data?

12. Table buffering and SQL SELECT and DE

 

 
Powered by phpBB® Forum Software