diff options
| author | Michael Wallner <mike@php.net> | 2006-08-08 15:55:27 +0000 |
|---|---|---|
| committer | Michael Wallner <mike@php.net> | 2006-08-08 15:55:27 +0000 |
| commit | 98d58a80c9d3fcfb64b1c8c37d3075f1a42edda6 (patch) | |
| tree | a42cd052ecd296ee42af616f499986e9c84f28f1 /ext | |
| parent | d58b3869a71e83032874d4feacccea8985bdc53a (diff) | |
| download | php-git-98d58a80c9d3fcfb64b1c8c37d3075f1a42edda6.tar.gz | |
MFH: implement #38357 (dbase_open can't open DBase 3 dbf file)
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/dbase/dbase.c | 11 | ||||
| -rw-r--r-- | ext/dbase/dbf_head.c | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c index d9fdf36bb0..2862db4650 100644 --- a/ext/dbase/dbase.c +++ b/ext/dbase/dbase.c @@ -503,6 +503,13 @@ static void php_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS, int assoc) } } break; + case 'F': + if (!assoc) { + add_next_index_double(return_value, atof(str_value)); + } else { + add_assoc_double(return_value, cur_f->db_fname, atof(str_value)); + } + break; case 'L': /* we used to FALL THROUGH, but now we check for T/Y and F/N and insert 1 or 0, respectively. db_fdc is the number of decimals, which we don't care about. 3/14/2001 LEW */ @@ -690,6 +697,9 @@ PHP_FUNCTION(dbase_create) case 'D': cur_f->db_flen = 8; break; + case 'F': + cur_f->db_flen = 20; + break; case 'N': case 'C': /* field length */ @@ -862,6 +872,7 @@ PHP_FUNCTION(dbase_get_header_info) case 'N': add_assoc_string(row, "type", "number", 1); break; case 'L': add_assoc_string(row, "type", "boolean", 1); break; case 'M': add_assoc_string(row, "type", "memo", 1); break; + case 'F': add_assoc_string(row, "type", "float", 1); break; default: add_assoc_string(row, "type", "unknown", 1); break; } diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c index be3fe5cd98..24b3d06ac9 100644 --- a/ext/dbase/dbf_head.c +++ b/ext/dbase/dbf_head.c @@ -148,6 +148,7 @@ int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf) dbf->db_type = dbfield.dbf_type; switch (dbf->db_type) { case 'N': + case 'F': dbf->db_flen = dbfield.dbf_flen[0]; dbf->db_fdc = dbfield.dbf_flen[1]; break; @@ -231,6 +232,7 @@ char *get_dbf_f_fmt(dbfield_t *dbf) case 'N': case 'L': case 'D': + case 'F': sprintf(format, "%%%ds", dbf->db_flen); break; case 'M': |
