GetTrans method (DataWindows)
Description
Gets the values for the DataWindow control or DataStore object’s
internal transaction object and stores these values in the programmer-specified transaction
object.
Controls
|
DataWindow type |
Method applies to |
|---|---|
|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
Syntax
[PowerBuilder]
|
1 |
integer <span>dwcontrol</span>.<span>GetTrans</span> ( transaction <span>transaction</span> ) |
|
Argument |
Description |
|---|---|
|
dwcontrol |
A reference to a DataWindow control, |
|
transaction |
The name of the transaction object into |
Return Values
Returns 1 if it succeeds and –1 if an error occurs.
The return value is usually not used.
If any argument value is null, the method returns null.
Usage
The SetTrans method (not the SetTransObject method)
sets the internal transaction object. If you have not called SetTrans, GetTrans will
fail.
Use GetTrans when you want to get the values
for the transaction object in order to modify them, as shown in
the last example.
If you are using SetTransObject, which
specifies transaction information using a programmer-specified transaction
object, GetTrans will not report information
about the programmer-specified transaction object currently in effect.
(SetTransObject is the recommended connection
method because it gives better application performance. See SetTrans and SetTransObject for
more information.)
Examples
This example puts the values in the internal transaction
object for dw_employee into the programmer-specified transaction
object named object1:
|
1 |
transaction object1 |
|
1 |
object1 = CREATE transaction |
|
1 |
dw_employee.<span>GetTrans</span>(object1) |
The following statement puts the values in the internal
transaction object for dw_employee into the default transaction
object (SQLCA):
|
1 |
dw_employee.<span>GetTrans</span>(SQLCA) |
The following statements change the database type
and password of dw_employee. The first two statements create
the transaction object emp_TransObj. The next two statements
use the SetTrans method to set the values of SQLCA, and then use the GetTrans method
to store the values of the current transaction object for dw_employee
in emp_TransObj. The last two statements change the database
type and password, and then the SetTrans method
puts the revised values in the transaction object for dw_employee:
|
1 |
// Name the transaction object. |
|
1 |
transaction emp_TransObj |
|
1 |
|
1 |
// Create the transaction object. |
|
1 |
emp_TransObj = CREATE transaction |
|
1 |
|
1 |
// Set the internal transaction object. |
|
1 |
dw_employee.SetTrans(SQLCA) |
|
1 |
|
1 |
// Fill the new transaction object with original |
|
1 |
// values from SQLCA. |
|
1 |
dw_employee.<span>GetTrans</span>(emp_TransObj) |
|
1 |
|
1 |
// Put revised values into the new transaction |
|
1 |
// object. |
|
1 |
// Change the database type. |
|
1 |
emp_TransObj.DBMS = "Sybase" |
|
1 |
|
1 |
// Change the password. |
|
1 |
emp_TransObj.LogPass = "cam2" |
|
1 |
|
1 |
// Associate the new transaction object with |
|
1 |
// dw_employee, replacing SQLCA. |
|
1 |
dw_employee.SetTrans(emp_TransObj) |