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
Next revisionBoth sides next revision
reference:debug [2015/11/23 00:53] – [Limitations] mnewnhamv5:userguide:debug [2022/08/21 19:11] – Updated the special options into the page mnewnham
Line 4: Line 4:
 <WRAP right box> <WRAP right box>
 == Syntax == == Syntax ==
-  $connection->debug = boolean;+  $connection->debug = boolean|int;
 </WRAP> </WRAP>
  
 ===== 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 (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 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 simply returns false. The debug option can be enabled and disabled at any time, to debug portions of a program. The earliest it can be enabled 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 simply returns false.
 +
    
 <code php> <code php>
Line 18: Line 19:
 $conn->debug = true; $conn->debug = true;
 /* /*
-* Invalid syntax in select statment/ +* Invalid syntax in select statment 
-*. +*/ 
-$recordSet = $conn->Execute('select * from product');+$recordSet = $conn->execute('select * from product');
 </code> </code>
 The information returned on STDOUT is: The information returned on STDOUT is:
Line 45: Line 46:
 name is spelled correctly., SQL state S0002 in SQLExecDirect in C:\ADOdb\drivers\adodb-odbc.inc.php on line 540 name is spelled correctly., SQL state S0002 in SQLExecDirect in C:\ADOdb\drivers\adodb-odbc.inc.php on line 540
 </code> </code>
 +
 +By default, the parameters passed to each SQL statement to be executed are compressed into a set of key=>value pairs. This information is printed using the <code> tag if sent to a browser After the print of the SQL statement. An additional class "adodb-debug" can be used to apply styling to the statement.
 +
 +===== Special Options =====
 +There are 3 non-boolean switches that, if set, will vary some of the output produce
 +^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, reducing the amount of output to STDOUT |
 ===== Limitations ===== ===== Limitations =====
  
v5/userguide/debug.txt · Last modified: 2024/01/09 11:20 by dregad