v5:userguide:debug
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
v5:userguide:debug [2018/07/02 13:06] – prefer functions start lowercase (#430) peterdd | 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 | ||
---|---|---|---|
Line 4: | Line 4: | ||
<WRAP right box> | <WRAP right box> | ||
== Syntax == | == Syntax == | ||
- | $connection-> | + | $connection-> |
</ | </ | ||
Line 10: | Line 10: | ||
Enabling debug mode makes the driver return copious amounts of debugging information from both ADOdb and the PHP driver itself. Information is displayed on both standard output (STDOUT) and standard error (STDERR) channels. | Enabling debug mode makes the driver return copious amounts of debugging information from both ADOdb and the PHP driver itself. Information is displayed on both standard output (STDOUT) and standard error (STDERR) channels. | ||
===== Usage ===== | ===== Usage ===== | ||
- | The debug option can be enabled and disabled at any time, to debug portions of a program. The earliest it can be enabled | + | |
+ | The //debug// option can be enabled and disabled at any time, to debug portions of a program. | ||
+ | The earliest it can be set is after the inclusion of the driver, and before the connection. | ||
+ | |||
+ | In the following example, the table name is spelled incorrectly (it should be **products**). When run without debugging, the execution of the statement | ||
<code php> | <code php> | ||
- | include '/ | + | include ' |
- | $conn = newAdoConnection(' | + | $conn = newAdoConnection(' |
- | $conn-> | + | $conn-> |
$conn-> | $conn-> | ||
- | /* | + | $recordSet = $conn-> |
- | * Invalid syntax in select statment | + | |
- | */ | + | |
- | $recordSet = $conn-> | + | |
</ | </ | ||
+ | |||
The information returned on STDOUT is: | The information returned on STDOUT is: | ||
< | < | ||
- | -----<hr> | + | ------------------------------------------------------------------------------ |
- | (access): select | + | mysqli: SELECT |
- | + | ------------------------------------------------------------------------------ | |
- | -----<hr> | + | Query: select * from product failed. Table ' |
+ | 1146: Table ' | ||
- | Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access | + | Call stack (most recent call first): |
- | database engine cannot find the input table or query 'product'. Make sure it exists and that its | + | 2. ADOConnection:: |
- | name is spelled correctly., SQL state S0002 in SQLExecDirect in /ADOdb/ | + | 1. ADODB_mysqli::execute(SELECT |
- | on line 540 | + | |
- | S0002: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine cannot | + | |
- | find the input table or query ' | + | |
- | ADOConnection._Execute(select | + | |
- | ADOConnection.Execute(select * from product)% line 6, file: C: | + | |
</ | </ | ||
- | + | ||
- | Information on STDERR | + | By default, the parameters passed to the query are compressed into a set of //key => value// pairs. |
- | < | + | This information is printed after the SQL statement, using a '' |
- | PHP Warning: | + | |
- | database | + | ===== Special Options ===== |
- | name is spelled correctly., SQL state S0002 in SQLExecDirect in C: | + | There are 3 non-boolean switches that, if set, will vary some of the output produced |
- | </code> | + | |
+ | ^Value^Description^ | ||
+ | |99|If set, then the results of a debug_backtrace will be appended to every database | ||
+ | |-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.txt · Last modified: 2024/01/09 11:20 by dregad