|
Getting and Setting Database InformationThis code sample shows you how to use Python to access a database. For related information, see Database Object and Database Result Set Object.
Here, the get_control_id function searches for all rows in the control table that match the specified control key. If the number of results found is non-zero, the function returns the control ID, which is the value of the control_id column in the first returned row.
The set_control_id function expects a control key, a value for the control ID, and a flag indicating whether to allow overwriting of any existing control ID. The function does the following:
Both functions define exception handlers to trap any errors that occur. |