파빌의 기본 RowsCopy보다 느림니다.
RowsCopy(,,,)는 사본 쪽에 행을 추가 합니다.
이것은 원본과 사본에 모두 행이 존재 해야 합니다, 즉 사본에 행을 추가 하지 않습니다.
보통 POPUP에서 Data를 수정하고 원본(List)부분에 값을 수정해줄때 다시 Retrieve 하는것이 부담스러울때 사용합니다.
** PC 마다 속도는 다르겠지만, 100 Row 기준으로 약 0.4초 걸립니다.
/*
DataWindow 원본의 컬럼과 사본의 모든 컬럼이 같을때 모든 컬럼을 복사 한다.
*/
//integer f_RowsCopy( powerobject ad_soc, long al_soc, powerobject ad_tag, long al_tag )
integer rtn, col, colcnt
String ls_dwtpS, ls_dwtpT, sCol, stype
decimal ldc_data
long ll_data
string ls_data
date ld_data
time lt_data
datetime ldt_data
DataWindow ldwS, ldwT
DataStore ldsS, ldsT
DataWindowChild ldwcS, ldwcT
choose case ad_soc.TypeOf()
case DataWindow!
ldwS = ad_soc ; ls_dwtpS = 'DW'
case DataStore!
ldsS = ad_soc ; ls_dwtpS = 'DS'
case DataWindowChild!
ldwcS = ad_soc ; ls_dwtpS = 'DC'
end choose
choose case ad_tag.TypeOf()
case DataWindow!
ldwT = ad_tag ; ls_dwtpT = 'DW'
case DataStore!
ldsT = ad_tag ; ls_dwtpT = 'DS'
case DataWindowChild!
ldwcT = ad_tag ; ls_dwtpT = 'DC'
end choose
choose case ls_dwtpS
case 'DW'
colcnt = Integer( ldwS.Describe("DataWindow.Column.Count") )
case 'DS'
colcnt = Integer( ldsS.Describe("DataWindow.Column.Count") )
case 'DC'
colcnt = Integer( ldwcS.Describe("DataWindow.Column.Count") )
end choose
for col = 1 to colcnt
choose case ls_dwtpS
case 'DW'
sCol = ldwS.Describe("#"+String(col)+".name")
stype = ldwS.Describe(sCol+".ColType")
case 'DS'
sCol = ldsS.Describe("#"+String(col)+".name")
stype = ldsS.Describe(sCol+".ColType")
case 'DC'
sCol = ldwcS.Describe("#"+String(col)+".name")
stype = ldwcS.Describe(sCol+".ColType")
end choose
if pos(stype, '(') > 0 then stype = Left( stype, pos(stype, '(') - 1 )
choose case ls_dwtpS
case 'DW'
choose case stype
case 'decimal', 'real'
ldc_data = ldwS.GetItemDecimal(al_soc, sCol)
Case 'number', 'long'
ll_data = ldwS.getitemnumber(al_soc, sCol)
case 'char', 'string'
ls_data = ldwS.getitemstring(al_soc, sCol)
case 'date'
ld_data = ldwS.getitemdate(al_soc, sCol)
case 'time'
lt_data = ldwS.getitemtime(al_soc, sCol)
case 'datetime'
ldt_data = ldwS.getitemdatetime(al_soc, sCol)
end choose
case 'DS'
choose case stype
case 'decimal', 'real'
ldc_data = ldsS.GetItemDecimal(al_soc, sCol)
Case 'number', 'long'
ll_data = ldsS.getitemnumber(al_soc, sCol)
case 'char', 'string'
ls_data = ldsS.getitemstring(al_soc, sCol)
case 'date'
ld_data = ldsS.getitemdate(al_soc, sCol)
case 'time'
lt_data = ldsS.getitemtime(al_soc, sCol)
case 'datetime'
ldt_data = ldsS.getitemdatetime(al_soc, sCol)
end choose
case 'DC'
choose case stype
case 'decimal', 'real'
ldc_data = ldwcS.GetItemDecimal(al_soc, sCol)
Case 'number', 'long'
ll_data = ldwcS.getitemnumber(al_soc, sCol)
case 'char', 'string'
ls_data = ldwcS.getitemstring(al_soc, sCol)
case 'date'
ld_data = ldwcS.getitemdate(al_soc, sCol)
case 'time'
lt_data = ldwcS.getitemtime(al_soc, sCol)
case 'datetime'
ldt_data = ldwcS.getitemdatetime(al_soc, sCol)
end choose
end choose
choose case ls_dwtpT
case 'DW'
choose case stype
case 'decimal', 'real'
ldwT.SetItem(al_tag, sCol, ldc_data )
Case 'number', 'long'
ldwT.SetItem(al_tag, sCol, ll_data )
case 'char', 'string'
ldwT.SetItem(al_tag, sCol, ls_data )
case 'date'
ldwT.SetItem(al_tag, sCol, ld_data )
case 'time'
ldwT.SetItem(al_tag, sCol, lt_data )
case 'datetime'
ldwT.SetItem(al_tag, sCol, ldt_data )
end choose
case 'DS'
choose case stype
case 'decimal', 'real'
ldsT.SetItem(al_tag, sCol, ldc_data )
Case 'number', 'long'
ldsT.SetItem(al_tag, sCol, ll_data )
case 'char', 'string'
ldsT.SetItem(al_tag, sCol, ls_data )
case 'date'
ldsT.SetItem(al_tag, sCol, ld_data )
case 'time'
ldsT.SetItem(al_tag, sCol, lt_data )
case 'datetime'
ldsT.SetItem(al_tag, sCol, ldt_data )
end choose
case 'DC'
choose case stype
case 'decimal', 'real'
ldwcT.SetItem(al_tag, sCol, ldc_data )
Case 'number', 'long'
ldwcT.SetItem(al_tag, sCol, ll_data )
case 'char', 'string'
ldwcT.SetItem(al_tag, sCol, ls_data )
case 'date'
ldwcT.SetItem(al_tag, sCol, ld_data )
case 'time'
ldwcT.SetItem(al_tag, sCol, lt_data )
case 'datetime'
ldwcT.SetItem(al_tag, sCol, ldt_data )
end choose
end choose
next
return rtn
첫댓글 fullstate 활용하는거보다 빠른가요?
당연히 느리죠
용도가 다릅니다
Fullstate는 dw_2 를 만들때 dw_1 과 똑 같이(Object와 data 까지) 만들때 사용합니다.
즉 dw_1과 dw_2는 서로 다른 Object로 사용할때 쓰는 것입니다.
RowsCopy와도 다르고 fullchanges 와도 다릅니다.
파워빌더에서 기본적으로 Data관련 함수가 xxxstate,xxx changes, xxxcopy, xxxmove, xxxitem 등등 ...
엄청나게 많은데...
이것과 같이 특수한 목적(100 row 이하)에 response 이후 등 database 접근을 최소화 를 위해서. 사용합니다.