pg_result_error and tests/large_object.inc

From: Date: Wed, 01 May 2002 18:16:29 +0000
Subject: pg_result_error and tests/large_object.inc
Groups: php.qa 
Request: Send a blank email to php-qa+get-5292@lists.php.net to get a copy of this message
Hi, it's not entirely clear to me, how pg_result_error should be used. When I make an illegal query, like: <?php $con=pg_connect('host=127.0.0.1 dbname=pbase user=test password=test'); $sql="SELECT id FROM non_existent"; $rs=pg_query($con, $sql); if(!$rs) {
        echo pg_result_error($rs);
        echo "not ";
} echo "OK"; pg_close($con); ?> I'm presented with: PHP Warning: pg_result_error() expects parameter 1 to be resource, boolean given Which is kind of logical. The sync_query.inc in tests/ is the only file it's used, obviously on a valid query, so that doesn't make it much clearer. Yasuo: could you make an example of how this should be used? Secondly: tests/large_object.inc uses plain "host=localhost" as connection string. I personally don't see a reason for that, so could you change that? $ diff -u large_object.inc.dist large_object.inc
--- large_object.inc.dist       Mon Dec 17 01:16:48 2001
+++ large_object.inc    Wed May  1 20:12:24 2002
@@ -2,7 +2,7 @@ include('config.inc'); -$db = pg_connect("host=localhost"); +$db = pg_connect($conn_string); pg_exec ($db, "begin"); $oid = pg_lo_create ($db); if (!$oid) echo ("pg_lo_create() error\n"); Met vriendelijke groeten / With kind regards, Webmaster IDG.nl Melvyn Sopacua

« previous php.qa (#5292) next »