From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Sep 24 08:50:02 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7ED571065673 for ; Fri, 24 Sep 2010 08:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5ACA28FC16 for ; Fri, 24 Sep 2010 08:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o8O8o14G005036 for ; Fri, 24 Sep 2010 08:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o8O8o1mY005035; Fri, 24 Sep 2010 08:50:01 GMT (envelope-from gnats) Resent-Date: Fri, 24 Sep 2010 08:50:01 GMT Resent-Message-Id: <201009240850.o8O8o1mY005035@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Hartmann@FreeBSD.org, "O." Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A12D106566B for ; Fri, 24 Sep 2010 08:49:40 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 788288FC14 for ; Fri, 24 Sep 2010 08:49:40 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O8neoD029352 for ; Fri, 24 Sep 2010 08:49:40 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o8O8ne2e029351; Fri, 24 Sep 2010 08:49:40 GMT (envelope-from nobody) Message-Id: <201009240849.o8O8ne2e029351@www.freebsd.org> Date: Fri, 24 Sep 2010 08:49:40 GMT From: Hartmann@FreeBSD.org, "O." To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/150903: databases/dbf: options --sql / --csv does produce crap on floats/doubles X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 08:50:02 -0000 >Number: 150903 >Category: ports >Synopsis: databases/dbf: options --sql / --csv does produce crap on floats/doubles >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Sep 24 08:50:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Hartmann, O. >Release: FreeBSD 8.1-STABLE/amd64 >Organization: FU Berlin >Environment: >Description: Using the tool databases/dbf on an extract of a GIS DBF4 database with the option '--sql output.sql' to produce SQL input, results in useless output. Floating point numbers resulting in zeros. A check with a normal text output (--csv) of 'dbf' shows correct values for fields containing dobles/floats, but switching to --sql output turns results into crap. Below a fragment of both outputs. # dbf --view-info test.dbf dBase Reader and Converter V. 0.8.3.1, (c) 2002 - 2004 by Bjoern Berg -- File statistics dBase version.........: FoxBase+/dBASE III+ (without memo) Date of last update...: 2010-09-16 Number of records.....: 1790816 (001b5360d) Length of header......: 225 (00e1d) Record length.........: 75 (004bd) Columns in file.......: 6 Rows in file..........: 1790816 +---------------+-------+---------------+---------------+---------------+ | field name | type | field adress | length | field dec. | +---------------+-------+---------------+---------------+---------------+ | OBJECTID | N | 0 | 9 | 0 | | POINTID | N | 0 | 9 | 0 | | GRID_CODE | F | 0 | 19 | 11 | | OBJECTID_1 | N | 0 | 9 | 0 | | POINTID_1 | N | 0 | 9 | 0 | | GRID_COD_1 | F | 0 | 19 | 11 | +---------------+-------+---------------+---------------+---------------+ ------ The dump to the console without any options looks like this (and lokks good): # dbf test.dbf | more dBase Reader and Converter V. 0.8.3.1, (c) 2002 - 2004 by Bjoern Berg Export from test.dbf to stdout OBJECTID: 1 POINTID: 1 GRID_CODE: 1.54900000000e+000 OBJECTID_1: 1 POINTID_1: 1 GRID_COD_1: -2.07200000000e+003 OBJECTID: 2 POINTID: 2 GRID_CODE: 1.89150000000e+000 OBJECTID_1: 2 POINTID_1: 2 GRID_COD_1: -2.06800000000e+003 OBJECTID: 3 POINTID: 3 GRID_CODE: 1.95540000000e+000 OBJECTID_1: 3 POINTID_1: 3 GRID_COD_1: -2.06400000000e+003 OBJECTID: 4 POINTID: 4 GRID_CODE: 1.37740000000e+000 OBJECTID_1: 4 POINTID_1: 4 GRID_COD_1: -2.05900000000e+003 OBJECTID: 5 POINTID: 5 GRID_CODE: 9.97400000000e-001 OBJECTID_1: 5 POINTID_1: 5 GRID_COD_1: -2.05700000000e+003 OBJECTID: 6 POINTID: 6 GRID_CODE: 9.60800000000e-001 OBJECTID_1: 6 POINTID_1: 6 GRID_COD_1: -2.05500000000e+003 OBJECTID: 7 POINTID: 7 GRID_CODE: 2.02600000000e-001 OBJECTID_1: 7 POINTID_1: 7 GRID_COD_1: -2.05300000000e+003 OBJECTID: 8 POINTID: 8 GRID_CODE: 6.79400000000e-001 OBJECTID_1: 8 POINTID_1: 8 GRID_COD_1: -2.05400000000e+003 OBJECTID: 9 POINTID: 9 GRID_CODE: 1.18100000000e+000 OBJECTID_1: 9 POINTID_1: 9 ------- Following the CSV output: # dbf --csv test.txt test.dbf # more test.txt "OBJECTID,N,9,0","POINTID,N,9,0","GRID_CODE,F","OBJECTID_1,N,9,0","POINTID_1,N,9,0","GRID_COD_1,F" 1,1, 0.00000000000,1,1, 0.00000000000 2,2, 0.00000000000,2,2, 0.00000000000 3,3, 0.00000000000,3,3, 0.00000000000 4,4, 0.00000000000,4,4, 0.00000000000 5,5, 0.00000000000,5,5, 0.00000000000 6,6, 0.00000000000,6,6, 0.00000000000 7,7, 0.00000000000,7,7, 0.00000000000 8,8, 0.00000000000,8,8, 0.00000000000 9,9, 0.00000000000,9,9, 0.00000000000 [...] ---- .. and the SQL output: # dbf --sql test.sql test.dbf # more test.sql -- test.sql -- -- -- SQL code with the contents of dbf file test.dbf drop table test; CREATE TABLE test( OBJECTID int, POINTID int, GRID_CODE numeric(19, 11), OBJECTID_1 int, POINTID_1 int, GRID_COD_1 numeric(19, 11) ); INSERT INTO test VALUES( 1,1, 0.00000000000,1,1, 0.00000000000); INSERT INTO test VALUES( 2,2, 0.00000000000,2,2, 0.00000000000); INSERT INTO test VALUES( 3,3, 0.00000000000,3,3, 0.00000000000); INSERT INTO test VALUES( 4,4, 0.00000000000,4,4, 0.00000000000); INSERT INTO test VALUES( 5,5, 0.00000000000,5,5, 0.00000000000); INSERT INTO test VALUES( 6,6, 0.00000000000,6,6, 0.00000000000); INSERT INTO test VALUES( 7,7, 0.00000000000,7,7, 0.00000000000); INSERT INTO test VALUES( 8,8, 0.00000000000,8,8, 0.00000000000); INSERT INTO test VALUES( 9,9, 0.00000000000,9,9, 0.00000000000); [...] >How-To-Repeat: Take some extracts from a GIS, preferably ArcGIS (DBF) and try to convert them to CSV or a SQL-input. >Fix: >Release-Note: >Audit-Trail: >Unformatted: