v5:userguide:debug
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:userguide:debug [2023/04/08 12:39] – [Usage] revised example following 5.23 refactoring of _adodb_debug_execute(). Note: removed paragraph on STDERR output, I don't think we actually do that anymore dregad | v5:userguide:debug [2024/01/09 11:20] (current) – [Description] link to Logging page dregad | ||
---|---|---|---|
Line 8: | Line 8: | ||
===== Description ===== | ===== Description ===== | ||
- | Enabling debug mode makes the driver return | + | |
+ | Enabling debug mode makes the driver return debugging information from both ADOdb and the PHP driver itself. | ||
+ | |||
+ | The output | ||
+ | It is suitable for viewing in a browser | ||
+ | |||
+ | See [[v5: | ||
===== Usage ===== | ===== Usage ===== | ||
Line 19: | Line 25: | ||
include ' | include ' | ||
$conn = newAdoConnection(' | $conn = newAdoConnection(' | ||
+ | |||
+ | # Here is the earliest point where Debug Mode can be set | ||
+ | |||
$conn-> | $conn-> | ||
+ | |||
+ | # Enable Debug mode | ||
$conn-> | $conn-> | ||
+ | |||
$recordSet = $conn-> | $recordSet = $conn-> | ||
</ | </ | ||
Line 40: | Line 52: | ||
This information is printed after the SQL statement, using a ''< | This information is printed after the SQL statement, using a ''< | ||
- | ===== Special Options ===== | + | ==== Possible values |
- | There are 3 non-boolean | + | |
+ | In addition to the standard '' | ||
+ | |||
+ | ^ Value ^ Description | ||
+ | | False | Debug mode disabled (normal operations) | ||
+ | | True | Standard mode, prints executed SQL statements and error information including a Backtrace if the query failed. | ||
+ | | -1 | Same as Standard mode, but with the line separators around the SQL statements suppressed. | ||
+ | | 99 | Prints a Backtrace after every query execution, **even if the execution is successful**. | ||
+ | | -99 | Debug information is only printed if query execution failed, reducing the amount of output. | ||
+ | |||
+ | |||
+ | ===== Formatting ===== | ||
+ | |||
+ | Starting with ADOdb 5.23.0, debug output is printed with HTML markup and styled with CSS classes. This can be leveraged to improve display of various elements. | ||
+ | The output' | ||
+ | |||
+ | * Wrapper '' | ||
+ | * **SQL statement** '' | ||
+ | * Table with 2 columns (column 1 has '' | ||
+ | * Row 1 with the query in a '' | ||
+ | * Optional row 2 with the parameters in a '' | ||
+ | * **Error message** '' | ||
+ | * Code execution **backtrace** '' | ||
+ | |||
+ | Here is how the output looks like with the basic stylesheet below | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <code css> | ||
+ | .adodb-debug-sql code { | ||
+ | font-size: large; | ||
+ | } | ||
+ | .adodb-debug-errmsg { | ||
+ | font-weight: | ||
+ | color: red; | ||
+ | } | ||
+ | .adodb-debug-trace table { | ||
+ | border-spacing: | ||
+ | border: 1px solid; | ||
+ | } | ||
+ | .adodb-debug-trace thead { | ||
+ | background-color: | ||
+ | } | ||
+ | .adodb-debug-trace th, .adodb-debug-trace td { | ||
+ | border: 1px solid; | ||
+ | padding: 2px 6px; | ||
+ | } | ||
+ | </ | ||
- | ^Value^Description^ | ||
- | |99|If set, then the results of a debug_backtrace will be appended to every database execution, **//even if the execution is successful// | ||
- | |-1|If set, and the code is being run in a browser, then the line separators around the statement are suppressed. This option has no effect when the code is run in a CLI environment.| | ||
- | |-99|If set, then the SQL statement print is suppressed **//if the execution succeeds// | ||
===== Limitations ===== | ===== Limitations ===== | ||
v5/userguide/debug.1680950398.txt.gz · Last modified: 2023/04/08 12:39 by dregad