Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Xbase commands Vrs Sql commands
Message
De
10/05/2005 13:06:42
 
 
À
10/05/2005 12:37:41
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 6 SP5
Database:
Visual FoxPro
Divers
Thread ID:
01011885
Message ID:
01012492
Vues:
21
>>Another example where sql is out of the game:
>>Build a database where the data they represent a connected graph ( not a treeview ).
>>Now, tries to extract the set of all row paths between two points with SQL commands.
>
>Known as the "travelling salesman problem"?
>
>Interesting. How do you represent the graph in your database and why is sql out of the game then?
>

If the nodes are homogenous
- a node it is a row of a table
then it is simple:
a table Arches with 3 columns
id is PK, RKid, FKid where (RKid, FKid) is candidate

try
CREATE CURSOR nodes (id I DEFAULT RECCOUNT()+1, tx c(20) DEFAULT TRANSFORM(id,"@R Nodes99999"))
FOR k=1 TO 5
	APPEND BLANK
NEXT
CREATE CURSOR Arches (id I,RKid I,FKid I)
INSERT INTO Arches (1,1,1)
INSERT INTO Arches (1,2,2)
INSERT INTO Arches (1,5,5)
INSERT INTO Arches (1,1,2)
INSERT INTO Arches (1,2,4)
INSERT INTO Arches (1,1,3)
INSERT INTO Arches (1,1,5)
INSERT INTO Arches (1,5,3)
INSERT INTO Arches (1,4,5)

* write a selects program that return the cursor PathNodes(1,5)=[1,2,4,5]
>Bye, Olaf.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform