Dear All,
I need help.
which way is better when we save the data on advantage database server 10.1.0.028
second way
third
thanks
kok
I need help.
which way is better when we save the data on advantage database server 10.1.0.028
// ads without nesting
function save()
use x new share .....
use y new share .....
use z new share .....
Try
AdsBeginTransaction()
select x
if rlock()
replace field1 with 'abc'
endif
replace_y()
select z
if rlock()
replace field with 'fff'
endif
AdsCommitTransaction()
catch
AdsRollback()
end
dbcommitall()
return nil
static function replace_y()
local colddbf :=select()
select y
if rlock()
replace field1 with '123'
endif
dbselectarea(colddbf)
return nilsecond way
// second way using nesting
function save()
use x new share .....
use y new share .....
use z new share .....
Try
AdsBeginTransaction()
try
AdsBeginTransaction()
select x
if rlock()
replace field1 with 'abc'
endif
AdsCommitTransaction()
catch
AdsRollback()
end
try
AdsBeginTransaction()
replace_y()
AdsCommitTransaction()
catch
AdsRollback()
end
try
AdsBeginTransaction()
select z
if rlock()
replace field with 'fff'
endif
AdsCommitTransaction()
catch
AdsRollback()
end
AdsCommitTransaction()
catch
AdsRollback()
end
dbcommitall()
return nil
static function replace_y()
local colddbf :=select()
select y
if rlock()
replace field1 with '123'
endif
dbselectarea(colddbf)
return nilthird
// third way using nesting
function save()
use x new share .....
use y new share .....
use z new share .....
Try
AdsBeginTransaction()
try
AdsBeginTransaction()
select x
if rlock()
replace field1 with 'abc'
endif
AdsCommitTransaction()
catch
AdsRollback()
end
replace_y()
try
AdsBeginTransaction()
select z
if rlock()
replace field with 'fff'
endif
AdsCommitTransaction()
catch
AdsRollback()
end
AdsCommitTransaction()
catch
AdsRollback()
end
dbcommitall()
return nil
static function replace_y()
local colddbf :=select()
try
AdsBeginTransaction()
select y
if rlock()
replace field1 with '123'
endif
AdsCommitTransaction()
catch
AdsRollback()
end
dbselectarea(colddbf)
return nilthanks
kok