Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to run Stored Procedure?
Message
 
 
À
04/05/2006 20:05:19
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
Divers
Thread ID:
01119387
Message ID:
01119450
Vues:
16
>Got it, check help for PROCEDURE command and FUNCTION command, Remarks section.
>
>If you define a function, is one search order, if you define a procedure is another, or do they mean that the difference is in the way you call any of them?
>
>Is calling method that determines search order?:
>
>=myFunction(param)
>=myProcedure(param)
>
>or
>
>do myFunction with param
>do myProcedure with param
>
>Or is declaring method that determines search order?:
>
>FUNCTION FunctionName
>[ENDFUNC]
>
>or
>
>PROCEDURE ProcedureName
>[ENDPROC]
>
>It says for Procedure: (this is what you want)
>
>"When you issue the DO command with a procedure name, Visual FoxPro searches for the procedure in the following order:
>
>1 The file containing the DO command.
>2 The current database.
>3 Procedure files opened with SET PROCEDURE.
> For more information, see SET PROCEDURE Command.
>4 Program files in the execution chain.
> Visual FoxPro searches program files in order from the most recently
> executed program to the first program executed.
>5 A standalone program file. "
>
>The order for Function is different:
>
>When you issue the DO command with a function name, Visual FoxPro searches for the function in the following order:
>
>1 The file containing the DO command.
>2 Procedure files opened with SET PROCEDURE.
> For more information, see SET PROCEDURE Command.
>3 Program files in the execution chain.
> Visual FoxPro searches program files in order from
> the most recently executed program to the first program executed.
>5 A standalone program file.
>
>
>I always thought, back in 2.6 DOS days, that using declare function or procedure was the same thing. Let me check my old 2" thick FoxPro Language Reference book:
>
>OK, the pages for FUNCTION and PROCEDURE are 99% identical, even to the search order, so that confirms my belief that using "FUNCTION" or "PROCEDURE" was the same thing, except for the fact that by default variables are passed to FUNCTIONS by value, and to PROCEDURES always by reference.
>
I think this Help is confusing. First of all, remarks to FUNCTION doesn't even mention current database. Does it mean that it's not searched or it's a Help omission?

Secondly, as you noted, it's not clear, what does help mean. Does it mean that if I want to be sure my current database is searched first, I need to write
DO myProcedure with ??????

I never do that, I always use the other syntax
If MyProcedure(par1, par2)

Finally, the program file that contains the function with the same name is already in memory since I execute other functions from it. Unless I decide to move all these functions to SP, does it mean that it would be searched first?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform