Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The solution is not immediate
Message
De
24/02/2005 04:26:04
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
The solution is not immediate
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00989998
Message ID:
00989998
Vues:
50
The VFP9 choice for correlate DELETE and UPDATE have a not funny side effect.

Run and wait
CLEAR
CLOSE DATABASES ALL
CLOSE TABLES ALL

on error ? message()

* don't put NN = 1000
#DEFINE NN 200

CREATE CURSOR data1(fr i)

FOR K=1 TO NN
	INSERT INTO data1 VALUES (RAND()*10)
NEXT
INDEX ON FR TAG TAGJOIN1

CREATE CURSOR data2 (fr i)
FOR K=1 TO NN
	INSERT INTO data2 VALUES (RAND()*10)
NEXT

INDEX ON FR TAG TAGJOIN2

CREATE CURSOR data3 (fr i)
FOR K=1 TO NN
	INSERT INTO data3 VALUES (RAND()*10)
NEXT

INDEX ON FR TAG TAGJOIN3

CREATE CURSOR table1 (F1 I,f2 i,F3 I,F4 I)

* this solution is not possible
DELETE FROM table1 WHERE table1.f1=2 ;
	AND EXIST(SELECT*FROM data1 WHERE fr=table1.f2) ;
	AND EXIST(SELECT*FROM data2 WHERE fr=table1.f3) ;
&&	AND EXIST(SELECT*FROM data3 WHERE fr=table1.f4)

* this solution is not possible
DELETE FROM table1 WHERE table1.f1=2 ;
	AND table1.f2 IN (SELECT*FROM Data1);
	AND table1.f3 IN (SELECT*FROM data2);
&&	AND table1.f4 IN (SELECT*FROM data3)

t1=SECONDS()
DELETE table1 FROM table1 	join data1 A ON A.fr=table1.f2;
				join data2 B ON B.fr=table1.f3;
				join data3 C ON C.fr=table1.f4;
			WHERE table1.f2=2
? SECONDS()-t1
A discreet time in order to understand that not there is nothing to cancel

A solution exists, but it is not intuitive.

Fabio
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform