/*********************************************************************** * Copyright (C) 2000,2007 by Progress Software Corporation. All rights * * reserved. Prior versions of this work may contain portions * * contributed by participants of Possenet. * * * ***********************************************************************/ /*-------------------------------------------------------------------------- File: launchparam.i Description: Dyn Call Parameter create for launch.i Purpose: When running the dynamic call from dynlaunch.i, this include file will assign the parameter values into the temp-table required for the dynamic call. When the call is finished, it will generate the code to assign the parameter values from the returned values stored in the temp-table. Parameters: History: -------- Created: 22/07/2002 Neil Bell (MIP) Create dynlaunch.i include to cater for dynamic call wrapper calls. ---------------------------------------------------------------------------*/ &IF "{¶m-type}" = "&mode" &THEN /* This is how ¶m-type is going to end up if it hasn't been defined */ &MESSAGE launch.i - For procedure call {&displayIProc} in {&displayPLIP}, parameter number {&order}, you have not specified the &dataType preprocessor. Please fix. &ENDIF &IF "{&mode}" = "" &THEN &MESSAGE launch.i - For procedure call {&displayIProc} in {&displayPLIP}, parameter number {&order}, you have not specified the &mode preprocessor. Please fix. &ENDIF &IF {&clearHandle} <> 'YES' &THEN &SCOPED-DEFINE clearHandle 'NO' &ENDIF /* We need a parameter list for launch.i, build it. Reason being that if not running Appserver, we'll use the standard call, for max performance */ &IF "{¶m-type}" = "TABLE-HANDLE" &THEN &GLOBAL-DEFINE Plist {&Plist} {&mode} TABLE-HANDLE {¶m-name} &ELSEIF "{¶m-type}" = "BUFFER" &THEN &GLOBAL-DEFINE Plist {&Plist} BUFFER {¶m-name} &ELSE &GLOBAL-DEFINE Plist {&Plist} {&mode} {¶m-name} &ENDIF &IF "{&nextparam}" <> "" &THEN /* We don't want a comma at the end of our parameter list, include it if not the last parameter */ &GLOBAL-DEFINE Plist {&Plist} , &ENDIF /* Create the parameter temp-table record */ CREATE ttSeqType. ASSIGN ttSeqType.iParamNo = {&order} ttSeqType.cParamName = &IF "{¶m-type}" = "TABLE-HANDLE" &THEN "T:":U + STRING(iHandleCnt, "99":U) &ELSEIF "{¶m-type}" = "BUFFER" &THEN "B:":U + STRING(iHandleCnt, "99":U) &ELSE "{¶m-name}":U &ENDIF ttSeqType.cDataType = "{¶m-type}":U ttSeqType.cIOMode = "{&mode}":U. &IF "{¶m-type}" = "TABLE-HANDLE" OR "{¶m-type}" = "BUFFER" &THEN ASSIGN hTableHandles[iHandleCnt] = {¶m-name} cTrackTableExtent = cTrackTableExtent + "{¶m-name}|":U + STRING(iHandleCnt) + "|":U + {&clearHandle} + "|":U /* We need to keep track of which extent stores which TABLE-HANDLE, and which TABLE-HANDLE need to be cleared */ iHandleCnt = iHandleCnt + 1. /* When we assign the TABLE-HANDLE back, we're going to search for the param name in the list, the next entry contains the extent it's been stored in */ &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = hTableHandles[INTEGER(ENTRY(LOOKUP("{¶m-name}":U, cTrackTableExtent, "|":U) + 1, cTrackTableExtent, "|":U))]. &GLOBAL-DEFINE tablesInCall YES &ELSE /* For input and input-output parameters, assign the input value. Build the string to assign them back as well (used for &assignValuesBackFromTT) */ &IF "{¶m-type}" = "CHARACTER" &THEN ASSIGN ttSeqType.cCharacter = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.cCharacter. &ELSEIF "{¶m-type}" = "DECIMAL" &THEN ASSIGN ttSeqType.dDecimal = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.dDecimal. &ELSEIF "{¶m-type}" = "DATE" &THEN ASSIGN ttSeqType.tDate = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.tDate. &ELSEIF "{¶m-type}" = "INTEGER" &THEN ASSIGN ttSeqType.iInteger = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.iInteger. &ELSEIF "{¶m-type}" = "DATETIME" &THEN ASSIGN ttSeqType.dtDateTime = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.dtDateTime. &ELSEIF "{¶m-type}" = "DATETIME-TZ" &THEN ASSIGN ttSeqType.dzDateTime = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.dzDateTime. &ELSEIF "{¶m-type}" = "RAW" &THEN ASSIGN ttSeqType.rRaw = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.rRaw. &ELSEIF "{¶m-type}" = "ROWID" &THEN ASSIGN ttSeqType.rRowid = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.rRowid. &ELSEIF "{¶m-type}" = "HANDLE" &THEN ASSIGN ttSeqType.hHandle = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.hHandle. &ELSE ASSIGN ttSeqType.lLogical = {¶m-name}. &GLOBAL-DEFINE assignTTtoParm ASSIGN {¶m-name} = ttSeqType.lLogical. &ENDIF &ENDIF &IF "{&mode}" = "OUTPUT" OR "{&mode}" = "INPUT-OUTPUT" &THEN /* Build the string to assign the value stored in the temp-table back to the variables. * * In dynlaunch.i, we can just put {&assignValuesBackFromTT}, and all the finds and assigns * * will be included correctly. */ &GLOBAL-DEFINE assignValuesBackFromTT {&assignValuesBackFromTT} FIND ttSeqType WHERE ttSeqType.iParamNo = {&order}. {&assignTTtoParm} &ENDIF &UNDEFINE assignTTtoParm