Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The solution is not immediate
Message
From
24/02/2005 04:26:04
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
The solution is not immediate
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00989998
Message ID:
00989998
Views:
51
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
Next
Reply
Map
View

Click here to load this message in the networking platform