Skip to content

Instantly share code, notes, and snippets.

@jbratu
Created April 4, 2019 17:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbratu/cdd9e8a3bf1c5732663b7fff1c0c3627 to your computer and use it in GitHub Desktop.
Save jbratu/cdd9e8a3bf1c5732663b7fff1c0c3627 to your computer and use it in GitHub Desktop.
https://www.revelation.com/o4wtrs/oecgi3.exe/O4W_RUN_FORM?INQID=WORKS_READ&KEY=9A63280D61AE93030A85D434E&SUMMARY=0#/section/breadcrumb/UPDATETABLE/Display
subroutine t_Refresh_blank_rdk(list_id)
/*
** Build rdk from a syslists record
** listId is the key to a syslists record is a list of SYSREPOS ids
** each line should be a sysrepos id or table/row
** commented rows start with #
** comments in lines start with ;
** e.g.
**
** # Some entities
** MYAPP*STPROC**MYPROG ; bugfix 1234
** MYAPP*STPROCEXE**MYPROG
** MYAPP*STPROCDBG**MYPROG
**
** # Some rows
** SYSENV/CFG_MYITEM1
** SYSENV/CFG_MYITEM2
** DICT.MYTABLE/MYCOLUMN
** MYTABLE/MYROW1
** MYTABLE/MYROW2
**
**
** Note:
** This will deploy typical objects such as stprocs, oiwins,
** This handle tables, images, anything fancy
** This does not look at dependencies
# this is a comment
MYAPP*STPROC**MYITEM ; this is a comment about an item
*/
#pragma format_Indent_comments
$insert Logical
Declare Function retstack, Repository
atself = retstack()<1>
err = null$
If Assigned(list_Id) Else list_id = null$
If list_id == null$ then
list_id = "DEPLOYME"
end
ids = Xlate('SYSLISTS', list_id, null$, 'X')
* Delete header from list?
If count(ids<1>, @tm) Then
ids = Delete(ids,1,0,0)
end
If ids == null$ Then
* Hey, this is my own program, just break on an error
DEBUG
return
End
* Where do I Write?
today = Oconv(date(), 'D4/')
suffix = today[-4,4]:today[1,2]:today[4,2]
base ='c:\temp'
If base[-1,1] = '\' Else
base := '\'
End
rdkpath = base:'RDK_':list_id:'_':suffix
* Are you sure?
debug
* Make Sysupgrade table
Call Set_Status(0)
call Detach_Table('SYSUPGRADE')
call attach_table(rdkpath,'SYSUPGRADE','GLOBAL')
If Get_Status(err) then
attribs = '1000,500,5,2048,80'
If dir(rdkpath)<2> else
Call Utility('MAKEDIR', rdkpath)
end
Call Create_table(rdkpath, 'SYSUPGRADE', 0, 'GLOBAL', attribs, 0)
call attach_table(rdkpath,'SYSUPGRADE','GLOBAL')
End else
Call clear_Table('SYSUPGRADE')
end
IF tableExists('SYSUPGRADE') Else
debug
return
end
* Headers
Call Write_row('SYSUPGRADE', '%MODULE%', 'MVBFS', 0)
Call Write_row('SYSUPGRADE', '%PROCESS%', null$, 0)
installer = Xlate('SYSOBJ', '$RDKMODULEINSTALL', null$, 'X')
Call Write_row('SYSUPGRADE', '%RUN%', installer, 0)
Call Write_row('SYSUPGRADE', '%REQLO%', '0', 0)
icol = null$
loop
Remove id From ids at icol Setting imark
* Strip out comments
id = trim(id[1,'#'][1,';'])
Convert @lower.Case To @upper.Case In id
If id # null$ Then
If Index(id, '/',1) Then
target_id = id
table = Field(id, '/',1)
id = Field(id, '/',2,999)
End else
table = 'SYSREPOS'
target_id = table:'/':id
end
rec = xlate(table, id, null$, 'X')
if len(rec) Then
call Write_row('SYSUPGRADE', target_id, rec, 1)
Call send_info(id)
Call Set_Status(0)
If table == "SYSREPOS" Then
target_rec = Repository('ACCESS', id)
type = Field(id, '*', 2)
typeclass = Field(id, '*', 2, 2)
entId = Field(id, '*', 4)
If type = "APPROW" Then
target_table = Field(entId,':', 1)
target_name = Field(entId,':', 2)
End Else
target_name = entId
target_table = Xlate('SYSREPOSTYPES', type, 4, 'X')
If target_Table == null$ Then
target_table = Xlate('SYSREPOSCLASSES', type, 4, 'X')
End
end
If target_rec != null$ And target_table != null$ Then
target_Id = target_table : '/' : target_name
call Write_row('SYSUPGRADE', target_id, target_rec, 0)
End Else
DEBUG
Call Set_Status(0)
end
End
End Else
debug
end
end
While imark
repeat
Call Set_Status(0)
Call detach_Table('SYSUPGRADE')
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment