Reading AutoCommit and Lock values from an external text file

As an alternative to setting the AutoCommit and Lock properties in a PowerBuilder application script, you can use the PowerScript ProfileString function to read the AutoCommit and Lock values from a specified section of an external text file, such as an application-specific initialization file.

StepsTo read AutoCommit and Lock values from an external text file:

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

  2. Use the following PowerScript syntax to specify the ProfileString function with the SQLCA.Lock property:

    SQLCA.Lock = ProfileString ( file, section, key, default )
    

    The AutoCommit property is a boolean, so you need to convert the string returned by ProfileString to a boolean. For example, the following statements in a PowerBuilder script read the AutoCommit and Lock values from the [Database] section of the APP.INI file:

    string ls_string
    ls_string=Upper(ProfileString("APP.INI","Database",
       "Autocommit",""))
    if ls_string = "TRUE" then
       SQLCA.Autocommit = TRUE
    else
       SQLCA.Autocommit = FALSE
    end if
    SQLCA.Lock=ProfileString("APP.INI","Database",
       "Lock","")
    
  3. Compile the script to save your changes.