interbase module patch (updated)
| From: | Max Derkachev | Date: | Fri, 10 Nov 2000 13:15:45 +0000 |
| Subject: | interbase module patch (updated) | ||
| Groups: | php.db php.dev php.general | ||
| Request: | Send a blank email to php-dev+get-34577@lists.php.net to get a copy of this message | ||
I've reworked my patch to interbase php module.
The old way - ibase_query() returns affected rows - breaks php way,
where one should know, is the query succeeded.
The query is successful, if it is executed, and unsuccessful if the
query causes an error (e.g. it could not be prepared, or db link is
lost).
So, if the query is executed, it should return true, but it returns 0
(equivalent to false in php land) if affected_rows is 0 .
To prevent this behaviour, I made ibase_affected_rows() php function,
which uses global variable affected_rows, and
ibase_query now works as earlier (returning 1 on inserts, updates and
deletes).
Alo I added global constant PHP_IBASE_REC_V to options, so now one could
specify RECORD_VERSION (or NO RECORD_VERSION) option of a transaction,
when READ COMMITED is specified (for those who can not or not willing to
look at the php sources :) : these options are passed to the
undocumented ibase_trans() php functions as numbers).
DISCLAIMER:
I did not test this patch in production environment, so use it on your
own risk!.
The patch should be applied to untouched php4.0.2 interbase module
sources ( php_interbase.h ver. 1.17, interbase.c, ver. 1.43)
I compiled it in Debian Linux 2.2, Interbase 6 library (Linux).
For me, it works. Maybe ok :)).
--
Best regards,
Max A. Derkachev mailto:kot@books.ru
Symbol-Plus Publishing Ltd.
phone: +7 (812) 265-0054, 265-1228, phone/fax: 567-8775
http://www.Books.Ru -- All Books of Russia