I want to make sure queries returned aren't empty. Tried this:
$conn = Pg::connectdb("dbname=$db"); $res = $conn->exec("$q"); $result_status = $res->resultStatus;
($result_status!= PGRES_EMPTY_QUERY) ? print "query not empty\n" :
print "query empty\n";
But it returns '2' (not sure which constant it is, but it's not
PGRES_EMPTY_QUERY) on empty queries.
What's the right use of this property?
--
Randy Perry
sysTame
Mac Consulting/Sales
Randall Perry <rgp@systame.com> writes:
> I want to make sure queries returned aren't empty.
Check the number of rows returned (after checking for OK
resultStatus).
> But it returns '2' (not sure which constant it is, but it's not
> PGRES_EMPTY_QUERY) on empty queries.
PGRES_EMPTY_QUERY means you sent an empty string as the query, eg$conn->exec("");
This is pretty useless, and is distinguished only for historical
reasons...
regards, tom lane
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера