Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection object and not all of This
Message
De
05/10/2014 12:13:31
 
 
À
05/10/2014 09:09:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01608770
Message ID:
01608797
Vues:
40
>I don't think you're right on this one (if you were, it wouldn't make sense at all that SQL parametrized statements still could work with object properties or, broadly, with a VFP expression).
>
>Have a look at SQLPREPARE() help:
>
>"All parameters in the WHERE clause must be defined before SQLPREPARE( ) is issued. For example, if the parameters are variables, the variables must be created and initialized before SQLPREPARE( ) is issued."
>
>If that is not clear enough, in the help on parametrized views:
>
>"The parameter name you provide is evaluated as a Visual FoxPro expression. If the evaluation fails, Visual FoxPro prompts for a parameter value. The parameter value supplied is sent to the data source as part of the SQL SELECT statement."
>
>I think it's quite clear that the parameter for any kind of a SQL prepared statement is a VFP expression.
>
>Even in the case of output parameters, what VFP expects is the identification of something that can store a value: a variable, an item of an array, or an object property. Here it is the example of the help file for input/output parameters rewritten so that the output parameter is a property of an object:
>
>CLEAR
>
>m.lnConn = SQLCONNECT()
>
>IF SQLEXEC(m.lnConn, "CREATE PROCEDURE sp_test @mult1 int, @mult2 int, @result int " + ;
>							"OUTPUT AS SELECT @result = @mult1 * @mult2") = 1
>	m.loObj = CREATEOBJECT("Empty")
>	ADDPROPERTY(m.loObj, "result", 0)
>	? m.loObj.result
>	SQLEXEC(m.lnconn,"{CALL sp_test(2, 4, ?@m.loObj.result)}")
>	? m.loObj.result
>	SQLEXEC(m.lnConn, "DROP PROCEDURE sp_test")
>ENDIF
>
>
>It will output
>
>     0
>     8,00
>
If it's working with properties, then it's not well documented, because I've not seen a single sample in the docs using properties, all are using variables.

Anyway, is good to know it.
Fernando D. Bozzo
Madrid / Spain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform