Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Exec (Asynchonous Vs Synchornous)...
Message
De
25/08/2006 13:38:01
 
 
À
25/08/2006 12:54:09
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 9 SP1
Database:
MS SQL Server
Divers
Thread ID:
01148643
Message ID:
01148661
Vues:
18
>For the same query by sql pass-through, when I use asynchronous mode, I got the result in 80 seconds, and synchronous mode in less than 5 seconds. How to explain that's so longer by asynchronous mode?

Is it possible you tested aysnc first, and sync second? Maybe the backend DB benefited from caching after the first run, so the second was faster. You could test this theory by running an async query after its sync equivalent.

My understanding with async queries is that you can tell the backend DB to run the query, then go and do other things while you're waiting. However, you have to periodically check if the backend has finished. I haven't used async queries in practice but the way I read the VFP docs says that SQLEXEC() calls will return 0 if the query is still executing, so you could do something like this (pseudo-code):
DO WHILE SQLEXEC( ... ) = 0
  < Do some other stuff you want to do while the async query is running >
  
  CallWinAPISleepFunction( < for some time period, e.g. 0.1 seconds > ) && optional

ENDDO
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform