ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:debug

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:userguide:debug [2023/04/08 15:43] – Revised "special options" table and added standard true/false values dregadv5: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 copious amounts of debugging information from both ADOdb and the PHP driver itself. Information is displayed on both standard output (STDOUT) and standard error (STDERRchannels+ 
 +Enabling debug mode makes the driver return debugging information from both ADOdb and the PHP driver itself. 
 + 
 +The output includes the executed SQL statement with parameters, as well as error messages and backtrace information if there are problems. 
 +It is suitable for viewing in a browser (see [[#formatting|Formatting section below]] 
 + 
 +See [[v5:reference:logging]] for details on how to capture and redirect output.
 ===== Usage ===== ===== Usage =====
  
Line 19: Line 25:
 include 'adodb.inc.php'; include 'adodb.inc.php';
 $conn = newAdoConnection('mysqli'); $conn = newAdoConnection('mysqli');
 +
 +# Here is the earliest point where Debug Mode can be set
 +
 $conn->connect($host, $user, $pass, 'database'); $conn->connect($host, $user, $pass, 'database');
 +
 +# Enable Debug mode
 $conn->debug = true; $conn->debug = true;
 +
 $recordSet = $conn->execute('SELECT * FROM product'); $recordSet = $conn->execute('SELECT * FROM product');
 </code> </code>
Line 39: Line 51:
 By default, the parameters passed to the query are compressed into a set of //key => value// pairs.  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 ''<code>'' tag. Styling can be applied using CSS, see [[#formatting|Formatting section below]]. This information is printed after the SQL statement, using a ''<code>'' tag. Styling can be applied using CSS, see [[#formatting|Formatting section below]].
 +
 +==== Possible values ====
 +
 +In addition to the standard ''True'' and ''False'' states accepted by this switch, there are 3 additional non-boolean values that, if set, will vary some of the output produced.
 +
 +^ 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 ===== ===== Formatting =====
Line 79: Line 103:
  
  
-===== Special Options ===== 
-There are 3 non-boolean switches that, if set, will vary some of the output produced 
- 
-^ 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.                     | 
 ===== Limitations ===== ===== Limitations =====
  
v5/userguide/debug.1680961433.txt.gz · Last modified: 2023/04/08 15:43 by dregad