Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
JVP, flexibility of databases
Message
De
21/11/2003 07:44:19
Walter Meester
HoogkarspelPays-Bas
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00851534
Message ID:
00852262
Vues:
32
Hi John,

>I was not making the argument - I was responding to the argument. No question that Fox + DBF's is flexible. The point I made was that .NET + SQL Server can be just as flexible. Put another way - it cannot be demonstrated that .NET + SQL Server is any less flexible than Fox + DBF's.

O.k. You asked for it:

Just imagine a famility tree. Query: Find the oldest ancestor of any given person through the male line:

VFP
FUNCTION GetUpperMaleAncestor(nPerson)

DO WHILE SEEK(nPerson,"FamilyTrees","MaleParent")
   nPerson = FamilyTrees.Person
ENDDO
RETURN nPerson
Now retrieve all offspring of this person
FUNCTION RetrieveOffSpring(nPerson)

CREATE CURSOR offSpring (Person I)
SELECT FamilyTrees
SET ORDER TO TAG MaleParent 

DO GetOffSpring(nPerson)

SELECT * FROM FamilyTrees WHERE EXIST (SELECT Person FROM OffSpring) INTO CURSOR Result
RETURN

*-

FUNCTION GetOffSpring(nPerson)
LOCAL nRec

nRec=RECNO()
SEEK nPerson
DO WHILE !EOF() AND MaleParent = nPerson
    INSERT INTO Offspring (Person)
    DO GetOffSpring (Person)
    SKIP
ENDDO
GO nRec
RETURN
O.K. Your turn to write the SQL example and the ADO.NET implementation (Good luck).

Fact is that SQL DML is terrible in solving hierarchical problems. This is one area where record oriented DMLs like xBase excell and indeed have an advantage over a SQL implementation.

Walter,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform