Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speed up loop queries
Message
De
28/06/2002 09:36:47
Vladimir Zhuravlev
Institute of the Physics of Earth,Russia
Moscow Region, Russie
 
 
À
28/06/2002 08:11:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00673211
Message ID:
00673243
Vues:
14
>I have a program in VFP 5.0 that builds a sql query for each record it needs to update and then issues that SQL query to an Oracle db on each loop. The pertinent code is (where gnOracleconnection is a definition of the ODBC connection to the database):
>
>num_to_update = reccount()
>for ctr = 1 to num_to_update
>
>
>
>
>** Send the SQL statement to the Oracle database
> returnValue=sqlexec(gnOracleConnection, sqlString)
>
> if returnValue=-1 then & sqlexec failed
> errormessage = "The Oracle connection gnConnection value is " + str(gnOracleConnection) + chr(13)
> errormessage = errormessage + "The error number should be " + str(error())+ chr(13)
> errormessage = errormessage + "The error message should be " + message() + chr(13)
> errormessage = errormessage + "The ticket number being updated was " + alltrim(RECORDNUM) + chr(13)
> messagebox(errormessage)
> return
> endif
>
>
> next
>
>The program takes a while to execute in this fashion. Is there anything that could be done to speed it up?

Hello Tom
I was insulted, because you don't remember, that I have done 4 VFP/Oracle projects and just published paper on your site about VFP/Oracle
The are lots of ways to speed it
Now one
make manual transaction and the sircle begig
sqlsetprop(con,'transaction',2)
count records in circle
and make sqlcommit(con)
let say after each 100 records
Second
put you inserts/update in Oracle procedures
Third
On Oracle it is possible to male so name global correleted update of many records
I shall mail you the sample from home, don have near me
Be more specific, and we make it fast, like devil
Yours Boba
MVP-2006-2011, PHD in Math and Physics ,
host of www.foxclub.ru,
VFP lector at Interface and Microinform companies
Head science researcher of VNIIA Rosatom.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform