Support for 'F' type of dbase

From: Date: Tue, 14 Sep 1999 21:29:08 +0000
Subject: Support for 'F' type of dbase
Groups: php.dev 
Request: Send a blank email to php-dev+get-10911@lists.php.net to get a copy of this message
Dear PHP developers. I am new to this list. I've just subscribed to suggest a patch that adds support for 'F' (float) type of DBF format which is used in FoxPro. Yesterday I asked about it in php3 mailing list and have found that it is unsupported. It was important to me to have it in PHP. So look at it, and have fun with PHP ! PS. I tried it on PHP-3.0.11 I don't know if it will apply to PHP4 --- dbase.c 1999/09/14 20:54:34 1.1 +++ dbase.c 1999/09/14 21:05:44 @@ -482,6 +482,10 @@ /* this is a memo field. don't know how to deal with this yet */ break; + case 'F': + /* float type field - support added by Valery Zamarayev */ + add_next_index_double(return_value, atof(str_value)); + break; default: /* should deal with this in some way */ break; @@ -559,6 +563,10 @@ case 'M': /* this is a memo field. don't know how to deal with this yet */ break; + case 'F': + /* float type field - support added by Valery Zamarayev */ + add_assoc_double(return_value,cur_f->db_fname,atof(str_value)); + break; default: /* should deal with this in some way */ break; @@ -688,6 +696,7 @@ break; case 'N': case 'C': + case 'F': /* field length */ if (_php3_hash_index_find(field->value.ht,2,(void **)&value) == FAILURE) { php3_error(E_WARNING, "expected field length as third element of list in field %d", i); @@ -697,7 +706,7 @@ convert_to_long(value); cur_f->db_flen = value->value.lval; - if (cur_f->db_type == 'N') { + if (cur_f->db_type == 'N' || cur_f->db_type == 'F') { if (_php3_hash_index_find(field->value.ht,3,(void **)&value) == FAILURE) { php3_error(E_WARNING, "expected field precision as fourth element of list in field %d", i); free_dbf_head(dbh); -- Sincerely etc. Valery Zamarayev http://www.sea.com.ua

« previous php.dev (#10911) next »