summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Steinmann <steinm@php.net>2003-11-27 11:32:05 +0000
committerUwe Steinmann <steinm@php.net>2003-11-27 11:32:05 +0000
commit6b813175096fe9fedc9e40fe086acdabe7935f30 (patch)
treea2b196926f34ade42bc6f6ca7ae960f8021e6f14
parent3977fdd7b09193fb8c48816a729a5ef860d57883 (diff)
downloadphp-git-6b813175096fe9fedc9e40fe086acdabe7935f30.tar.gz
- set precision to 0 unless the field is of type N or I
-rw-r--r--ext/dbase/dbase.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
index 7bcc7f7026..f73d1cceb3 100644
--- a/ext/dbase/dbase.c
+++ b/ext/dbase/dbase.c
@@ -791,7 +791,14 @@ PHP_FUNCTION(dbase_get_header_info)
add_assoc_long(row, "length", cur_f->db_flen);
/* number of decimals in field */
- add_assoc_long(row, "precision", cur_f->db_fdc);
+ switch (cur_f->db_type) {
+ case 'N':
+ case 'I':
+ add_assoc_long(row, "precision", cur_f->db_fdc);
+ break;
+ default:
+ add_assoc_long(row, "precision", 0);
+ }
/* format for printing %s etc */
add_assoc_string(row, "format", cur_f->db_format, 1);