iNTERFACEWARE Products Manual > Installing and Using Chameleon > Using Python Scripting > Python Scripting Examples > Getting and Setting Database Information |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
This 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. |