Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
I’ve not been able to find much good documentation on asynch SPT, however in searching the Universal Thread, I came across your comments. I though that I would pass this by you as to whether I’m actually processing correctly. I have very large data sets both in VFP on a back end and against an Informix database, and data rarely comes across complete if at all with normal SPT, so I started playing with asynch. My real question is that when I repeatedly call sqlexec(), I’m not sure how much to include in the parameters. I’d also like to suppress the messages and haven’t found a good method to do that.
Here is code segment that I am currently using.
I’d appreciate any and all suggestions you might have, and would even like to post my accumulated methodology someplace for the benefit of all.
ThisForm.nconnecthandle = SQLCONNECT('EckeMaster')
IF ThisForm.nconnecthandle <= 0
=MESSAGEBOX('Cannot make connection to Server', 16, 'SQL Connect Error')
ThisForm.resetmover()
Return
EndIf
SQLSetProp(ThisForm.nconnecthandle,"Asynchronous",.T.)
lnsuccess=Sqlexec(ThisForm.nconnecthandle, lcsql, 'mainquery')
Do While .T.
If lnsuccess = -1
=MESSAGEBOX('Stock Schedule Query Failed', 16, 'SQL Connect Error')
=SQLDISCONNECT(ThisForm.nconnecthandle)
ThisForm.resetmover()
Return
Endif
If lnsuccess = 0
lnsuccess=Sqlexec(ThisForm.nconnecthandle, lcsql, 'mainquery')
Loop
Endif
If lnsuccess > 0
=SQLDISCONNECT(ThisForm.nconnecthandle)
Exit
Endif
EndDo
ThisForm.nconnecthandle = SQLCONNECT('EckeMaster')
IF ThisForm.nconnecthandle <= 0
=MESSAGEBOX('Cannot make connection to Server', 16, 'SQL Connect Error')
ThisForm.resetmover()
Return
EndIf
SQLSetProp(ThisForm.nconnecthandle,"Asynchronous",.T.)
lnsuccess1 = Sqlexec(ThisForm.nconnecthandle, lcsource, 'mainsource')
Do While .T.
If lnsuccess1 = -1
=MESSAGEBOX('Source Query Failed', 16, 'SQL Connect Error')
=SQLDISCONNECT(ThisForm.nconnecthandle)
ThisForm.resetmover()
Return
Endif
If lnsuccess1 = 0
lnsuccess1 = Sqlexec(ThisForm.nconnecthandle, lcsource, 'mainsource')
Loop
Endif
If lnsuccess1 > 0
=SQLDISCONNECT(ThisForm.nconnecthandle)
Exit
Endif
EndDo
Dan Windus
Nursery Management Systems
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement