]> granicus.if.org Git - php/commitdiff
- set precision to 0 unless the field is of type N or I
authorUwe Steinmann <steinm@php.net>
Thu, 27 Nov 2003 11:32:05 +0000 (11:32 +0000)
committerUwe Steinmann <steinm@php.net>
Thu, 27 Nov 2003 11:32:05 +0000 (11:32 +0000)
ext/dbase/dbase.c

index 7bcc7f70263d7a24d2b6449599425f0c115c37c4..f73d1cceb33b9660403c96a9de766d91a9775104 100644 (file)
@@ -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);