FWPreparedStatement
FWPreparedStatement():New([cQuery])Binds typed values to query parameters.
Overview
SetQuery accepts ? markers and SetString/SetDate/SetNumeric bind one-based positions. GetFixQuery returns SQL with treated/substituted values rather than executing it. Table identifiers are not values and need controlled sources; SetUnsafe must not receive HTTP input. thalysjuvenal demonstrates this pattern on business tables; the adaptation only prepares a teaching-table SELECT without executing SQL or accessing records. Its claim that lists lack native expansion is not universal: TDN documents SetIn. (Sources: refs. 1–2.)
Syntax
FWPreparedStatement():New([cQuery])Methods
SetQuerySets SQL with ? markers.o:SetQuery(cQuery)
SetStringText value without adding SQL quotes manually.o:SetString(nParam,cValue)
GetFixQueryGets the treated query rather than executing it.o:GetFixQuery() --> cQuery
DestroyReleases the statement object.o:Destroy()
Commented example
#Include "Protheus.ch"
User Function Ed444()
Local oStatement := FWPreparedStatement():New()
// Teaching table; prepare only without execution.
oStatement:SetQuery("SELECT ED_CODE FROM ED_TEST WHERE ED_CODE = ?")
oStatement:SetString(1,"ED01")
// No ExecuteQuery or TCSqlExec.
oStatement:Destroy()
Return NilObject with one bound parameter then destroyed; no query executed. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Check LIB version, lifecycle and context before integration. These methods are a documented subset rather than the complete API.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.