June 2002
Intermediate to advanced
800 pages
16h 3m
English
Especially for debugging purposes, tracing a connection to a PostgreSQL server can be useful. Tracing a connection means that the data transmitted from and to the back end is monitored and can be used to see what PostgreSQL does internally. In general, the information generated by a trace is only useful if you are familiar with PostgreSQL's internal protocol. However, we need to see how tracing can be turned on and off.
Take a look at the next example:
<?php $dbh = pg_connect("host=localhost user=postgres dbname=phpbook"); if (!$dbh) { echo "error while connecting.<br>\n"; } $status = pg_trace("/tmp/trace.log"); $result = pg_exec($dbh, "SELECT id, name, color FROM plant LIMIT 1"); $rows = pg_numrows($result); ...Read now
Unlock full access