Coding PowerScript to set values for AutoCommit and
Lock
Another way to specify the AutoCommit and Lock properties in a
script is by coding PowerScript to assign values to the AutoCommit and
Lock properties of the Transaction object. PowerBuilder uses a special
nongraphic object called a Transaction object to communicate with the
database. The default Transaction object is named SQLCA, which stands
for SQL Communications Area.
SQLCA has 15 properties, 10 of which are used to connect to your
database. Two of the connection properties are AutoCommit and Lock,
which you can set as described in the following procedure.
To set the AutoCommit and Lock properties in a PowerBuilder
script:
-
Open the application script in which you want to set
connection properties.For instructions, see the section called “Opening Script views” in Users Guide.
-
Use the following PowerScript syntax to set the AutoCommit
and Lock properties. (This syntax assumes you are using the
default Transaction object SQLCA, but you can also define your own
Transaction object.)12SQLCA.AutoCommit = valueSQLCA.Lock = "value"For example, the following statements in a
PowerBuilder script use the default Transaction object SQLCA to
connect to a SAP Adaptive Server Enterprise database named Test.
SQLCA.AutoCommit is set to True and SQLCA.Lock is set to isolation
level 3 (Serializable transactions).1234567SQLCA.DBMS = "SYC"SQLCA.Database = "Test"SQLCA.LogID = "Frans"SQLCA.LogPass = "xxyyzz"SQLCA.ServerName = "HOST1"SQLCA.AutoCommit = TrueSQLCA.Lock = "3"For more information, see the section called “AutoCommit” in Connection Reference and
the section called “Lock” in Connection Reference. -
Compile the script to save your changes.
For instructions, see the the section called “Compiling the script” in Users Guide.