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.

StepsTo set the AutoCommit and Lock properties in a PowerBuilder script:

  1. Open the application script in which you want to set connection properties.

    For instructions, see the Users Guide.

  2. 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.)

    SQLCA.AutoCommit = value
    
    SQLCA.Lock = "value"
    

    For example, the following statements in a PowerBuilder script use the default Transaction object SQLCA to connect to a Sybase Adaptive Server Enterprise database named Test. SQLCA.AutoCommit is set to True and SQLCA.Lock is set to isolation level 3 (Serializable transactions).

    SQLCA.DBMS       = "SYC"
    
    SQLCA.Database   = "Test"
    
    SQLCA.LogID      = "Frans"
    
    SQLCA.LogPass    = "xxyyzz"
    
    SQLCA.ServerName = "HOST1"
    
    SQLCA.AutoCommit = True
    
    SQLCA.Lock       = "3"
    

    For more information, see AutoCommit or Lock in the online Help.

  3. Compile the script to save your changes.

    For instructions, see the Users Guide.