When an SQL function is called it generates an SQL statement suitable for use with the particular database. If
True the SQL statement is executed otherwise the SQL string is returned.
Each field value is automatically converted using the appropriate SQLFieldConverter class described later in this section. If the type of the field cannot be obtained from the
description attribute, the cursor will have used a types cache table to store the type of each field. The types cahce is checked using a call to checkTypes() to ensure that the cursor knows the type of every field to be returned from the database.
If any fields are missing from the cache getTableData() is called to retrieve the information and then mergeTypes() is called to merge the data into the types cache. If there are any discrepencies between what is already in the types cache and what has been retrieved from the database an Exception is raised. Only once the types data is complete is the SQL statement executed.
Once the statement is executed a call is made to fetchRows() to retrieve the data. The types cache is checked once more and then the data is decoded from SQL strings to Python objects otherwise it is left as strings.
The final stage is to convert the data into the approriate format as set by
fetchMode. Once the data is converted to
dtuples it is returned.