Temporary table operations
FWTemporaryTable():New(cAlias,aFields); Create(); Delete()Defines the lifecycle of a thread-local temporary table.
Overview
FWTemporaryTable takes an alias and field structure; Create materializes the table, GetAlias returns the work area and Delete removes the table and closes its alias. Visibility is limited to the creating thread, not other jobs. Documentation requires DBAccess 4.2 Server build 20141119 or later. AddIndex defines indexes with names up to two characters. This fragment prepares structure without calling Create; materialization needs a test connection and cleanup on errors too. (Sources: refs. 1–1.)
Syntax
FWTemporaryTable():New(cAlias,aFields); Create(); Delete()Commented example
#Include "Protheus.ch"
User Function Ed519()
Local aFields := {{"ED_CODE","C",10,0}}
// Prepared constructor; create/delete only in a test context.
Local bBuild := {|| FWTemporaryTable():New(GetNextAlias(),aFields)}
ConOut(ValType(bBuild))
Return NilPrints B; the uninvoked block creates no table. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Use a unique alias, define fields/indexes before Create and ensure Delete on normal/error exits. Do not share temporary aliases across threads.
- 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.