Re: ODBC
| From: | Stig S. Bakken | Date: | Tue, 30 Jan 2001 01:03:20 +0000 |
| Subject: | Re: ODBC | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-1210@lists.php.net to get a copy of this message | ||
Christian Rishøj wrote:
>
> Hi.
>
> I noticed that DB_FETCHMODE_ASSOC is emulated in the ODBC module:
>
> } else if ($fetchmode == DB_FETCHMODE_ASSOC) {
> for ($i = 0; $i < count($row); $i++) {
> $colName = odbc_field_name($result, $i+1);
> $a[$colName] = $row[$i];
>
> However, odbc_fetch_assoc() is mentioned as a prototype in
> http://zend.com/phpfunc/function.odbc_fetch_array.php, but does
> not seem to
> be implemented yet.
>
> I don't why this is the case, but wouldn't it be smarter to implement the
> DB_FETCHMODE_ASSOC behaviour in the PHP extension instead of in PEAR as far
> as performance is concerned?
> Stig?
That would of course be smarter. There's some code in there that
implements odbc_fetch_(array|object) that is enabled only for DBMAKER
for some reason. It could easily be patched to do odbc_fetch_assoc as
well (can't find a prototype for it even in the source). I'll do it
when I have some cycles unless someone beats me to it.
> Also (while we're at it) I feel it is rather awkward that it is impossible
> to retrieve the error messages from ODBC for use in the PHP application. I
> know that the error message from the database is available to PHP as it
> shows up as a warning if I don't set my error_reporting properly.
>
> It seems someone was about to implement my saviour odbc_errormsg()
> (http://zend.com/phpfunc/function.odbc_errormsg.php), but didn't finish...
> I am convinced that odbc_errormsg() is rather trivial to implement --
> unfortunately I am really no wizard when it comes to C, so I'm afraid I wont
> be able to do it myself...
>
> Stig...? :-)
Uhm, I implemented and documented odbc_error() and odbc_errormsg() two
weeks or so ago. The fact that you find it in the online manual only
proves that the manual is updated more often than we do PHP releases.
:-)
- Stig