Bug #1482: Suggested improvment (with code)
| From: | squyres at cse dot nd dot edu | Date: | Tue, 01 Jun 1999 18:56:14 +0000 |
| Subject: | Bug #1482: Suggested improvment (with code) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6373@lists.php.net to get a copy of this message | ||
From: squyres@cse.nd.edu
Operating system: Solaris 2.6
PHP version: 3.0.8
PHP Bug Type: Feature/Change Request
Bug description: Suggested improvment (with code)
I have the misfortune of having to maintain an old DBase3 database. I recently ported the whole
application to PHP3, and discovered a great feature that is is trivial to implement, makes the
DBase3 interface consistent with the other database interfaces of PHP3, and is extremely useful.
Currently, fields from DBase records are only accessible by index number. Adding the capability to
access the data array by the field name (just like all other database interfaces in PHP3) is
extremely handy.
Here's a patch to functions/dbase.c from version 3.0.8 (if the HTML-ized version of this
submission does not behave well with word wrapping and whatnot, please contact me and I can e-mail a
patch directly).
392a393,394
> /* Added associative value */
> add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
396a399
> char *foo = strdup(str_value);
397a401,403
> /* Added associative value */
> add_assoc_long(return_value, cur_f->db_fname, strtol(foo,
> NULL, 10));
> free(foo);
399a406,407
> /* Added associative value */
> add_assoc_long(return_value, cur_f->db_fname,
> atof(str_value));