ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:debug

Debug Mode

Syntax
$connection->debug = boolean;

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.

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.

include '/dev/access/adodb-master/adodb.inc.php';
$conn = newAdoConnection('access');
$conn->connect('northwind');
$conn->debug = true;
/*
* Invalid syntax in select statment
*/
$recordSet = $conn->Execute('select * from product');

The information returned on STDOUT is:

-----<hr>
(access): select * from product 
   
-----<hr>

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access 
database engine cannot find the input table or query 'product'. Make sure it exists and that its
name is spelled correctly., SQL state S0002 in SQLExecDirect in /ADOdb/drivers/adodb-odbc.inc.php 
on line 540
S0002: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine cannot 
find the input table or query 'product'. Make sure it exists and that its name is spelled correctly.
ADOConnection._Execute(select * from product, false)% line 1163, file: C:\dev\access\ADOdb-master\adodb.inc.php
ADOConnection.Execute(select * from product)% line    6, file: C:\temp\access\test3.php

Information on STDERR

PHP Warning:  odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access
database engine cannot find the input table or query 'product'. Make sure it exists and that its 
name is spelled correctly., SQL state S0002 in SQLExecDirect in C:\ADOdb\drivers\adodb-odbc.inc.php on line 540

Limitations

  • Historically, the output messages were coded to be sent to a web page and some contain formatting that may make the messages more difficult to read.
  • Some drivers, the SQL server driver in particular, produce overwhelming volumes of debugging information.
v5/userguide/debug.txt · Last modified: 2016/01/16 18:46 by mnewnham