Parameter settings to aid debugging
While developing an application that involves access to external data sources (and in particular when using ODBC) it is advisable to enable the output of error messages from the driver and possibly other debug information. The module mmodbc defines the following parameters to enable debug output and to retrieve information about the SQL statements that have been executed (for a complete list of the module parameters the reader is refered to the mmodbc documentation in the `Mosel Language Reference Manual'). To obtain the corresponding mmoci parameter names, replace the prefix SQL by OCI.
- SQLverbose
- Enable/disable mesasge printing by the ODBC driver.
- SQLdebug
- Enable/disable debug mode.
- SQLrowcnt
- Number of lines affected by the last SQL command.
- SQLrowxfr
- Number of lines transfered by the last SQL command.
- SQLsuccess
- Indicates whether the last SQL command succeeded.
- SQLconnection
- Identification number of the active connection to a database.
Parameters are set and retrieved with Mosel statements similar to the following:
setparam("SQLdebug", true) writeln("Number of lines transfered: ", getparam("SQLrowxfr"))
With the odbc driver you may also use the `debug' option of the driver instead of the global setting:
initializations to "mmodbc.odbc:debug;data.xls" A as "MyOutTable1" end-initializations
or
initializations to "mmodbc.odbc:data.xls" A as "debug;MyOutTable1" end-initializations
In the first case, the setting applies to the whole initializations block, in the second case only to the specific statement (there may be any number of statements in a single block).
With the oci driver, a connection string including the `debug' option as global setting will look as follows:
initializations to "mmoci.oci:debug;myusername/mypassword@dbname" A as "MyOutTable1" end-initializations