on 11-15-2013 11:25 AM
In a PB12.5 pfc-enabled application I have an object function with code as follows:
public function integer of_connect(ref transaction mytr)
mytr = create n_tr
mytr.dbms = profilestring('my.ini', 'Switches', 'DBMS', 'ODBC')
mytr.dbparm = profilestring('my.ini', 'Switches', 'Dbparm', '')
connect using mytr;
return mytr.sqlcode
This function is called from many places.
Sometimes case 1:
integer li_ret
transaction ltr
li_ret = of_connect(ltr)
Sometimes case 2:
integer li_ret
n_tr ltr
li_ret = of_connect(ltr)
Both seem to work.
Is this usage legal?
Or should I change all case 1 calls to declare ltr as 'n_tr' instead of 'transaction'
and of_connect() argument as 'n_tr'? The trouble is it is a large app and there are
maybe a thousand instances of case 1.
Could someone point me at documentation which discusses this issue or educate me in
the pros and cons of this usage?
Hi Larry,
It's totally legal, since n_tr inherits from transaction.
In both case, a n_tr object is instantiated.
The only difference is that in case 1 you won't be able to call specific functions of n_tr, if you need it then you just have to change the declaration.
Regards
Guillaume
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
11 | |
10 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.