Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Local View with Views in JOIN condition
Message
De
08/03/2006 17:33:14
 
 
À
08/03/2006 14:36:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01101756
Message ID:
01102631
Vues:
22
>>Not everything and every behavior is or can be documented. Quite often, a developer will do tests to see how VFP will behave in the course of his work. That's not proceeding "blindly" or "without understanding" as you suggest.
>>
>
>Ok, you don't like the words I used. That is understandable, they do not praise. Just out of curiosity what words would you use to describe a situation when a developer performed insufficient/unrepresentative testing, made some incorrect conclusions about tool's behavior based on that testing, developed an application using that incorrect conclusions.
>
>For those who is more interested to know how VFP actually works than to find someone to blame, here is a little code and results to think about:
>
>CLEAR
>CLOSE DATABASES all
>
>DELETE FILE testRequery.d*
>
>CREATE DATABASE testRequery
>CREATE TABLE testRequery (f1 I)
>INSERT INTO testRequery VALUES (1)
>
>CREATE SQL VIEW VIEW1 as select * from testRequery!testRequery
>CREATE SQL VIEW VIEW2 as select * from testRequery!View1
>
>CLOSE DATABASES all
>
>OPEN DATABASE testRequery
>USE VIEW1 IN 0 NODATA
>USE View2 IN 0
>?1,RECCOUNT("View1"),RECCOUNT("View2")
>REQUERY("View2")
>?2,RECCOUNT("View1"),RECCOUNT("View2")
>REQUERY("View1")
>?3,RECCOUNT("View1"),RECCOUNT("View2")
>REQUERY("View2")
>?4,RECCOUNT("View1"),RECCOUNT("View2")
>
>INSERT INTO testRequery VALUES (2)
>INSERT INTO testRequery VALUES (3)
>
>REQUERY("View2")
>?5,RECCOUNT("View1"),RECCOUNT("View2")
>REQUERY("View1")
>?6,RECCOUNT("View1"),RECCOUNT("View2")
>REQUERY("View2")
>?7,RECCOUNT("View1"),RECCOUNT("View2")
>
>USE VIEW1 IN 0 NODATA ALIAS _GFFDGSRTRSGS
>REQUERY("View2")
>?8,RECCOUNT("View1"),RECCOUNT("_GFFDGSRTRSGS"),RECCOUNT("View2")
>REQUERY("_GFFDGSRTRSGS")
>REQUERY("View2")
>?9,RECCOUNT("View1"),RECCOUNT("_GFFDGSRTRSGS"),RECCOUNT("View2")
>
>CLOSE DATABASES all
>
>
>Results in VFP6, VFP7, VFP8, VFP9:
>
>1          0          0
>2          0          0
>3          1          0
>4          1          1
>5          1          1
>6          3          1
>7          3          3
>8          3          0          0
>9          3          3          3
>
Aleksey,
but does it seem yourself that one can use a thing that works in this way,
without a documentation ?
The result of a requery depends on the cursor with bigger workarea than it represents
a nested view:
CLEAR
CLOSE DATABASES all

DELETE FILE testRequery.d*

CREATE DATABASE testRequery
CREATE TABLE testRequery (f1 I)
INSERT INTO testRequery VALUES (1)

CREATE SQL VIEW VIEW1 as select * from testRequery!testRequery 
CREATE SQL VIEW VIEW2 as select * from testRequery!View1 

CLOSE DATABASES all

OPEN DATABASE testRequery
USE VIEW1 IN 0
USE View2 IN 0 

INSERT INTO testRequery VALUES (2)
INSERT INTO testRequery VALUES (3)

REQUERY("View2")
* 1, 1
?5,RECCOUNT("View1"),RECCOUNT("View2")
REQUERY("View1")
* 3, 1
?6,RECCOUNT("View1"),RECCOUNT("View2")

REQUERY("View2")
* 3, 3
?7,RECCOUNT("View1"),RECCOUNT("View2")

USE VIEW1 IN 0 NODATA ALIAS _GFFDGSRTRSGS
? "the files are different !",DBF('_GFFDGSRTRSGS'),DBF('View1')

REQUERY("View2")
* This is a bug, VFP uses the top view1
* then the View2 requery is out of control
* 3 , 0 , 0
?8,RECCOUNT("View1"),RECCOUNT("View2"),RECCOUNT("_GFFDGSRTRSGS")

* MOVE THE VIEW1 TO TOP
USE DBF('view1') AGAIN IN SELECT(1)

* now vfp CAN REQUERY VIEW2
REQUERY("View2")
* 3 , 3 , 0
?9,RECCOUNT("View1"),RECCOUNT("View2"),RECCOUNT("_GFFDGSRTRSGS")

CLOSE DATABASES all
DELETE DATABASE testRequery DELETETABLES
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform