Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Future as a FoxPro Developer
Message
De
13/07/2004 11:32:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
13/07/2004 11:26:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00918302
Message ID:
00923768
Vues:
32
>>I see, but he already used named expressions there (in empty use statements) and doing the same SQL N times (where I think N is 7 coming from alen()). I don't understand why he does the same SQL over and over N times if that's his real code. Started to suspect I never could see his original code.
>
>There are seven sets of data files, located in seven different directories (in the real app, it's on seven different servers), representing the data from seven different offices. The task is to select all the records from all of those locations that match the criteria (Cl_Sname="LAWRENCE").


Isn't this the code ?
LOCAL laOffice(1)

lnSecs = SECONDS()

USE Z:\Useful\Offices

SELECT *;
  FROM Offices;
 ORDER BY 1;
  INTO ARRAY laOffice

USE IN Offices

CREATE CURSOR Results(Cl_Ref C(8))

FOR o = 1 TO ALEN(laOffice, 1)
	WAIT WINDOW laOffice(o, 1) NOWAIT
   laOffice(o, 2) = ALLTRIM(laOffice(o, 2))
   USE (laOffice(o, 2) + "client") IN 0
   USE (laOffice(o, 2) + "property") IN 0
   USE (laOffice(o, 2) + "foxguids") IN 0

   SELECT DISTINCT Guid, Cl_Ref, *;
     FROM Client;
     LEFT JOIN Property ON Client.Pr_Code = Property.Pr_Code;
     LEFT JOIN FoxGuids ON FoxGuids.Table = 'Client' AND FoxGuids.PKey = Client.Cl_Ref;
     ORDER BY Cl_Sname, Cl_Fname, Cl_Dob;
     WHERE Cl_Sname = "LAWRENCE";
      INTO CURSOR temp

   SELECT temp
   SCAN
      SCATTER MEMVAR
      INSERT INTO Results FROM MEMVAR
   ENDSCAN

   USE IN Client
   USE IN Property
   USE IN FoxGuids
ENDFOR

?RECCOUNT("Temp")

?SECONDS() - lnSecs
Repeatedly querying from same Client, Property, FoxGUIDS tables. Am I missing something here.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform