cvs: php4 /ext/dbase dbase.c
| From: | Jani Taskinen | Date: | Tue, 14 Aug 2001 11:07:18 +0000 |
| Subject: | cvs: php4 /ext/dbase dbase.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6834@lists.php.net to get a copy of this message | ||
sniper Tue Aug 14 07:07:18 2001 EDT
Modified files:
/php4/ext/dbase dbase.c
Log:
@- Fixed a bug in dbase_get_record() and dbase_get_record_with_names().
@ boolean fields are now returned correctly.
@ Patch by Lawrence E. Widman <widman@cardiothink.com> (Jani)
Index: php4/ext/dbase/dbase.c
diff -u php4/ext/dbase/dbase.c:1.46 php4/ext/dbase/dbase.c:1.47
--- php4/ext/dbase/dbase.c:1.46 Sat Aug 11 12:38:24 2001
+++ php4/ext/dbase/dbase.c Tue Aug 14 07:07:18 2001
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dbase.c,v 1.46 2001/08/11 16:38:24 zeev Exp $ */
+/* $Id: dbase.c,v 1.47 2001/08/14 11:07:18 sniper Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -473,14 +473,26 @@
case 'D':
add_next_index_string(return_value, str_value, 1);
break;
- case 'N': /* FALLS THROUGH */
- case 'L': /* FALLS THROUGH */
+ case 'N':
if (cur_f->db_fdc == 0) {
add_next_index_long(return_value, strtol(str_value, NULL, 10));
} else {
add_next_index_double(return_value, 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 */
+ if ((*str_value == 'T') || (*str_value == 'Y')) {
+ add_next_index_long(return_value, strtol("1", NULL, 10));
+ } else {
+ if ((*str_value == 'F') || (*str_value == 'N')) {
+ add_next_index_long(return_value, strtol("0", NULL, 10));
+ } else {
+ add_next_index_long(return_value, strtol(" ", NULL, 10));
+ }
+ }
+ break;
case 'M':
/* this is a memo field. don't know how to deal with
this yet */
@@ -552,12 +564,24 @@
case 'D':
add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
break;
- case 'N': /* FALLS THROUGH */
- case 'L': /* FALLS THROUGH */
+ case 'N':
if (cur_f->db_fdc == 0) {
add_assoc_long(return_value, cur_f->db_fname, strtol(str_value, NULL, 10));
} 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 */
+ if ((*str_value == 'T') || (*str_value == 'Y')) {
+ add_assoc_long(return_value, cur_f->db_fname,strtol("1", NULL, 10));
+ } else {
+ if ((*str_value == 'F') || (*str_value == 'N')) {
+ add_assoc_long(return_value, cur_f->db_fname,strtol("0", NULL, 10));
+ } else {
+ add_assoc_long(return_value, cur_f->db_fname,strtol(" ", NULL, 10));
+ }
}
break;
case 'M':