debug

This method will enable debugging, so that you can trace your full queries.

Parameters

debug($log2file = false, $debugFile = false)
$log2file:When set to 1, log is written to a single file, if 2 it creates multiple log files per request so that you can do a more intense debugging, off stop debuging.
$debugFile:Path of the file to write logs, defaults to /tmp/dalmp.log

Constants

define('DALMP_DEBUG_FILE', '/home/tmp/debug.log');

Defines where the debug file will be write to.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

require_once 'dalmp.php';

$user = getenv('MYSQL_USER') ?: 'root';
$password = getenv('MYSQL_PASS') ?: '';

$DSN = "utf8://$user:$password".'@127.0.0.1/test';

$db = new DALMP\Database($DSN);

/**
 * 1 log to single file
 * 2 log to multiple files (creates a log per request)
 * off stop debug
 */
 $db->debug(1);

 try {
   $rs = $db->getOne('SELECT now()');
 } catch (Exception $e) {
   print_r($e->getMessage());
 }

 echo $db,PHP_EOL; // print connection details

Thanks Navicat for supporting Open Source projects.

Navicat



A great amount of time has been spent creating, crafting and maintaining this software, please consider donating.

Donating helps ensure continued support, development and availability.

dalmp


comments powered by Disqus