Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Server with Vfp and Com+
Message
De
07/04/2004 19:24:49
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Data Server with Vfp and Com+
Divers
Thread ID:
00893135
Message ID:
00893135
Vues:
52
Hi everybody
I´m studying Martín Salias’ example “A poor man's database server”

http://www.utmag.com/July2002/Page22.asp

Where the component receives a string as a parameter and then runs it.
Trying to make it a bit more functional, I did as follows


DEFINE CLASS Executor AS Session OLEPUBLIC

*!* Original example
PROCEDURE SqlCommand( tcCommand as String ) as String

local lcReturn
lcReturn = ""

Close Databases all

&tcCommand

If Empty( Alias() ) or Reccount() = 0
* Nothing to do

Else
CursorToXML( Alias(), "lcReturn", 1, 1 + 8, 0, "1")
endif

Return lcReturn
ENDPROC

*!* My contribution
PROCEDURE ScriptCommand( tcCommand as String, ;
tuParam1 as Variant, ;
tuParam2 as Variant, ;
tuParam3 as Variant, ;
tuParam4 as Variant ;
) as String

Return=EXECSCRIPT( tcCommand, ;
tuParam1, ;
tuParam2, ;
tuParam3, ;
tuParam4 )
ENDPROC

ENDDEFINE


The string passed as parameter (tcCommand) is generated in the client side with


TEXT TO lcText NOSHOW TEXTMERGE PRETEXT 7
.....
.....
.....
ENDTEXT



The idea is to have a kind of running a little process,
and not only a single command, on the server´s machine.
In fact, it works.

I know that I must be care of using any visual object, and kept it stateless.
The first is quite simple, but I’m not so sure how to keep the component stateless.

If I declare some local variables, am I going against the stateless rule?
And what about error handling? Can I do it inside the process,
or I have to catch it and inform the client, with a return string,
that something wrong has happened?
In a word, am I against some rule of thumb?
What other considerations do you believe must I take
in mind when writing the process

TIA
Ricardo Aidelman
Software Developer
Praxis Computación
Buenos Aires, Argentina
Répondre
Fil
Voir

Click here to load this message in the networking platform