98 lines
3.0 KiB
Plaintext
98 lines
3.0 KiB
Plaintext
compile Insert RTI_XBAND_DATASOURCE_DATATABLE_TEMPLATE
|
|
|
|
Function {PROCNAME}(UID)
|
|
/*
|
|
** Mimic BRW using An SQL stored procedure return a dataset
|
|
** Build a workging table were oconv, sort is all done "server-side"
|
|
** So report can just have groups with Break-on, minimal chatter with OI.
|
|
**
|
|
** Note: RTI_XBAND_DATASOURCE_TEMPLATE is the basis for the program
|
|
** RTI_XBAND_GENPROC uses the template to generate the code
|
|
** RTI_XBAND_SUPPORT calls RTI_XBAND_GENPROC, compiles the source, loads it on stack like rlist
|
|
**
|
|
** The BRW, via NetOI / RunDotNet, calls RTI_XBAND_SUPPORT
|
|
**
|
|
** 03-27-13 rjc Created
|
|
** 06-27-18 rjc Support @mv in readnext / read, use onGosub
|
|
** 07-17-18 rjc Fixes for 10.0.0.3
|
|
** 12-05-19 rjc Add records_processed for 10.0.8
|
|
** 01-14-20 rjc use rlist_text_1 for row processed
|
|
*/
|
|
|
|
Declare Function dcount, isEventContext,select_into
|
|
|
|
equ OTHERWISE$ to 1
|
|
equ TRUE$ to 1
|
|
equ FALSE$ to 0
|
|
equ YES$ to 1
|
|
equ NO$ to 0
|
|
Equ NULL$ to ""
|
|
Equ tab$ To \09\
|
|
Equ crlf$ To \0D0A\
|
|
|
|
|
|
$Insert msg_equates
|
|
$Insert rti_resolve_select_callback_equates
|
|
|
|
Declare Function isEventContext,select_Into
|
|
If Assigned(UID) Else UID = ""
|
|
RSLT = ""
|
|
|
|
Equ logid$ To ""
|
|
Open 'SYSLISTS' To f_syslists Else null
|
|
|
|
If logid$ Then
|
|
Writev "IN->":uid on f_syslists, logid$,-1 Else null
|
|
end
|
|
|
|
|
|
Call Set_Status(0)
|
|
//"ID":@SVM:"FNAME":@svm:"LNAME":@vm:"System.String":@SVM:"System.String":@SVM:"System.String"
|
|
// bzs remove quote(), force in at_id
|
|
|
|
descriptor_names = "{COLHEADS}"
|
|
descriptor_types = "{COLTYPES}"
|
|
Descriptor = descriptor_names:@VM:descriptor_types
|
|
Convert "," To @SVM In descriptor
|
|
|
|
* bzs don't join them until the end
|
|
* rslt = descriptor:@fm:Select_into('{CMD}', 'TABNORMALIZED')
|
|
wasGuiEnabled = rti_resolve_Select_callback(rtirsc_getGuiEnabled$)
|
|
If wasGuiEnabled else
|
|
unused = rti_resolve_Select_callback(rtirsc_EnableGui$)
|
|
end
|
|
|
|
|
|
rslt = Select_into('{CMD}', 'TABNORMALIZED')
|
|
|
|
If wasGuiEnabled else
|
|
unused = rti_resolve_Select_callback(rtirsc_DisableGui$)
|
|
end
|
|
|
|
* remove trailing crlf$
|
|
Loop
|
|
While rslt[-2,2] == crlf$
|
|
rslt[-2,2] = ""
|
|
Repeat
|
|
|
|
* Switch to @svm for columns,@vm for rows
|
|
Convert tab$:crlf$ to @svm:@vm In rslt
|
|
|
|
* bzs remove "column heading" row
|
|
rslt = Delete(rslt, 1, 1, 0)
|
|
|
|
* bzs join them together now
|
|
rslt = Descriptor:@FM:rslt
|
|
|
|
|
|
|
|
If logid$ Then
|
|
Writev "OUT->":quote(rslt) on f_syslists, logid$,-1 Else null
|
|
tmp= rslt
|
|
Convert @svm To tab$ In tmp
|
|
Swap @vm With crlf$ In tmp
|
|
OSWrite tmp On 'c:\temp\xb_dataset.txt'
|
|
end
|
|
|
|
Return RSLT
|