php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #1482 Suggested improvment (with code)
Submitted: 1999-06-01 14:56 UTC Modified: 1999-06-01 15:16 UTC
From: squyres at cse dot nd dot edu Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.8 OS: Solaris 2.6
Private report: No CVE-ID: None
 [1999-06-01 14:56 UTC] squyres at cse dot nd dot edu
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));

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-01 15:16 UTC] jim at cvs dot php dot net
This already exists in the form of the dbase_get_record_with_names
function (which may not be documented yet).
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Jun 18 07:00:01 2026 UTC