I'm using the perl file pg (is it like including?) and doing pg::connectdb, but I'd like to check the return value of SQL.
# begin.
$conn=Pg::connectdb("host=$hostport=$portdbname=$dbname user=$user");
$result=$conn->exec("lock table table_name in access exclusive mode nowait;");
# commit or rollback.
In , I think $result
will contain data, but if the query results are OK, $result->resultStatus;
will contain a value, but I don't understand where to judge the sql error in the first place.
Where is the correct way to look?
postgresql perl
I think the question is more about libpg than Perl, so I suggest you read libpg documents in addition to perldoc already mentioned.If Perldoc's Japanese translation is good, you can also find here.
Where is the correct way to look?
The query execution results are determined by a value of $result->resultStatus
.
The value can be one of the following constants:
The meaning of these constants is found in libpg's document.
© 2024 OneMinuteCode. All rights reserved.